none
Reverse SQLMetal RRS feed

  • General discussion

  • Hi,

     

    I have yet to start using LINQ to SQL. From many tutorials on the web, I see that the standard tactic is to create your database first, and then generate your classes from that.

    I would like to do the opposite: create my interfaces, then create my classes that implement the interfaces and declare LINQ attributes, and then generate database from the classes. Isn’t it what the DataContext.CreateDatabase() will do for me?

    What are the pitfalls of my approach?

     

    Thanks.

    Thursday, October 6, 2011 1:34 AM

All replies

  • Friday, October 7, 2011 3:45 PM
  • Ok, so that means that everything is super and my plan is great, right?

    Friday, October 7, 2011 8:38 PM
  • Ok, so that means that everything is super and my plan is great, right?

    As long as you understand its limitations and performance issues yes, for instance:

    "The DataContext.CreateDatabase method creates a replica of the database only to the extent of the information encoded in the object model. Mapping files and attributes from your object model might not encode everything about the structure of an existing database. Mapping information does not represent the contents of user-defined functions, stored procedures, triggers, or check constraints."

    Regards

    Tuesday, October 11, 2011 11:57 AM