As Chris Rock pointed out, the first release of our Code Project custom tool for LINQ to SQL code generation lacks any usage documentation. We'll fix this on the next few days, meanwhile these are the basic instructions:
Install the Custom ToolAfter building (VS 2008) the ULinqGen project, you may either register the assembly with regasm, or build and run the setup project. Then you should close the IDE (all VS2008 instances) and reopen it to make the new custom tool available.
Code a generic Data Context class in your projectIt may be as simple as this:
public class MyDataContext : DataContext
private static System.Data.Linq.Mapping.MappingSource
mappingSource = new AttributeMappingSource();
public MyDataContext(string connection) :
Associate each DBML to the custom toolOn the project explorer, for each model in which you want to use this tool, set the "Custom Tool Name" property to "ULinqToSQLGenerator"
Get tables from your generic data context and you are ready to LINQAssuming your DBML has an Invoice entity with InvoiceItem children and a Customer foreign relation, it may look as this:
MyDataContext dc = new MyDataContext( myConnectionString);
invoices = dc.GetTable<Invoice> ();
var results = from i in invoices
&& i.InvoiceItems.Count > 2
order by i.ApprovalDate
From here it's up to you!