In Entity Splitting means splitting this entity into multiple database tables but in Table Splitting we split one table into two tables.
Entity Splitting refers to mapping an entity to two or more tables when the tables have a common key (common column).
Why to use Table Splitting in EF? One reason would be to delay some property, in other words Lazy Loading of your objects.
We will explain how we use Table Splitting in EF with an example.
Step 1: First create a table named Student.
For this execute the following script in SQL Server.
After executing that script you will see a table in your database with the name Student.- Create table Students
- (
- StudentID int primary key identity,
- FirstName nvarchar(50),
- LastName nvarchar(50),
- Gender nvarchar(50),
- Email nvarchar(50),
- Mobile nvarchar(50)
- )
- Insert into Students values ('Munesh', 'Sharma', 'Male','[email protected]','5555555555')
- Insert into Students values ('Rahul', 'Sharma', 'Male','[email protected]','333333333')
- Insert into Students values ('Sara', 'vilium', 'Female','[email protected]','111111111')
- Insert into Students values ('Mark', 'hash', 'Female','[email protected]','2222222222')
- Insert into Students values ('ABC', 'EFG', 'Male','[email protected]','6666666666')
Now go to your application and right-click on the Solution Explorer and add an “ADO.Net Entity Data Model” and select the Database First Approach.
Then click on "Next" and select the database connection and select the database name and then click on "Next" and select your tables that you created now and click Finish.
When you click on Finish you will see a “Student” entity.
Now in this entity we have Mobile and email properties. We are not using these properties everywhere, like Firstname , Lastname and Gender properties. If we load the Student entity then all these entities will be loaded automatically, so we will now create 2 entities (Student and StudentContactDetails).
The following is the procedure to do that.
1. Right-click on the Entity Designer and click on “Add entity”. Set some values as in here:
a: Entity Name = StudentContactDetail
b: Base type = None
c: Entity Set = StudentContactDetail
d: Key Property check Box = checked
e: Property name : StudentId
f: Property type : Int32
2. Now cut Mobile and Email from the Student entity and paste it into StudentContactDetail.
Then the entity will look like:
3. Again right-click on the Entity Designer and add an “Association” and fill in the following details.










Debasis SahaPosted May 20, 2016, 10:52 AM
Nice One..
Thiruppathi RPosted May 18, 2016, 7:01 AM
Good Info...
Munesh SharmaPosted May 17, 2016, 3:23 PM
thank you all
Bhuvanesh MohankumarPosted May 17, 2016, 2:20 PM
Good one
Pankaj Kumar ChoudharyPosted May 17, 2016, 12:21 PM
Nice Information Sir........
Kuppurasu NagarajPosted May 17, 2016, 10:53 AM
Nice sharing..