.net - EF context changes not saving -


very basic scenario. have context attached db 1 table has 1 row in it. can bind ui data , see data fine, changes, additions, etc not save. below 5 line bit not result in changes db. curious , confused.

        var context = new testentities();         context .dataitems.load();  // testing - 1 row in table.         context .dataitems.first().data = "blah blah blah";         context .dataitems.add(new dataitem() { data = "happy birthday" });         context .savechanges(); 

the data in database not change. no new row. no updated row.

connection: <add name="testentities" connectionstring="metadata=res:///datamodel.csdl|res:///datamodel.ssdl|res://*/datamodel.msl;provider=system.data.sqlserverce.4.0;provider connection string="data source=|datadirectory|\testdb.sdf"" providername="system.data.entityclient" />

i'm sure stupid, don't see it.

try doing below:-

context .dataitems.addobject(new dataitem() { data = "happy birthday" }); 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -