Thursday 15 July 2010

visual studio 2008 - Mapping POCO to Entity in Entity Framework -


I use EF for Visual Studio 2008, so I do not have POCO integration with EF.

Since we have an N-level application, we are continuously mapping POCO to institutions, institutions are not thrown on the upper layers, I also automate and mapping manually .

Our biggest problem is that when POCOs are mapping to institutions.

If I am adding a new entity which is concerned with existing institutions (like adding a new account to the existing client), then I have an existing institution, POCO, and databases related to the institutions It is necessary to get (such as client) , it is very slow.

And my question is: <

How can I create an entity, properly connected with reference And everything, from a POCO object, without making any calls to the database?

Set EntityKey instead of loading the relevant code Object (note that EF4 has a better way of doing this; it is for EF1):

  var account = new unit account {name = pokoyaccount. Name, // etc}; // Now instead of accounting. Client = References have chosen. Where (... Account Client Reference. Antitiki = New Entity ("MyEntities.Clients", "Id", pocoAccount.Client.Id);  

This is not DB access at all .


No comments:

Post a Comment