none
Object Relational Designer generated DataContext class not accessible from database table class also created by the Object Relational Designer RRS feed

  • Question

  • I have created a simple test website called TestSite.  Using the Object Relational Designer, I have created a class called Agent which is mapped to a table in a SQL database.  The Object Relational Designer created a class called TestSiteDataContext as well as the Agent class.  Using object browser I can see both classes within the TestSite namespace.  If I reference the TestSiteDataContext in a code behind file for my Default.aspx web page, I am able to create a datacontext object.  However, if I try to reference TestSiteDataContext from within my Agent class, it is undefined.  What do I need to do to be able to reference the TestSiteDataContext from the Agent class.  I tried Importing the TestSite namespace, but this had no effect.
    Saturday, September 19, 2009 11:41 PM

Answers

  • Problem solved. The compile attribut for some class file were marked "Content" instead of "Compile" so they were not getting compiled properly. After changing the attribute, the DataContext class was accessible as expected.
    • Marked as answer by Yichun_Feng Friday, September 25, 2009 2:12 AM
    Sunday, September 20, 2009 2:39 PM

All replies

  • Problem solved. The compile attribut for some class file were marked "Content" instead of "Compile" so they were not getting compiled properly. After changing the attribute, the DataContext class was accessible as expected.
    • Marked as answer by Yichun_Feng Friday, September 25, 2009 2:12 AM
    Sunday, September 20, 2009 2:39 PM
  • Just out of curiosity why are you referencing the data context from an entity?  This is normally not a good idea.

    [)amien
    Sunday, September 20, 2009 4:32 PM
    Moderator