sql server - Entity Framework gives me the old data although i changed them -
i have strange problem entity framework:
i have sql server database on windows server , access via app through entity framework.
now changed entry in database, app uses entity framework still gives me old value although not saved in place.
what , how fix this?
edit:
i'm getting data database this:
(from p in _myef.master_items p.id == userid select p.location).firstordefault(); edit2:
when start locally via visual studio see new value. if use deployed version, see old value not in db anymore
edit3: here connection string <add name="myentities" connectionstring="metadata=res://*/mydata.csdl|res://*/mydata.ssdl|res://*/mydata.msl;provider=system.data.sqlclient;provider connection string="data source=foo;initial catalog=mydb;persist security info=true;user id=admin;password=xxxx;multipleactiveresultsets=true;app=entityframework"" providername="system.data.entityclient" />
entity framework caches objects internally in dbcontext instance. meant short-lived, purpose of caching every time entity same id same actual instance of said entity back.
this means when using entity framework, shouldn't store dbcontext in static field. create new 1 every request.
Comments
Post a Comment