-
Notifications
You must be signed in to change notification settings - Fork 227
Upgrading from v2 to v3
The different versions add these files in your project, <Database>
being the name you gave it:
v2 | v3 |
---|---|
<Database>.tt |
<Database>.tt |
EF.Reverse.POCO.ttinclude |
EF.Reverse.POCO.v3.ttinclude |
EF.Reverse.POCO.Core.ttinclude |
As you can see, they sit nicely together (notice the 'v3' within the filename), and you can have a mix of v2 and v3 in your project, and even within the same folder without a problem.
If you have an existing database v2 file called Hello.tt
and you wish to upgrade it.
-
Delete your old v2 files:
EF.Reverse.POCO.ttinclude
andEF.Reverse.POCO.Core.ttinclude
-
Right-click on your project, and Add a v3 Reverse POCO generator file called
Hello1.tt
in the same folder as your v2Hello.tt
file. -
The v2
Hello.tt
and v3Hello1.tt
files are similar, but are too dissimilar for AraxisMerge / BeyondCompare to do a decent job of file comparison as the tt files are laid out quite differently.Here is an example of Araxis comparing the two files and showing just how different they are:
What you really want to do is find the changes you made to your v2 file, and pull those into the v3 file. Araxis will do a great job of comparing your vanilla v2 file, with your v2
Hello.tt
. A vanilla (unchanged) v2 file can be downloaded here: VanillaV2.ttAraxis Merge comparing
VaniallV2.tt
toHello.tt
. Much better, now you can see the changes you made:Beyond Compare doing the same job, but only showing the diffs:
-
Now you know what you did in v2, it's easy to do the same changes to your v3 file.
-
Settings.ConnectionStringName = "Hello"
This is the same, so bring that in. -
Settings.ConnectionString
is mandatory in v3, so you need to provide the 'Hello' connection string from your app.config/web.config/appsettings.json file. This connection string is used by the generator to reverse-engineer your database. It no longer obtains your connection strings from *.config files.For example:
Settings.ConnectionString = "Data Source=(local);Initial Catalog=Hello;Integrated Security=True;Encrypt=false;TrustServerCertificate=true";
-
Most settings are similar (apart from filtering), so bring those in.
-
Filtering has been enhanced in v3. Gone are the days of a single do-it-all regex, you can now split them up into much smaller regexes. You can have as many as you like, and mix and match them. In fact, I have a separate document just for that Filtering documentation.
You can still have a single regex in v3, so it's easy enough to bring in your old single Regex into v3.
If you had
Settings.TableFilterInclude = new Regex(".*[Bb]illing.*");
, this would becomeFilterSettings.TableFilters.Add(new RegexIncludeFilter(".*[Bb]illing.*"));