Entity Data Model classes

Entity Framework provides some classes to describe the Entity Data Model.

This can be very helpful in many cases and particularly for code generation.

image 

image

image

Then, Entity Framework provides a ttinclude file that allows us to use this model instead of parsing xml file (if you use an edmx).

In addition of this, WAQS provides its own ttinclude file that encapsulates EF one in order to make usage easier. // Note that, of course, you can use it without using WAQS.

 

So for example, if you want to write all public entity types name into a generated file, you can use this T4 code:

<#@ template hostspecific="true" language="C#" #>
<#@ include file="WCFAsyncQueryableServices.VS12.Edmx.Utility.V21.ttinclude"#>
<# 
var edmxElements = EdmxElements.Get(Host, edmxPath);
foreach (var entityType in edmxElements.EntityTypes)
{
    if (Accessibility.ForType(entityType) == "public")
    {
#>
<#= entityType.Name #>
<#
    }
}
#>

 

See also: How does WAQS code generation work?

This entry was posted in 10511, 16868, 17895, 7674, 7675. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>