I've just started using Linq to SQL, and I'm wondering if anyone has any best practices they can share for managing dbml files.
Any other tips and tricks welcome.
The DBML file is mapping that defines your classes based on your database schema. Yes, it defines your (default) connection string, but it doesn't "configure" your database at all. Linq to Sql uses a database-first approach where you have the database and model your classes after the DB schema.
edmx is the modeling file for Entity Framework. dbml is the modeling file for Linq 2 Sql. You should spend your time learning Entity Framework as Linq 2 Sql is deprecated.
To install the LINQ to SQL tools, start the Visual Studio installer, choose Modify, then select the Individual Components tab, and then select LINQ to SQL tools under the Code Tools category.
Have you looked at SqlMetal? It's officially supported, although not promoted too much. You can use it to build dbmls from the commandline - we've used it as part of a db's continous integration updates (make sure you have really good code separation if you do this though - partial classes are a saviour - as the dbml will get overwritten).
If I recall correctly it doesn't have quite the same features as the model designer in Visual Studio (I think it handles pluralisation differently). There a good post about it on Ben Hall's blog.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With