Code Generation Templates

Entity Developer allows using T4 templates to generate classes and context. It comes with a number of highly customizable C# and Visual Basic templates for different use cases. C# templates are available for all ORMs, and Visual Basic templates are available for all ORMs except Telerik Data Access.

To simplify selecting templates for your specific needs we have divided our templates by software architecture layers. They are data access layer, domain layer, and presentation layer.

Presentation Level Templates

MVC Controller

This template is designed for generating an MVC controller with data access code. It allows you to configure the output location and namespace of the controller classes.

MVC View Advanced

This template is designed for generating MVC Views based on Twitter Bootstrap. MVC View Advanced template provides more advanced features than the standard MVC Scaffolding template. It supports such advanced features as sorting, filtering, and paging.

Domain Layer Templates

Data Transfer Objects

This template can generate both DTO classes and converter classes with extension methods for converting entities to DTO and vice versa. These converter classes are partial classes with partial methods that you can use to customize the conversion process. If generated converter classes are not suitable for you, you can disable their generation and use some third-party library, for example, AutoMapper, to convert objects.

Data Transfer Objects template contains a wide range of settings for configuring DTO and converter classes generation, their output namespace and location, naming, etc.

Data Annotations Metadata

This template is designed for generating Data Annotations metadata classes and decorating entity classes and properties with data annotation attributes that specify validation rules, specify how the data is displayed, and define metadata for Windows Communication Foundation (WCF), Dynamic Data and WCF RIA Services. For each model entity the template generates a partial class with an attribute, specifying a metadata class, and the metadata class itself.

WCF RIA Domain Service

This template is designed for generating a WCF RIA Services domain service class for an Entity Framework model. This template is not available for NHibernate, Telerik Data Access, and Entity Framework Core.

Data Access Layer Templates

Entity Framework Templates

DbContext

This template is designed for generating a strongly-typed DbContext class and persistence ignorant entity classes.

DbContext template can generate the following kinds of mapping: attribute mapping (for simple cases), fluent mapping in the OnModelCreating method, and fluent mapping in configuration classes. You may also disable mapping generation completely if default settings from user-defined conventions are enough for you.

DbContext template has a WCF Data Contract Attributes property for managing generation of DataContract, KnownType, and DataMember attributes for classes and properties. This template also can generate classes that implement INotifyPropertyChanged, and INotifyPropertyChanging interfaces.

POCO Entity

This template is designed for generating a strongly-typed ObjectContext class and classes with persistence ignorance.

POCO Entity template has a WCF Data Contract Attributes property for managing generation of DataContract, KnownType, and DataMember attributes for classes and properties. This template also can generate classes that implement INotifyPropertyChanged, and INotifyPropertyChanging interfaces.

Repository and Unit of Work

This template is designed for generating code implementing Repositories and Unit of Work patterns for Entity Framework model. It allows you to completely separate working with entity classes from the actual data access code.

Entity Object

This template is designed for generating a strongly-typed ObjectContext class and persistence-aware classes.

Self-Tracking Entity

This template is designed for generating a strongly-typed ObjectContext class and self-tracking entity classes.


Entity Framework Core Templates

EF Core

This template is designed for generating classes for Entity Framework Core models

EF Core template has a Generate Data Contracts property for managing generation of DataContract attributes for classes and properties. This template also can generate classes that implement INotifyPropertyChanged, INotifyPropertyChanging, Clonable, and Equals interfaces, etc.

Repository and Unit of Work

This template is designed for generating code implementing Repositories and Unit of Work patterns for Entity Framework Core model. It allows you to completely separate working with entity classes from the actual data access code.


NHibernate Templates

Castle ActiveRecord

This template is designed for implementing the Active Record design pattern. It generates Castle ActiveRecord implementation code.

Fluent NHibernate

This template is designed for generating fluent mapping code for NHibernate models. It is used together with the NHibernate template.

Loquacious Mapping

This template is designed for generating Loquacious mapping (Mapping by code) for NHibernate models.

NHibernate

This template is designed for generating NHibernate entities and .hbm.xml mapping files for them. However if you use this template together with Fluent NHibernate template, you may disable XML mapping generation.

Repository and Unit of Work

This template is designed for generating code implementing Repositories and Unit of Work patterns for NHibernate model. It allows you to completely separate working with entity classes from the actual data access code.


LinqConnect Templates

Fluent Mapping

This template is designed for generating a strongly-typed DataContext class, fluent mapping and classes with persistence ignorance. It is available in C# only.

LinqConnect

This template is designed for generating a strongly-typed DataContext class and persistence-aware classes.

POCO Entity

This template is designed for generating a strongly-typed DataContext class and classes with persistence ignorance.

Repository and Unit of Work

This template is designed for generating code implementing Repositories and Unit of Work patterns for LinqConnect model. It allows you to completely separate working with entity classes from the actual data access code.


LINQ to SQL Templates

LINQ to SQL

This template is designed for generating a strongly-typed DataContext class and persistence-aware classes.

LINQ to SQL for Windows Phone

This template is designed for generating a strongly-typed DataContext class and persistence-aware classes for Windows Phone applications.

POCO Entity

This template is designed for generating a strongly-typed DataContext class and classes with persistence ignorance.

Repository and Unit of Work

This template is designed for generating code implementing Repositories and Unit of Work patterns for LinqConnect model. It allows you to completely separate working with entity classes from the actual data access code.


Telerik Data Access Templates

Data Access

This template is designed for generating classes with code only mapping for Telerik Data Access models

Data Access template has a Generate Data Contracts property for managing generation of DataContract attributes for classes and properties. This template also can generate classes that implement INotifyPropertyChanged, INotifyPropertyChanging, Clonable, and Equals interfaces, etc.

Repository and Unit of Work

This template is designed for generating code implementing Repositories and Unit of Work patterns for Telerik Data Access model. It allows you to completely separate working with entity classes from the actual data access code.