Stop linq from caching tables

when a new object is created in my database, and then I query the table from the datacontext, the new object does not appear. Does linq cache the table and return the cached version? if so, how can I stop linq from doing this.

DALConnector.Dc.Order.InsertOnSubmit(NewOrder);
DALConnector.Dc.SubmitChanges();

now I press a button that shows a form with a gridview on it databound on a DALConnector.Dc.Order that does not show the new order

+3
source share
2 answers

? , , . , ... , (, ), ensurihg, Orders , .

, :

grid.DataSource = customer.Orders;

, :

customer.Orders.Add(newOrder);
dc.Orders.InsertOnSubmit(newOrder);
dc.SubmitChanges();

. .

+2

Linq2Sql DataContext , - . DataContext , , , , .

Linq2Sql, SQL Server, SQL Server , .

dbml, runtime insert Order?

, - , DataContext SubmitChanges().

, , .

0

Source: https://habr.com/ru/post/1728723/


All Articles