TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Yadlapalli Srikanth
NA
272
82.7k
mvc multiple tables in single context entity framework
Jun 27 2014 11:31 PM
Dear All,
I am learning Mvc, In db context i added one more dbset,it is working fine when it is with one dbset but when i added one more Dbset getting the below error.Kindly suggest me how to work with multiple tables with in one Dbcontext
public class EmployeeContext:DbContext
{
public DbSet<Employee> Employees { get; set; }
public DbSet<Department> Departments { get; set; }
}
error
An exception of type 'System.Data.Entity.ModelConfiguration.ModelValidationException' occurred in EntityFramework.dll but was not handled in user code
Additional information: One or more validation errors were detected during model generation:
MVCP.Models.Department: : EntityType 'Department' has no key defined. Define the key for this EntityType.
Departments: EntityType: EntitySet 'Departments' is based on type 'Department' that has no keys defined.
Reply
Answers (
3
)
Opeing non mdi form
Form not allowed to move or choose another form in C# ?