LINQ to SQL: Multiple / Single .dbml per project?

I've read Rick Strahl's article on Linq to SQL DataContext Lifetime Management hoping to find some answers on how I would manage my .dbml files since they are so closely related to DataContext. Unfortunately, Rick's article seems to be focused on DataContext lifetime at runtime though, and my question is concerned with how the .dbml's should be organized at design time.

The general question of 'Best practices with .dbml's' has been asked and answered here, and the answers have focused on external tools to manage the .dbml.

I'm asking a more focused question of when and why should you not have a single .dbml file in your LINQ to SQL based project?


Please note that LINQ2SQL is intended for simple and easy way to handle database relationship with objects.

Do not break table relationship and units of work concepts by creating multiple .dbml files.

If you ever need to create multiple .dbml files (which i don't recommend), then try to satisfy the following:-

  1. If you create multiple databases with no relationship between those database tables.
  2. If you want to use one of these .dbml just to handle stored procedures
  3. If you do not care about unit of work concept.

If your database is too complex, then I would consider ORM such as NHibernate, EF 4

Need Your Help

abort: could not find web.cacerts: C:\Program Files (x86)\Mercurial\cacert.pem

mercurial bitbucket atlassian-sourcetree

I'm new to Mercurial. I created a Bitbucket account, created a new private repo, and then tried to clone using the repo. I got this error: abort: could not find web.cacerts: C:\Program Files

Setting local variable through repeater and anchor or label datareader

I have a repeater which fetches data from a database and shows some labels (or anchors). I have a local variable on this class which must be updated by the value retrieved from database. To cut the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.