SqlMetal - Error: DBML1045 RRS feed

  • Question

  • I've run into an odd issue with SqlMetal.exe from the SDK when processing a DBML file into code. Apparently when you have two functions defined with the same name you get an error similar to the following:

    Error DBML1045: The Method attribute 'TestSproc' in the Function element has been used already. 

    Now the interesting thing is that if you define two functions in a DBML via Visual Studio, you get no such error. VS compiles just fine and gives you two declarations off the datacontext. So why should SqlMetal have an issue doing the same thing? It seems to me that they ought to output the same code when it processes a DBML file.

    The reason this is an issue for me is that I have an automated process that dynamically compiles dbml files into code for use in other parts of my application. So if anyone has any ideas how I can achieve the same goal (the generated code off a DBML file that creates the entities for a DataContext) without using SqlMetal, that would be greatly appreciated as well.

    Thanks for any help you can provide!
    Monday, January 25, 2010 10:57 PM