Hi All
I was wondering the best approach to handle the context in a windows 8 app?
I am uses a reportistory pattern for data access.
Do I
1/ Create a public static variable to the context and all data access uses that single one?
or
2/ Instantiate a connection each time and close when completed?
Ade
LinqConnect Metro
Re: LinqConnect Metro
We don't recommend to use static instance of the DataContext, due to the fact that this one instance will accumulate obsolete data (after the data has been received, it is cached and when working for a time with one DataContext, the data in the database may change while the data in the cache will be old).
DataContext is a lightweight object, and it is recommended to use new DataContext for each unit of work instead of keeping it for a long time.
DataContext is a lightweight object, and it is recommended to use new DataContext for each unit of work instead of keeping it for a long time.