In the Entity Framework 4 mapping existing Entity class (POCO)

By Brandon West,2015-02-17 00:08
50 views 0
In the Entity Framework 4 mapping existing Entity class (POCO)

    In the Entity Framework 4 mapping existing Entity

    class (POCO)

    ADO.NET Entity Framework, is the full name of the Entity Framework is developed by Microsoft ADO.NET based ORM (Object/Relational Mapping) Framework.

    The main characteristics of the Entity Framework:

    1. Support for multiple database (Microsoft SQL Server, Oracle, and DB2);

    2. Strong mapping engine, can well support stored procedures;

    3. Provide Visual Studio integration tool for visualization operation;

    4. Ability to interact with ASP.NET, WPF, WCF, WCF Data Services for good integration.

    More introduction, please see:ADO.NET Entity Framework At-a-Glance

    In the blog the new short message function development, we are prepared to use the Entity Framework 4, the first thing we face such a problem:

    Entity class with the database have existed, and the class name of the entity class with the name of the table in the database, the attributes of a class is different from the corresponding field name in the table.That is to say we can't use the usual method in VS2010 through ADO.NET Entity Data Model (. Edmx file) generated Entity class and ObjectContext.

    Note: this entity class has a name called POCO (Plain Old CLR Objects).

    Our solution is: in. Edmx file manually configure mapping relation.

    Below is the steps:

    1. Use ADO.NET Entity Data Model, create a on the VS2010. Edmx file, the following figure: