this is my app.config
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
<connectionStrings>
<add name="DataBaseEntity" connectionString="metadata=res://*/DBModel.csdl|res://*/DBModel.ssdl|res://*/DBModel.msl;provider=System.Data.SQLite;provider connection string="data source=I:Sompepath\dbfilename"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
and below is the usage
using (var context = new DataBaseEntity("name=DataBaseEntity"))
{
context.Connection.Open();
var status = delegatefunction(context);
if (status)
{
context.AcceptAllChanges();
context.SaveChanges(SaveOptions.DetectChangesBeforeSave);
context.Connection.Close();
return true;
}
return false;
}
the delegate function looks like this
(context =>{var abc = new xyz();
context.xyzs.AddObject(abc);});
the database is not having the data which is just added in the delegate
and there is no exception in the application
the connection object in the context looks like this

Remove
context.AcceptAllChanges();That call is telling EF that there are no pending changes so theSaveChangeshas nothing to save to database because it believes that all changes were already saved.AcceptAllChangesin normally called inside theSaveChangesonce all modifications are correctly saved to the database. This method is public to support some complex scenarios where you want to save modifications on multiple context within single transaction.