|
| 1 | +<!DOCTYPE html> |
| 2 | +<!--[if IE]><![endif]--> |
| 3 | +<html> |
| 4 | + |
| 5 | + <head> |
| 6 | + <meta charset="utf-8"> |
| 7 | + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| 8 | + <title>High-Level Tasks | FluentMigrator documentation </title> |
| 9 | + <meta name="viewport" content="width=device-width"> |
| 10 | + <meta name="title" content="High-Level Tasks | FluentMigrator documentation "> |
| 11 | + <meta name="generator" content="docfx 2.44.0.0"> |
| 12 | + |
| 13 | + <link rel="shortcut icon" href="../images/favicon.ico"> |
| 14 | + <link rel="stylesheet" href="../styles/docfx.vendor.css"> |
| 15 | + <link rel="stylesheet" href="../styles/docfx.css"> |
| 16 | + <link rel="stylesheet" href="../styles/main.css"> |
| 17 | + <meta property="docfx:navrel" content="../toc.html"> |
| 18 | + <meta property="docfx:tocrel" content="toc.html"> |
| 19 | + |
| 20 | + <meta property="docfx:rel" content="../"> |
| 21 | + |
| 22 | + </head> |
| 23 | + <body data-spy="scroll" data-target="#affix" data-offset="120"> |
| 24 | + <div id="wrapper"> |
| 25 | + <header> |
| 26 | + |
| 27 | + <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation"> |
| 28 | + <div class="container"> |
| 29 | + <div class="navbar-header"> |
| 30 | + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar"> |
| 31 | + <span class="sr-only">Toggle navigation</span> |
| 32 | + <span class="icon-bar"></span> |
| 33 | + <span class="icon-bar"></span> |
| 34 | + <span class="icon-bar"></span> |
| 35 | + </button> |
| 36 | + |
| 37 | + <a class="navbar-brand" href="../index.html"> |
| 38 | + <img id="logo" class="svg" src="../images/logo.svg" alt=""> |
| 39 | + </a> |
| 40 | + </div> |
| 41 | + <div class="collapse navbar-collapse" id="navbar"> |
| 42 | + <form class="navbar-form navbar-right" role="search" id="search"> |
| 43 | + <div class="form-group"> |
| 44 | + <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off"> |
| 45 | + </div> |
| 46 | + </form> |
| 47 | + </div> |
| 48 | + </div> |
| 49 | + </nav> |
| 50 | + |
| 51 | + <div class="subnav navbar navbar-default"> |
| 52 | + <div class="container hide-when-search" id="breadcrumb"> |
| 53 | + <ul class="breadcrumb"> |
| 54 | + <li></li> |
| 55 | + </ul> |
| 56 | + </div> |
| 57 | + </div> |
| 58 | + </header> |
| 59 | + <div class="container body-content"> |
| 60 | + |
| 61 | + <div id="search-results"> |
| 62 | + <div class="search-list"></div> |
| 63 | + <div class="sr-items"> |
| 64 | + <p><i class="glyphicon glyphicon-refresh index-loading"></i></p> |
| 65 | + </div> |
| 66 | + <ul id="pagination"></ul> |
| 67 | + </div> |
| 68 | + </div> |
| 69 | + <div role="main" class="container body-content hide-when-search"> |
| 70 | + |
| 71 | + <div class="sidenav hide-when-search"> |
| 72 | + <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a> |
| 73 | + <div class="sidetoggle collapse" id="sidetoggle"> |
| 74 | + <div id="sidetoc"></div> |
| 75 | + </div> |
| 76 | + </div> |
| 77 | + <div class="article row grid-right"> |
| 78 | + <div class="col-md-10"> |
| 79 | + <article class="content wrap" id="_content" data-uid=""> |
| 80 | + |
| 81 | +<p>FluentMigrator supports changing naming conventions for:</p> |
| 82 | +<ol> |
| 83 | +<li>Columns</li> |
| 84 | +<li>Constraints</li> |
| 85 | +<li>Indexes</li> |
| 86 | +<li>Sequences</li> |
| 87 | +<li>Schemas</li> |
| 88 | +<li>Auto Names</li> |
| 89 | +<li>Root Paths</li> |
| 90 | +</ol> |
| 91 | +<p>While FluentMigrator comes with reasonable naming conventions, some organizations may have strict standards. |
| 92 | +In such cases, overriding FluentMigrator's opinion may be desirable.</p> |
| 93 | +<h1 id="high-level-tasks">High-Level Tasks</h1> |
| 94 | +<ol> |
| 95 | +<li>Implement the <code>IConventionSet</code> interface (example: see below)</li> |
| 96 | +<li>Register the <code>IConventionSet</code> as singleton: <code>services.AddSingleton<IConventionSet>(new YourConventionSet())</code></li> |
| 97 | +</ol> |
| 98 | +<h1 id="example-iconventionset-implementation">Example <code>IConventionSet</code> implementation</h1> |
| 99 | +<pre><code class="lang-cs"> public class YourConventionSet : IConventionSet |
| 100 | + { |
| 101 | + public YourConventionSet() |
| 102 | + : this(new DefaultConventionSet()) |
| 103 | + { |
| 104 | + } |
| 105 | + |
| 106 | + public YourConventionSet(IConventionSet innerConventionSet) |
| 107 | + { |
| 108 | + ForeignKeyConventions = new List<IForeignKeyConvention>() |
| 109 | + { |
| 110 | + /* This is where you do your stuff */ |
| 111 | + new YourCustomDefaultForeignKeyNameConvention(), |
| 112 | + innerConventionSet.SchemaConvention, |
| 113 | + }; |
| 114 | + |
| 115 | + ColumnsConventions = innerConventionSet.ColumnsConventions; |
| 116 | + ConstraintConventions = innerConventionSet.ConstraintConventions; |
| 117 | + IndexConventions = innerConventionSet.IndexConventions; |
| 118 | + SequenceConventions = innerConventionSet.SequenceConventions; |
| 119 | + AutoNameConventions = innerConventionSet.AutoNameConventions; |
| 120 | + SchemaConvention = innerConventionSet.SchemaConvention; |
| 121 | + RootPathConvention = innerConventionSet.RootPathConvention; |
| 122 | + } |
| 123 | + |
| 124 | + /// <inheritdoc /> |
| 125 | + public IRootPathConvention RootPathConvention { get; } |
| 126 | + |
| 127 | + /// <inheritdoc /> |
| 128 | + public DefaultSchemaConvention SchemaConvention { get; } |
| 129 | + |
| 130 | + /// <inheritdoc /> |
| 131 | + public IList<IColumnsConvention> ColumnsConventions { get; } |
| 132 | + |
| 133 | + /// <inheritdoc /> |
| 134 | + public IList<IConstraintConvention> ConstraintConventions { get; } |
| 135 | + |
| 136 | + /// <inheritdoc /> |
| 137 | + public IList<IForeignKeyConvention> ForeignKeyConventions { get; } |
| 138 | + |
| 139 | + /// <inheritdoc /> |
| 140 | + public IList<IIndexConvention> IndexConventions { get; } |
| 141 | + |
| 142 | + /// <inheritdoc /> |
| 143 | + public IList<ISequenceConvention> SequenceConventions { get; } |
| 144 | + |
| 145 | + /// <inheritdoc /> |
| 146 | + public IList<IAutoNameConvention> AutoNameConventions { get; } |
| 147 | + } |
| 148 | +</code></pre> |
| 149 | +</article> |
| 150 | + </div> |
| 151 | + |
| 152 | + <div class="hidden-sm col-md-2" role="complementary"> |
| 153 | + <div class="sideaffix"> |
| 154 | + <div class="contribution"> |
| 155 | + <ul class="nav"> |
| 156 | + <li> |
| 157 | + <a href="https://github.com/fluentmigrator/documentation/blob/master/articles/faq-change-naming-conventions.md/#L1" class="contribution-link">Improve this Doc</a> |
| 158 | + </li> |
| 159 | + </ul> |
| 160 | + </div> |
| 161 | + <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix"> |
| 162 | + <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> --> |
| 163 | + </nav> |
| 164 | + </div> |
| 165 | + </div> |
| 166 | + </div> |
| 167 | + </div> |
| 168 | + |
| 169 | + <footer> |
| 170 | + <div class="grad-bottom"></div> |
| 171 | + <div class="footer"> |
| 172 | + <div class="container"> |
| 173 | + <span class="pull-right"> |
| 174 | + <a href="#top">Back to top</a> |
| 175 | + </span> |
| 176 | + <table border='0'><tr><td><span>Copyright © 2018 Fluent Migrator Project<br>Generated by <strong>DocFX</strong></span></td><td><a rel='license' href='http://creativecommons.org/licenses/by-sa/4.0/'><img alt='Creative Commons License' style='border-width:0' src='https://i.creativecommons.org/l/by-sa/4.0/88x31.png'></a><br><span xmlns:dct='http://purl.org/dc/terms/' property='dct:title'>FluentMigrator Documentation</span> by <a xmlns:cc='http://creativecommons.org/ns#' href='https://fluentmigrator.github.io' property='cc:attributionName' rel='cc:attributionURL'>FluentMigrator Project</a> is licensed under a <a rel='license' href='http://creativecommons.org/licenses/by-sa/4.0/'>Creative Commons Attribution-ShareAlike 4.0 International License</a>.</td></tr></table> |
| 177 | + |
| 178 | + </div> |
| 179 | + </div> |
| 180 | + </footer> |
| 181 | + </div> |
| 182 | + |
| 183 | + <script type="text/javascript" src="../styles/docfx.vendor.js"></script> |
| 184 | + <script type="text/javascript" src="../styles/docfx.js"></script> |
| 185 | + <script type="text/javascript" src="../styles/main.js"></script> |
| 186 | + </body> |
| 187 | +</html> |
0 commit comments