We have data stored in SQLite database. Data are show in DevExpress.XtraGrid.GridControl. To get relevant data we create temporary table and we fill it. Data Context:
public class AccountsSQLiteDataContext : DbContext
{
public AccountsSQLiteDataContext(IDbConnection connection)
: base((SQLiteConnection)connection, false)
{
Database.SetInitializer<AccountsSQLiteDataContext>(null);
}
public DbSet<tmp_acc> TmpAccounts { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
}
}
Work With DbContext:
AccountsSQLiteDataContext myContext = new AccountsSQLiteDataContext(myDbConnection);
public IQueryable AccountTable
{
get
{
return myContext.TmpAccounts;
}
}
DevExpress.Data.Linq.LinqServerModeSource myLinqSource = = new DevExpress.Data.Linq.LinqServerModeSource();
myLinqSource.QueryableSource = AccountTable;
myGridControl.DataSource = myLinqSource;
And after data change I call: myLinqSource.Reload();
And not all changes in data in SQLite temporary table are show in grid. Adding and removing of table rows takes effect. But changes in cell texts are not show. Grid still shows old values. Filter functions tekes effect with new values.
How refresh local data stored in DbContext to show correct values after change in temporary table?
Aucun commentaire:
Enregistrer un commentaire