There are two tables with the same primary key. here we need to map these two tables into an object.
Select the two tables into EDM:
Next we will map the two tables into an object:
1. Copy the productimage in the Entity productimage to the entity product.
2. Delete the productimage object. A prompt is displayed, indicating whether to delete the table from the storage model.
3. Click the object product to view the Mapping Details window.
4. In the detaing Details window, click "add a table or view" to select the table productimage.
In this way, the modified model is like the following. The two tables are combined into an object model:
Adding a new column in our existing system table seems normal, but sometimes it is unwilling to add a new column to change the existingCodeIn this way, we can add the new columns to be added to a separate table.
This process of combining two tables into one entity is called vertical splitting)
The disadvantage of Vertical Split is that each table has an innerjoin operation. We can see through the following code:
Code
Using (Efdemoentities Context = New Efdemoentities ())
{
Objectquery < Product > Productquery = Context. product;
Console. writeline (productquery. totracestring ());
}
Output result