Search code examples
c#databaseentity-frameworkvisual-studiomdf

Why changes by context.SaveChanges in EF not affect my mdf file?


I have this model:

enter image description here

I use this code to add object to my database:

using (var c = new MyContext())
     {
          var con = new SunCondition()
          {
                TimeOffset = new TimeSpan(12, 2, 3),
                Name = "me",
                IsAfter = true,
                IsRise = true
          };
          c.ConditionSet.AddObject(con);
          c.SaveChanges();
     }

but it not adds any thing to database.


Solution

  • This code have no problem.

    I should say that always changes which program do on mdf file was on file that automatically copied to bin/debug or bin/release folder; so when I check my mdf file that is reachable in Visual Studio, it does not have any changes affected by application.