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.
When righ...
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?
There is a bug with these tools in VS 2012 right click DbContext > Entity Framework > View Entity Data Model only works if the full connection string is specified. Simply the name of the connection string does not work. This may be a consequence of my EDM being in a separate project. Please fix this bug.
public partial class UnityDbContext : DbContext { public UnityDbContext() : base("Server=...full connection string...") //Works //: base("Name=UnityDbContext") //Not works { ... }
I was initially excited to discover this tool while watching a Julier Lerman video but when I tried to "View Entity Data Model", I got a cryptic VS error "sequence contains no matching element" :-(
Rowan, I'm sure you guys are well aware of this but EF Power Tools Beta 3 in VS 2012 does not reverse engineer SQL Compact databases. Is this bug going to fixed in the next revision?
The error is:
System.ArgumentException:
The modelEntityContainerName parameter 'C:\XXXX\XXXXContext' contains characters that are not valid. at XXXsdfConteSystem.Data.Entity.Design.EntityModelSchemaGenerator.Initialize(EntityContainer storeEntityContainer, IEnumerable`1 storeFunctions, String namespaceName, String modelEntityContainerName) at System.Data.Entity.Design.EntityModelSchemaGenerator..ctor(EntityContainer storeEntityContainer, String namespaceName, String modelEntityContainerName) at Microsoft.DbContextPackage.Handlers.ReverseEngineerCodeFirstHandler.ReverseEngineerCodeFirst(Project project)
Reverse engineering works fine, but Data Model viewing fails with "Sequence contains no elements". My context is inherited directly from DbContext, and it has default constructor. VS2010, EF5.
Once I have generated POCO files, and now I want to just generate for few specific tables, as I have already done some alterations in the existing poco classes. There is no option available.
I was able to resolve the issue above by customizing the t4 templates. You can determine if the FK is set to cascade via navProperty.ToEndMember.DeleteBehavior == System.Data.Metadata.Edm.OperationAction.Cascade
Unfortunately, doesn't seem to be working on Visual Studio 2012. I tried using the "View Entity Data Model (Read-Only)" option (as well as other options in the same menu). It's giving me a "Sequence contains no matching element" error. This happens even for a very simple context with a simple entity.
Is there any place where I can get a stack trace or more details?
Got this error when attempting to update to the latest release. Any solutions?
02/07/13 16:31:28 - Install Error : VSIXInstaller.SignatureMismatchException: The signature on the update version of 'Entity Framework Power Tools Beta 2' does not match the signature on the installed version. Therefore, Extension Manager cannot install the update. at VSIXInstaller.Common.VerifyMatchingExtensionSignatures(IInstalledExtension installedExtension, IInstallableExtension updateExtension) at VSIXInstaller.InstallProgressPage.BeginInstallVSIX(SupportedVSSKU targetAppID)
I can't get it Reverse Engineer a SQL Compact database. The database I am trying to open is db.sdf.
System.ArgumentException: The modelEntityContainerName parameter 'D:\dbsdfContext' contains characters that are not valid. at System.Data.Entity.Design.EntityModelSchemaGenerator.Initialize(EntityContainer storeEntityContainer, IEnumerable`1 storeFunctions, String namespaceName, String modelEntityContainerName) at System.Data.Entity.Design.EntityModelSchemaGenerator..ctor(EntityContainer storeEntityContainer, String namespaceName, String modelEntityContainerName) at Microsoft.DbContextPackage.Handlers.ReverseEngineerCodeFirstHandler.ReverseEngineerCodeFirst(Project project)
Unable to view entity data in any format from 'Entity Framework' submenu in Solution Explorer. Exception thrown in dialog box: "Exception has been thrown by the target of an invocation" when I attempt.
Reverse Engineering DB works, however. Great feature!
This was working excellently for me but recently I have been getting the error below when doing a reverse engineer. I have been pulling my hair out trying to work out what's going wrong. The same solution works on my coworkers machines when doing the same thing so it must be something wrong on my Visual Studio.
One or more errors occurred while processing template 'Entity.tt'. CodeTemplates\ReverseEngineerCodeFirst\Entity.tt(2,4) : error : There was an error loading the include file 'EF.Utility.CS.ttinclude'. The transformation will not be run. The following Exception was thrown: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.DbContextPackage.Utilities.EfTextTemplateHost.Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost.LoadIncludeText(String requestFileName, String& content, String& location) at Microsoft.VisualStudio.TextTemplating.Engine.ProcessIncludeDirective(Directive directive, ITextTemplatingEngineHost host)