What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You use the ADO.NET Entity Data Model (EDM) to define a Customer entity.
You need to add a new Customer to the data store without setting all the customer’s properties. What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You use the ADO.NET Entity Data Model (EDM) to define a Customer entity.
You need to add a new Customer to the data store without setting all the customer’s properties. What should you do?

A.
Call the Create method of the Customer object.

B.
Call the CreateObject method of the Customer object.

C.
Override the Create method for the Customer object.

D.
Override the SaveChanges method for the Customer object.

Explanation:
CreateObject<T> Creates and returns an instance of the requested type .



Leave a Reply 2

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


Pavel Birioukov

Pavel Birioukov

There isn’t “CreateObject” in Customer class…
CreateObject is in ObjectContext, there is only CreateCustomer() method in Customer

John Galt

John Galt

Agreed.
A should read:
Customer customer = Customer.CreateCustomer(“id”, “name”, “address”);

B should read:
Customer customer = context.CreateObject();

Another shitty question from Microsoft. Still, the answer is B, because A requires you to set all customer’s properties, which the question tells you not to do.