What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application.
You use the Entity Framework Designer to create the following Entity Data Model.

The application contains a class as shown in the following code segment. (Line numbers are included for reference only.)

01 public class MyBaseClass : EntityObject
02 {
03 .
04 }

You need to ensure that all generated entities inherit from MyBaseClass. What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application.
You use the Entity Framework Designer to create the following Entity Data Model.

The application contains a class as shown in the following code segment. (Line numbers are included for reference only.)

01 public class MyBaseClass : EntityObject
02 {
03 .
04 }

You need to ensure that all generated entities inherit from MyBaseClass. What should you do?

A.
Change MyBaseClass to inherit from ObjectContext.

B.
Create a new ObjectQuery that uses MyBaseClass as the type parameter.

C.
Modify the generated code file so that all entities inherit from MyBaseClass.

D.
Use the ADO.NET EntityObject Generator template to configure all entities to inherit from MyBaseClass.

Explanation:
You can use the Text Template Transformation Toolkit (T4) to generate your entity classes, and Visual Studio .NET provides the T4 EntityObject Generator template by which you can control the entity object generation. Visual Studio .NET also provides the T4 SelfTracking Entity Generator template by which you can create and control the Add an EntityObject Generator to your project and add the new modification to
the text template.self-tracking entity classes. Add an EntityObject Generator to your project and add the new modification to the text template.

CHAPTER 6 ADO.NET Entity Framework
Lesson 1: What Is the ADO.NET Entity Framework?
The EntityObject Generator (page 403-404)

http://blogs.msdn.com/b/efdesign/archive/2009/01/22/customizing-entity-classes-with-t4.aspx



Leave a Reply 0

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