Preview of useful design-time features for DbContext.
When right-clicking on a C# project, the following context menu function is supported:
1) Reverse Engineer Code First - Generates POCO classes, derived DbContext and Code First mapping for an existing database.
Great tool, but the reverse engineer needs a dialog to select specific tables, I tested the tool on a data base with 1267 tables and have to wait to much time to generate the classes, and after that, delete all the unnecesary files.
Until you can select individual tables to add, I don't find this very useful.
I am writing a small app to view To-Dos in a database of 100 tables, and have to wait for all of those classes to generate, then deleting all of unused data, is challenging and a waste of my time. Please make these changes.
error : Running transformation: System.NullReferenceException: Object reference not set to an instance of an object.
However I have the solution for anyone else who reads this:
Right click on the project > Entity Framework > Custom Reverse Engineer Templates
This will add a few .tt files into your projet so that you can now change them (and fix the bug!)
- Open Mapping.tt - Search for the line "if (fixedLengthFacet != null && (bool)fixedLengthFacet.Value)" - Replace this with "if (fixedLengthFacet != null && fixedLengthFacet.Value is bool && (bool)fixedLengthFacet.Value)" - Run Entity Framework > Reverse Engineer Code First
This is a great tool. It's still flaky enough to deserve the "Beta" appellate, but the code generated is still a tremendous time-saver for production work.
The biggest feature I'd like to see is the ability to select which tables to generate entities for. I'm using this tool for 1) working on a new app with a lot of churn from the DBA and 2) refactoring an old app. For both, I want to work within bounded contexts that are fairly stable. I don't need to rummage through 100+ files of junk for the bits I don't need.
Even without that feature, this tool is a huge help.
one of our smallest database which is using for checking out new technologies such as web api and Entity frame work, obviously it is too time consuming to create poco classes for 1392 tables therefore we excited about this tool but ...
as soon as we click OK on database connection dialog the whole visual studio hang and it did not come back.
System.ArgumentException: Value does not fall within the expected range. at EnvDTE.SourceControl.IsItemUnderSCC(String ItemName) at Microsoft.DbContextPackage.Extensions.SourceControlExtenstions.CheckOutItemIfNeeded(SourceControl sourceControl, String itemName) at Microsoft.DbContextPackage.Extensions.ProjectExtensions.AddNewFile(Project project, String path, String contents) at Microsoft.DbContextPackage.Handlers.ReverseEngineerCodeFirstHandler.ReverseEngineerCodeFirst(Project project)
ALSO does not column names of "Error", must be an ADMIN account.
The situation is if you have a table in the database which has no non-prime key columns then the reverse engineer code first power tool will ignore this table. A specific example we encountered was we had a link table that had three columns and these three columns were used together to form a composite primary key. As a result the EF power tool totally ignored this table when reverse engineering. It should not be ignoring this table!!! The work around was to add an extra non –primary key column, which we called empty column.
We are currently using this tool for one of our apps. And this tool is awesome.
But we have an other app where it has around 500 tables, when we try to reverse engineer this tool generates 1 file per table. So when starting up the app the entity framework is taking lots of time since it is trying to load all the files.
Could you let us know when the feature will be available to select the tables we want to generate?