Dkong
Dkong

Reputation: 2788

How to put LINQ to SQL in a separate project?

How can I put the LINQ to SQL generated classes in a dedicated DAL project so that I can access it from various other projects in the same solution? I.e. so I can use one for Web, and one for Windows Forms?

Upvotes: 0

Views: 672

Answers (1)

marc_s
marc_s

Reputation: 755157

Absolutely no problem - just create a "class library" project and create your DBML file (LINQ-to-SQL file) in there.

Now, from all your projects that need this particular Linq-to-SQL file, add a reference to that class library assembly, and use the classes - and you're done!

The Linq-to-SQL DBMX file and its associated classes are just pure C# business objects and methods - there's nothing web- or Winforms-specific about those - you can use those in Winforms, WPF, Web Forms, ASP.NET MVC - you name it.

Marc

Upvotes: 4

Related Questions