The EntityObject Generator can be used to generate a strongly-typed ObjectContext class and entity classes that derive from EntityObject from an Entity Framework model created using the EF Designer.
Once installed, you can right-click on the EF Designer surface and select "Add Code Generation Item..." from the menu.
Requires .NET Framework 4.5
This template requires .NET Framework 4.5 to be installed on the developers machine. If you are using Visual Studio 2012 or 2013 then .NET 4.5 if already installed. If you are using Visual Studio 2010 then you candownload .NET 4.5 from the Microsoft Download Center.
Note: .NET Framework 4.5 is only required on the developers machine to run this template. It is not required on machines that the compiled application is deployed to.
If you try to use the template without .NET 4.5 installed you will receive the following errors.
- Compiling transformation: 'Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.CodeGenerationTools' does not contain a definition for 'GetResourceString'
- Compiling transformation: 'System.Data.Metadata.Edm.EdmFunction' does not contain a definition for 'ReturnParameters' and no extension method 'ReturnParameters' accepting a first argument of type 'System.Data.Metadata.Edm.EdmFunction' could be found
- Compiling transformation: 'System.Data.Metadata.Edm.EdmFunction' does not contain a definition for 'IsComposableAttribute' and no extension method 'IsComposableAttribute' accepting a first argument of type 'System.Data.Metadata.Edm.EdmFunction' could be found (are you missing a using directive or an assembly reference?)
- Compiling transformation: 'System.Data.Metadata.Edm.EnumType' is inaccessible due to its protection level
- Compiling transformation: 'Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.GetSourceSchemaTypes<System.Data.Metadata.Edm.EnumType>()' is inaccessible due to its protection level
- Compiling transformation: 'System.Data.Metadata.Edm.EnumType' does not contain a definition for 'UnderlyingType' and no extension method 'UnderlyingType' accepting a first argument of type 'System.Data.Metadata.Edm.EnumType' could be found
- Compiling transformation: The name 'TemplateMetadata' does not exist in the current context
- Compiling transformation: 'Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.MetadataConstants' does not contain a definition for 'TT_TEMPLATE_NAME'
- Compiling transformation: 'Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.MetadataConstants' does not contain a definition for 'TT_TEMPLATE_VERSION'
- Compiling transformation: 'Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.MetadataConstants' does not contain a definition for 'TT_MINIMUM_ENTITY_FRAMEWORK_VERSION'
Consider using the DbContext Generator
The DbContext Generator is now the recommended template for new applications. The DbContext Generator takes advantage of the simpler DbContext API. The EntityObject Generator continues to be available to support existing applications.
Need help?
Find out more about using EF code generation templates.
Find out how to get help with Entity Framework.
Version History
- 1.0.0.0 - Initial version of templates