DataContext question

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Posts: 39
Joined: Thu 13 Aug 2009 21:22

DataContext question

Post by afva » Wed 19 Aug 2009 12:02


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 ?


Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 19 Aug 2009 13:53

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: ... ntext.aspx , but there is also an alternative opinion: ... -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.

Post Reply