Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you want to use Entity Framework you should use ObjectContext, not DataContext as this is a base class from Linq-To-Sql.</p> <p>When you create ADO.NET Entity Data Model , Visual Studio generates (after you complete a generate model from database wizard or use the designer), a class that is derived from ObjectContext that has a default connection string (that you choose at the wizard). <a href="http://blogs.msdn.com/b/adonet/archive/2010/07/19/absolue-beginners-guide-to-entity-framework.aspx" rel="nofollow">Here</a> you can see a nice tutorial from ADO.NET team how to start using the EF. </p> <p>You are not supposed to use ObjectContext directly, at least not without manually creating the metadata files and pointing to them in your connection string (Never seen DataContext class being used directly, so if I'm wrong someone correct me) , as the wizard I mentioned above creates all sorts of mapping data - to map SQL tables/views/other stuff to Entity classes.</p> <p>if you want to supply your own connection to the class you can do it programmatically with <a href="http://msdn.microsoft.com/en-us/library/system.data.entityclient.entityconnectionstringbuilder.aspx" rel="nofollow">EntityConnectionStringBuilder</a>.</p> <p><a href="http://msdn.microsoft.com/en-us/library/bb738533.aspx" rel="nofollow">This</a> is an example how to use EntityConnectionStringBuilder it from MSDN</p> <p>Edit : I mistakenly wrote about DataContext as if it was EF base class for designer generated code. It is as <em>casperOne</em> stated a base class for Linq-To-Sql classes.</p> <p><em>Changed my answer to reflect his comment</em></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload