Databases Reference
In-Depth Information
FIGURE 8.1
Add New Code Generation Item dialog.
When you click Add in the Add New Code Generation Item dialog, Visual Studio adds a new
text template (.TT file) to the project and associate it with the EDMX file. Figure 8.2 shows
how this looks in Solution Explorer. Notice that the context and entity classes are now gener-
ated in the Northwind.cs under the TT file instead of the default Northwind.Designer.cs
under the EDMX.
FIGURE 8.2
Text template in Solution Explorer.
Customizing Text Template to Change Context Base Class
Text templates use ASP.NET-like syntax to generate any code at design time in Visual
Studio. This particular text template generates Entity Framework context and entity
classes identical to the ones produced by the default code generator. However, unlike the
latter, text templates come with complete source code that be customized to fit the
unique needs of your project.
 
Search WWH ::




Custom Search