Hello,
1. What happens when I declare DataContext dc = new dataContext ?
I want to know this, because it seems to take a few seconds to pass this statement.
2. Do I declare a new DataContext everytime I open an new form, or do I use the same one and pass this as a parameter?
3. Is it possible to have more datacontext's in 1 project; each with its own set of tables? Or is it wiser to have 1 dataontext with all tables ?
Thanks
DataContext question
1. The Metadata initialization occurs, and the parameters of stored procedures are queried, if
any procedures are present in the context.
2. This is a matter of controversy. Microsoft states that DataContext class is designed to implement
the "unit of work" pattern here in MSDN:
http://msdn.microsoft.com/en-us/library ... ntext.aspx , but there is also an alternative opinion:
http://dotnetlog.com/archive/2008/03/18 ... -linq.aspx
We don't have a unified solutuion, it depends on the purposes of your application.
3. You can use several datacontexts if you wish. This question also does not have any definite answer.
any procedures are present in the context.
2. This is a matter of controversy. Microsoft states that DataContext class is designed to implement
the "unit of work" pattern here in MSDN:
http://msdn.microsoft.com/en-us/library ... ntext.aspx , but there is also an alternative opinion:
http://dotnetlog.com/archive/2008/03/18 ... -linq.aspx
We don't have a unified solutuion, it depends on the purposes of your application.
3. You can use several datacontexts if you wish. This question also does not have any definite answer.