Linq to SQL Classes code not generating RRS feed

  • Question

  • User494020413 posted

    Hi All -

    I'm building a new MVC application and would like to use a Linq to SQL Classes O/R surface to generate my entity classes and data context.  I'm using VS2010.  I have a SQL Server database that I've connected to in the Server Explorer.  I create a new Linq To SQL Classes surface by right clicking on my Models folder and adding it as a new item.  I then drag my tables onto it from the Server Explorer.  They all show properly and appear to be properly related.

    I build and save but no code is generated.  I'm not sure what exactly to expect but I would think I'd get a cs file in my Models folder for each table on the O/R surface.  If I try to access the datacontext class that is supposed to be generated it is not found.  There is one cs file generated but it is completely empty.  On the O/R design surface if I right click a table and select "View Code" it will open that cs file and add a partial class for the table.  The class, however will be empty.

    What am I doing wrong and what should I expect to see?

    Many thanks,


    Thursday, July 21, 2011 2:03 PM


  • User494020413 posted

    I've played around a bit more and discovered that all the code is generated in the dbml (actually in the designer.cs file).  The reason I couldn't see it from my controller was I had to add the appropriate namespace in the usings.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 21, 2011 9:57 PM