none
LINQ to SQL isn't generating any code RRS feed

  • Question

  • Hi all,

    LINQ to SQL isn't generating code for me.  My project builds, but I get no code output and my solution doesn't compile.  I tried to eliminate all "using" in partial classes by fully qualifying names, as I was getting the error at this site , but that only got my project building.  Without my LINQ to SQL classes, my solution fails miserably.

    What is going on?  How can I fix this?

    Thanks for your help.
    Monday, February 22, 2010 9:46 PM

Answers

  • Don,
     
    Since you have full ownership, I recommend you to recreate DBML file.
     
    1. Just delete the existing DBML file
    2. Create a new DBML file
    3. Set Default Namespace in DBML property window
    4. Add your table and function from the server explorer to DBML files.
     
    Metadata files are those where we maintain validation attribute on any entity class members, so called magic class. if you don’t have just ignore it.
     
    - Ananth Ramasamy Meenachi www.msarm.com
    "Don Lavelle" wrote in message news:892c0fa9-5906-4852-8e9a-5db734d3d563...
    Ananth,
    Thanks for your reply.  I have full ownership over this application, so I can re-create the DBML file.  What do you mean by "maintain metadata in a separate partial class"?  Do you simply mean any additional functionality I've added to the generated classes?

    Regards,

        Don

    --- Hope this helps. Ananth Ramasamy Meenachi https://www.msarm.com
    Tuesday, February 23, 2010 7:45 PM
  • What do you mean by "maintain metadata in a separate partial class"? 
    My blog article answers that: Tribal Knowledge: Linq Entities To Do Your Bidding via the Partial Keyword in C#

    Otherwise it sounds like the dbml file does not mirror the database for whatever reason. Either delete it, or delete all the tables and re-add them. The dbml file/tables do not automatically update themselves when there are changes to a database. That has to be done by hand.

    William Wegerson (www.OmegaCoder.Com)
    Tuesday, February 23, 2010 8:08 PM
    Moderator

All replies

  • Well, I was able to get the error to go away by commenting a lot of things out and then commenting them back in ... but then I tried to drop in a class into my DBML file from the toolbox, got an unspecified error, and then got "The custom tool 'MSLinqToSQLGenerator' failed." all over again.

    So ... is something bigger going on?


    edit: So, wildly annoying, the process I'm using is 1. copy my *.cs file with partial code from an older checkout, 2. delete a few select classes and functions from my DBML file, 3. try to build, 4. undo the deletions, and 5. copy the code from the older checkout back in. I still cannot add new classes to my DBML file.

    How can I pinpoint what is wrong with these classes and functions that are fouling things up?
    Monday, February 22, 2010 9:54 PM
  • And the work-around (but not the answer to my question, what the heck was going on, IMHO) is to just not ever put any code at all into the file you get to when you "View Code" on the DBML file.
    Monday, February 22, 2010 10:06 PM
  • Hey,
     
    Check for the namespace in your partial class and metadata class. Also, Check for DBML default namespace (See these in property settings ).
     
    Still you have problem? I don’t know the how much ownership you have in your application to delete the existing DBML files and to re-create a new one.
    Hope you maintain metadata in a separate partial class. You can try this in your test solution first and do the same in your actual solution later.
     
    - Ananth Ramasamy Meenachi www.msarm.com
    "Don Lavelle" wrote in message news:b8dd3386-5b1c-4f5b-9a16-86fa10d02734...
    Well, I was able to get the error to go away by commenting a lot of things out and then commenting them back in ... but then I tried to drop in a class into my DBML file from the toolbox, got an unspecified error, and then got "The custom tool 'MSLinqToSQLGenerator' failed." all over again.

    So ... is something bigger going on?


    edit: So, wildly annoying, the process I'm using is 1. copy my *.cs file with partial code from an older checkout, 2. delete a few select classes and functions from my DBML file, 3. try to build, 4. undo the deletions, and 5. copy the code from the older checkout back in. I still cannot add new classes to my DBML file.

    How can I pinpoint what is wrong with these classes and functions that are fouling things up?

    --- Hope this helps. Ananth Ramasamy Meenachi https://www.msarm.com
    Monday, February 22, 2010 10:23 PM
  • Ananth,
    Thanks for your reply.  I have full ownership over this application, so I can re-create the DBML file.  What do you mean by "maintain metadata in a separate partial class"?  Do you simply mean any additional functionality I've added to the generated classes?

    Regards,

        Don
    Tuesday, February 23, 2010 5:05 PM
  • Don,
     
    Since you have full ownership, I recommend you to recreate DBML file.
     
    1. Just delete the existing DBML file
    2. Create a new DBML file
    3. Set Default Namespace in DBML property window
    4. Add your table and function from the server explorer to DBML files.
     
    Metadata files are those where we maintain validation attribute on any entity class members, so called magic class. if you don’t have just ignore it.
     
    - Ananth Ramasamy Meenachi www.msarm.com
    "Don Lavelle" wrote in message news:892c0fa9-5906-4852-8e9a-5db734d3d563...
    Ananth,
    Thanks for your reply.  I have full ownership over this application, so I can re-create the DBML file.  What do you mean by "maintain metadata in a separate partial class"?  Do you simply mean any additional functionality I've added to the generated classes?

    Regards,

        Don

    --- Hope this helps. Ananth Ramasamy Meenachi https://www.msarm.com
    Tuesday, February 23, 2010 7:45 PM
  • What do you mean by "maintain metadata in a separate partial class"? 
    My blog article answers that: Tribal Knowledge: Linq Entities To Do Your Bidding via the Partial Keyword in C#

    Otherwise it sounds like the dbml file does not mirror the database for whatever reason. Either delete it, or delete all the tables and re-add them. The dbml file/tables do not automatically update themselves when there are changes to a database. That has to be done by hand.

    William Wegerson (www.OmegaCoder.Com)
    Tuesday, February 23, 2010 8:08 PM
    Moderator