I am having problems with this code. I can connect to the mdf example database file and create an entity model. Although I can query the context model and get information from the database when I try to update, delete or insert something into the context and translate the changes into the DB Context. Does not work. There is no exception, the Entity model is updated properly, but the DB has no changes. Thanks that
public void addCourse(int courseId, int deptId, string courseTitle) { SchoolContexto = new SchoolEntities(); Course mycourse= new Course(); mycourse.CourseID = courseId; mycourse.Credits = 10; mycourse.DepartmentID = deptId; mycourse.Title = courseTitle; SchoolContexto.Courses.Add(mycourse); SchoolContexto.SaveChanges(); SchoolContexto.Dispose(); }
c # entity-framework-5 visual-studio-2012
user3471933
source share