I'm new to entity framework, and I wasn't able to find an answer to my question online, so that is why I decided to post my question here.
I added 3 tables to my model, and I thought what it does is only Mapp the tables with the corresponding entity and everytime I use linq to sql it would just go to the database and retrieve the data I need, but I think I'm wrong because I Updated one table(using SQL Server) and then I ran the application and I realized it still had the old data.
So my guess is that edmx tables are stored in memory and they do not update unless I told them to do so?, am I right or am I doing something wrong?
Some code:
public List<Setting> SetGeneralSettings()
{
List<Setting> GeneralSettings = null;
using (var Entity = new Entities())
{
//Entity.GeneralSettings_Skills.
GeneralSettings = (from settings in Entity.Table1
select new Setting
{
Property1 = settings.Property1,
Property11 = settings.Property11,
Property12 = settings.Property12,
Property14 = settings.Property14,
Property15 = settings.Property15,
Property16 = settings.Property16,
Property17 = settings.Property17,
Property18 = settings.Property18,
Property19 = (from o in Entity.Table2
where o.IdTable2 == settings.IdTable1
select o.valTable2).ToList(),
SkillsList2 = (from s in Entity.Table3
where s.IdTable3 == settings.IdTable1
select s.valTable3).ToList()
}).Where(p => p.Project == "Test project").ToList();
}
return GeneralSettings;
}