none
Linq to SQL classes, table classes not created RRS feed

  • Question

  • Hello everyone.

    I'm trying to import a database and tables to my project via linq to sql class. I can successfully create a sql connection and drag the table into the database designer but no table class definitions are created automatically. Thus, I'm unable to access the table properties via linq.

    I have done this in the past but I don't remember how. I'm running Win7 x64 and VS2008 Pro SP1.

    Any ideas, anyone?

    Thanks!

    Wednesday, June 9, 2010 12:15 AM

All replies

  • Do the tables appear in the designer, but the underlying classes are not generated?

    Do you get any errors from the MSLinqToSQLGenerator?

    Does it create a .cs/.vb file at all?

    One thing to check is if the Generator tag is set in the project file - open the .csproj or .vbproj file in notepad and ensure that the DBML file has the Generator tag:

        <None Include="AdventureWorks.dbml">
          <Generator>MSLinqToSQLGenerator</Generator>
          <LastGenOutput>AdventureWorks.designer.cs</LastGenOutput>
          <SubType>Designer</SubType>
        </None>

     


    Kristofer - Huagati Systems Co., Ltd.
    Cool tools for Linq-to-SQL and Entity Framework:
    huagati.com/dbmltools (add-in with new features for the L2S and EF designers in VS2008 and VS2010)
    huagati.com/L2SProfiler (Query profiler for Linq-to-SQL and LLBLGen Pro)
    Wednesday, June 9, 2010 12:44 AM
    Answerer
  • Yes, tables appear in the designer. I can also drag them onto the design area and the Generator tag is present for my database.
    I don't get any errors at build time either.

    I'm totally lost... I have no clue as to how I've done it in the past but I remember it was stupid simple :(

    Wednesday, June 9, 2010 1:24 AM
  • Hello,

     

    Welcome to LINQ to SQL forum!

     

    As Kristofer said, we need to set the generator tool as “MSLinqToSQLGenerator”.   Please double check whether the property “Custom Tool” is set to “MSLinqToSQLGenerator” of the .dbml file.  

     

    Have a nice day!

     

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, June 9, 2010 3:37 AM
    Moderator
  • Thanks a bunch but I have already checked this. "MSLinqToSQLGenerator" property was already set. Now after re-installing Visual Studio I can't make the connection to the mysql server anymore. I don't see my server in the list.
    This is getting on my nerves :(

    Wednesday, June 9, 2010 4:53 AM
  • Thanks a bunch but I have already checked this. "MSLinqToSQLGenerator" property was already set. Now after re-installing Visual Studio I can't make the connection to the mysql server anymore. I don't see my server in the list.
    This is getting on my nerves :(


    Wait a second. Did you say MySQL? Linq-to-SQL supports SQL Server only...
    Kristofer - Huagati Systems Co., Ltd.
    Cool tools for Linq-to-SQL and Entity Framework:
    huagati.com/dbmltools (add-in with new features for the L2S and EF designers in VS2008 and VS2010)
    huagati.com/L2SProfiler (Query profiler for Linq-to-SQL and LLBLGen Pro)
    Wednesday, June 9, 2010 6:54 AM
    Answerer
  • My bad. Yes, meant to say SQL Server 2005 Express not MySQL :) 
    Wednesday, June 9, 2010 4:36 PM
  • Hi,

     

    Does the strange behavior occur in the specific project or on every project created in your VS2008?  I suspect some key components of VS are not installed correctly in your machine.  

     

    Have a nice weekend!

     

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, June 11, 2010 8:00 AM
    Moderator
  • Hi,

     

    I am writing to check the status of the issue on your side.  Would you mind letting us how is the problem now? 

     

    If you need further assistance, please feel free to let me know.   I will be more than happy to be of assistance.

     

    Have a nice day!

     

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, June 15, 2010 1:35 AM
    Moderator