After 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.
It may be as simple as this:
public class MyDataContext : DataContext { private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource(); public MyDataContext(string connection) : base(connection, mappingSource) { } }
On the project explorer, for each model in which you want to use this tool, set the "Custom Tool Name" property to "ULinqToSQLGenerator"
Assuming your DBML has an Invoice entity with InvoiceItem children and a Customer foreign relation, it may look as this:
MyDataContext dc = new MyDataContext( myConnectionString); Tableinvoices = dc.GetTable<Invoice> (); var results = from i in invoices where i.IsApproved && i.Customer.FirstName.StartsWith("John") && i.InvoiceItems.Count > 2 order by i.ApprovalDate select i return results.ToArray();
From here it's up to you!