Entity Developer incorporates a large number of innovative features which makes it a perfect code generation tool even for the most demanding developers. Using Entity Developer, you can fine-tune the code generation process according to particular needs by flexibly using different types of new templates that are shipped with the application.
Entity Developer code generation lets you use templates to generate source code for ORM models. Entity Developer has a very flexible code generation system, based on templates, written in T4-like Template Language. It is much more convenient to use our templates in the model than usual T4 templates, because Entity Developer manages the process of code re-generation (when text templates are used, code is re-generated only when the template is saved or a specific button is clicked). In other words, if a changed model is saved, its code is automatically regenerated. Note, that Entity Developer supports integration with Visual Studio refactoring that enables renaming of model objects. For example, when renaming an entity, refactoring will ensure that any references to that class are renamed across your solution. Refactoring is performed when you save your project and is applicable to namespaces, classes and complex types as well as their properties, enums and their members; for LinqConnect and Entity Framework models it also applies to the context class and its properties. Entity Developer models can have a freely defined set of templates. This allows generating non-connected code against different templates. The advantage of using Entity Developer is that Entity Developer manages all actions related to code generation. That is, all the templates are re-generated when the model is changed. The Model Explorer window provides a convenient means for managing templates. When developing a model that at certain moments can become invalid, you may disable template generation by using the Enabled property of a model template.
|
Templates can be stored both within the model and in Entity Developer resources. The advantages of the first approach are the following:
The advantage of the second approach is the following:
To add a template stored on the disk to the model, right-click the Templates node in the Model Explorer window and select the New Template From File context menu item.
|
Code generation can be configured with the template properties, which are declared with the property directive in the templates. Properties declared in this way are then displayed in the properties window and can be easily edited. In addition to standard properties of the property directive, Entity Developer supports the definition of a group and description.
|
The standard T4 generator implements the IVsSingleFileGenerator interface and by default generates one file per template. Entity Developer extends this behavior using the Output class. Example: the entity-generating template generates one single cs file that is included into the .tt file project item, which is not very convenient in large projects. All templates have the FilePerClass option as well as the EntitiesOutput and ContextOutput. EntitiesOutput and ContextOutput provide a capability that slightly differs in Visual Studio and in the stand-alone version, as described below. If you are using Entity Developer as a Microsoft Visual Studio add-in, you can define the project and project folder to store generated code for contexts and entities of your model. In the Entity Developer stand-alone application, it is possible to define folders, in which generated code for entities and contexts is to be stored. This set of options makes the development of multilayer applications easier and more convenient.
|