Tables in LINQ dbml RRS feed

  • Question


    I am working with a database with 25 or more tables.  Using LINQ, is it best to set up one dbml containing all of the tables or a separate dbml for each form using just the tables needed?  I have seen examples both ways and wondered which was more efficient.
    Tuesday, July 8, 2008 5:28 PM


  • it depends of relations among your tables.
    one dbml file describes only one DataContext in whitch your entities are related by means of ORM.
    if there are relations, meny relations, you better use only one dbml file for entire database.
    in ths case you can manipulate related data not only by setting values of foreign keys,
    but explicitly adding references to the collections, whitch resolves 1:* relation.

    and there is one note:
    Linq to SQL does not supports triggers. if you generating DB with DataContext, you must
    manuall perform DDL query to create your triggers.
    also it does not support UDT created by CLR interop, you need to create appropriate view in DB to work with it.
    Thursday, July 10, 2008 11:10 AM