Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Here,
In my sqlserver database has a table name 'dbo.UserRole' and i want to populate as DBset in my DbContext.
but when i add a DbContext as like

C#
public class DbContext:DbContext
    {
        public DbSet <User> Users{ get; set; }
        public DbSet <UserRole> UserRoles { get; set; }
    }


'User' and 'UserRole' is model class.

then a table name is "UserRoles1", add as new datatable in database.
but i want to use Existing "UserRoles" table.
Posted
Comments
Krunal Rohit 18-Oct-15 11:35am    
Did you search for How to perform Migration with EF Code First ?

-KR
mukesh mourya 19-Oct-15 0:51am    
Yes, but no any solution are according this condition.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900