<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>RapidDevBookCode Wiki &amp; Documentation Rss Feed</title><link>http://www.codeplex.com/RapidDevBookCode/Wiki/View.aspx?title=Home</link><description>RapidDevBookCode Wiki Rss Description</description><item><title>Updated Wiki: LLBL4linqpad</title><link>https://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=116</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the &lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 and v4.0 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;
Official LINQPad drivers for LLBLGen Pro v3.5 and 4.0&lt;/a&gt;, some of the differences are: it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support selection of Additional assemblies and namespaces &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more likely to work I expect &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via &lt;span&gt;LINQPad drivers gallery (currently v2.2 now out of date)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either: &lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;nbsp; &lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/102058"&gt;
version 3.1(V2.2.1), 3.5 and 4.0 (V2.3.1) Data Context Driver&lt;/a&gt;, &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;
version 3.0 and 3.1 Data Context Driver(V2.0)&lt;/a&gt; or &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;
version 2.6 Data Context Driver(V1.1)&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV4.0.DataContextDriver.lpx, AW.LLBLGenV3.5.DataContextDriver.lpx, AW.LLBLGenV3.1.DataContextDriver.lpx,&amp;nbsp;
&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;nbsp; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557383"&gt;&lt;img title="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557384" border="0" alt="image" width="1028" height="453" style="padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;p&gt;There are 4 options for display the results of a query in a grid&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Exclude EntityBase Properties &lt;/li&gt;&lt;li&gt;Default Linqpad behaviour &lt;/li&gt;&lt;li&gt;Use the Editable Data Grid included with the driver rather than the read-only LinqPad one
&lt;/li&gt;&lt;li&gt;Use the Editable Data Grid with a page size of 10 &lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases. This is redundant now that LINQPad has the &amp;lsquo;Create Similar Connection&amp;hellip;&amp;rsquo; feature.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625384"&gt;&lt;img title="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625385" border="0" alt="image" width="1018" height="612" style="padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in &amp;lsquo;Driver&amp;rsquo; tab of the connection dialog shown above or in the &amp;lsquo;Additional Assemblies and
 Namespaces&amp;rsquo; tab shown below.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625386"&gt;&lt;img title="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625387" border="0" alt="image" width="704" height="663" style="padding-top:0px; padding-left:0px; margin:0px; display:inline; padding-right:0px; border-width:0px"&gt;&lt;/a&gt;
&lt;br&gt;
The &amp;lsquo;Driver&amp;rsquo; tab assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, while the &amp;lsquo;Additional Assemblies and Namespaces&amp;rsquo; (version 2.3 and later only) are per connection. The additional assemblies can have relative
 or absolute paths. This an alternative to specifying them in each query. The &amp;lsquo;Add namespaces from selected assemblies&amp;rsquo; button adds all the namespaces from any selected assemblies in the &amp;lsquo;Additional Assemblies&amp;rsquo; grid plus all the assemblies
 defined in the driver.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;The LLBL version 3.5 driver will show a non-executable SQL log in the SQL Translation Tab when a query is run using the TraceHelper.QueryExecutionSwitch. In earlier versions or to view executable SQL you must define an event called SQLTraceEvent in your
 data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/p&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery property Query. For example:&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt;
&lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs &lt;br&gt;
{ &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query {
&lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;
set&lt;/span&gt;; } &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
&lt;br&gt;
&amp;nbsp; { &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query ==
&lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;
new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;); &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Query = query; &lt;br&gt;
&amp;nbsp; } &lt;br&gt;
}&lt;/p&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.
&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter:&lt;/p&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro thread on LINQPad forum&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/RichClient/DataContextDrivers.aspx"&gt;LINQPad Supplementary Data Context Drivers&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;p&gt;&lt;span style="color:#0000ff"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;Northwind (adapter)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter =
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory();
&lt;br&gt;
&amp;nbsp; &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId)
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId)
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId))
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);
&lt;br&gt;
&lt;br&gt;
&amp;nbsp; adapter.FetchQuery(q).Dump(); &lt;br&gt;
}&lt;/p&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Fri, 19 Apr 2013 09:50:28 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20130419095028A</guid></item><item><title>Updated Wiki: EnumerableDebugVisualizer</title><link>https://rapiddevbookcode.codeplex.com/wikipage?title=EnumerableDebugVisualizer&amp;version=23</link><description>
&lt;div class="wikidoc"&gt;I have created an enumerable &lt;a href="http://msdn.microsoft.com/en-us/library/zayyhzts(v=VS.100).aspx"&gt;
Debugger Visualizer for Visual Studio&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/a&gt; that displays any registered IEnumerable object in a datagridview.
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;h3&gt;Binary&lt;/h3&gt;
Download &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/51056"&gt;AW.EnumerableVisualizer.dll(VS2008)&lt;/a&gt; or
&lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/57678"&gt;AW.EnumerableVisualizer.dll(VS2010)&lt;/a&gt; or
&lt;a href="https://rapiddevbookcode.codeplex.com/releases/view/104949"&gt;AW.EnumerableVisualizer.dll(VS2012)&lt;/a&gt;&amp;nbsp; then copy it to either of the debugger visualizers directories:
&lt;a href="http://msdn.microsoft.com/en-us/library/sb2yca43.aspx"&gt;How to: Install a Visualizer&lt;/a&gt;
&lt;h3&gt;Source code&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Repository code is downloadable from the source code tab though I recommend using TortoiseSVN for the getting the source from the repository.
&lt;/li&gt;&lt;li&gt;Build the solution AW.DebugVisualizers.sln &lt;/li&gt;&lt;li&gt;If you have &lt;a href="http://research.microsoft.com/en-us/people/mbarnett/ILMerge.aspx"&gt;
ILMerge&lt;/a&gt; installed run MergeAndDeploy.Bat after doing a Release build &lt;br&gt;
If not run DebugDeploy.bat which copies AW.DebugVisualizers.dll, AW.Helper.dll, AW.Winforms.Helpers.dll, Dynamic.dll and ObjectListView.dll to %userprofile%\My Documents\Visual Studio 2008(or 2010)\Visualizers
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Note&lt;/h3&gt;
Unfortunately you can't register a debugger visualizer for interfaces so every IEnumerable class must registered individually. The list of classes that are currently registered can be seen in the file VisualizerRegistrations.cs, you can easily add more.
&lt;h3&gt;Lists of other Debugger Visualizers&lt;/h3&gt;
&lt;a href="http://www.dotnetpowered.com/DebuggerVisualizers.aspx"&gt;Dotnetpowered Debugger Visualizers List&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://alexpinsker.blogspot.com/2009/06/comprehensive-list-of-debugger.html"&gt;Comprehensive list of Debugger Visualizers for Visual Studio&lt;/a&gt;
&lt;h3&gt;Similar Debugger Visualizers&lt;/h3&gt;
&lt;div class="wikidoc"&gt;&lt;a href="http://www.adamdawes.com/programming/vs2005/adcollectionsvisualizer.html"&gt;http://www.adamdawes.com/programming/vs2005/adcollectionsvisualizer.html&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://www.codeproject.com/KB/macros/ListVisualizer.aspx"&gt;http://www.codeproject.com/KB/macros/ListVisualizer.aspx&lt;/a&gt;&lt;/div&gt;
&lt;div class="wikidoc"&gt;&lt;a href="http://www.molosoft.com/docs/moling-collections/"&gt;http://www.molosoft.com/docs/moling-collections/&lt;/a&gt;&lt;/div&gt;
&lt;div class="wikidoc"&gt;&lt;a href="http://code.google.com/p/linqpadvisualizer/"&gt;http://code.google.com/p/linqpadvisualizer/&lt;/a&gt;&lt;/div&gt;
&lt;h3&gt;Objects that can have debugger visualizers:&lt;/h3&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/e2zc529c.aspx"&gt;You can write a custom visualizer for an object of any managed class except for Object or Array&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://weblogs.asp.net/fbouma/archive/2006/02/06/437536.aspx"&gt;Debugger visualizers won't work on interface types&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/93d53290-998e-48ad-98bc-9fcd9e642f57"&gt;Debugger visualizers won't work on nested classes in VS2008&lt;/a&gt;&lt;/div&gt;
</description><author>JezzaT</author><pubDate>Fri, 12 Apr 2013 10:44:25 GMT</pubDate><guid isPermaLink="false">Updated Wiki: EnumerableDebugVisualizer 20130412104425A</guid></item><item><title>Updated Wiki: LLBL4linqpad</title><link>https://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=115</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the &lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;
Official LINQPad driver for LLBLGen Pro v3.5&lt;/a&gt;, some of the differences are: it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support selection of Additional assemblies and namespaces &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more likely to work I expect &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via &lt;span&gt;LINQPad drivers gallery (currently v2.2 now out of date)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either: &lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;#160; &lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/102058"&gt;
version 3.1(V2.2.1)&amp;#160; and 3.5 (V2.3.1) Data Context Driver&lt;/a&gt;, &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;
version 3.0 and 3.1 Data Context Driver(V2.0)&lt;/a&gt; or &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;
version 2.6 Data Context Driver(V1.1)&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV3.5.DataContextDriver.lpx, AW.LLBLGenV3.1.DataContextDriver.lpx,&amp;#160;
&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;#160; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557383"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557384" width="1028" height="453" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;p&gt;There are 4 options for display the results of a query in a grid&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Exclude EntityBase Properties &lt;/li&gt;&lt;li&gt;Default Linqpad behaviour &lt;/li&gt;&lt;li&gt;Use the Editable Data Grid included with the driver rather than the read-only LinqPad one
&lt;/li&gt;&lt;li&gt;Use the Editable Data Grid with a page size of 10 &lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases. This is redundant now that LINQPad has the ‘Create Similar Connection…’ feature.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625384"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625385" width="1018" height="612" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in ‘Driver’ tab of the connection dialog shown above or in the ‘Additional Assemblies and Namespaces’ tab
 shown below.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625386"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625387" width="704" height="663" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; margin:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;
&lt;br&gt;
The ‘Driver’ tab assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, while the ‘Additional Assemblies and Namespaces’ (version 2.3 and later only) are per connection. The additional assemblies can have relative or absolute paths. This
 an alternative to specifying them in each query. The ‘Add namespaces from selected assemblies’ button adds all the namespaces from any selected assemblies in the ‘Additional Assemblies’ grid plus all the assemblies defined in the driver.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;The LLBL version 3.5 driver will show a non-executable SQL log in the SQL Translation Tab when a query is run using the TraceHelper.QueryExecutionSwitch. In earlier versions or to view executable SQL you must define an event called SQLTraceEvent in your
 data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/p&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery property Query. For example:&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt;
&lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs &lt;br&gt;
{ &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;#160; &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query {
&lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;
set&lt;/span&gt;; } &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;#160; &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
&lt;br&gt;
&amp;#160; { &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query ==
&lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;
new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;);
&lt;br&gt;
&amp;#160;&amp;#160;&amp;#160; Query = query; &lt;br&gt;
&amp;#160; } &lt;br&gt;
}&lt;/p&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.
&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter:&lt;/p&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro thread on LINQPad forum&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/RichClient/DataContextDrivers.aspx"&gt;LINQPad Supplementary Data Context Drivers&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;p&gt;&lt;span style="color:#0000ff"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;Northwind (adapter)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter =
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) &lt;br&gt;
{ &lt;br&gt;
&amp;#160; &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory();
&lt;br&gt;
&amp;#160; &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer &lt;br&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId)
&lt;br&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId)
&lt;br&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId))
&lt;br&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);
&lt;br&gt;
&lt;br&gt;
&amp;#160; adapter.FetchQuery(q).Dump(); &lt;br&gt;
}&lt;/p&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Sun, 17 Feb 2013 10:39:01 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20130217103901A</guid></item><item><title>Updated Wiki: LLBL4linqpad</title><link>https://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=114</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the &lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;
Official LINQPad driver for LLBLGen Pro v3.5&lt;/a&gt;, some of the differences are: it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;Doesn't require changes to the source code to show a SQL trace &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support Additional assemblies and namespaces via driver &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more likely to work I expect &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via &lt;span&gt;LINQPad drivers gallery (currently v2.2 now out of date)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either: &lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;#160; &lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/84687"&gt;
version 3.1 and 3.5 Data Context Driver(V2.1)&lt;/a&gt;, &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;
version 3.0 and 3.1 Data Context Driver(V2.0)&lt;/a&gt; or &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;
version 2.6 Data Context Driver(V1.1)&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV3.5.DataContextDriverV2.1.lpx, AW.LLBLGenV3.1.DataContextDriverV2.1.lpx,&amp;#160;
&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;#160; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557383"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557384" width="1028" height="453" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;p&gt;There are 4 options for display the results of a query in a grid&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Exclude EntityBase Properties &lt;/li&gt;&lt;li&gt;Default Linqpad behaviour &lt;/li&gt;&lt;li&gt;Use the Editable Data Grid included with the driver rather than the read-only LinqPad one
&lt;/li&gt;&lt;li&gt;Use the Editable Data Grid with a page size of 10 &lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases. This is redundant now that LINQPad has the ‘Create Similar Connection…’ feature.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625384"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625385" width="1018" height="612" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in ‘Driver’ tab of the connection dialog shown above or in the ‘Additional Assemblies and Namespaces’ tab
 shown below.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625386"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625387" width="704" height="663" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; margin:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;
&lt;br&gt;
The ‘Driver’ tab assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, while the ‘Additional Assemblies and Namespaces’ (version 2.3 and later only) are per connection. The additional assemblies can have relative or absolute paths. This
 an alternative to specifying them in each query. The ‘Add namespaces from selected assemblies’ button adds all the namespaces from any selected assemblies in the ‘Additional Assemblies’ grid plus all the assemblies defined in the driver.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;The LLBL version 3.5 driver will show a non-executable SQL log in the SQL Translation Tab when a query is run using the TraceHelper.QueryExecutionSwitch. In earlier versions or to view executable SQL you must define an event called SQLTraceEvent in your
 data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/p&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery property Query. For example:&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt;
&lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs &lt;br&gt;
{ &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;#160; &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query {
&lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;
set&lt;/span&gt;; } &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;#160; &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
&lt;br&gt;
&amp;#160; { &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query ==
&lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;
new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;);
&lt;br&gt;
&amp;#160;&amp;#160;&amp;#160; Query = query; &lt;br&gt;
&amp;#160; } &lt;br&gt;
}&lt;/p&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.
&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter:&lt;/p&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro thread on LINQPad forum&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/RichClient/DataContextDrivers.aspx"&gt;LINQPad Supplementary Data Context Drivers&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;p&gt;&lt;span style="color:#0000ff"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;Northwind (adapter)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter =
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) &lt;br&gt;
{ &lt;br&gt;
&amp;#160; &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory();
&lt;br&gt;
&amp;#160; &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer &lt;br&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId)
&lt;br&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId)
&lt;br&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId))
&lt;br&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);
&lt;br&gt;
&lt;br&gt;
&amp;#160; adapter.FetchQuery(q).Dump(); &lt;br&gt;
}&lt;/p&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Sun, 17 Feb 2013 10:23:38 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20130217102338A</guid></item><item><title>Updated Wiki: LLBL4linqpad</title><link>https://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=113</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the &lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;
Official LINQPad driver for LLBLGen Pro v3.5&lt;/a&gt;, some of the differences are: it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;Doesn't require changes to the source code to show a SQL trace &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support Additional assemblies and namespaces via driver &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more likely to work I expect &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via &lt;span&gt;LINQPad drivers gallery (currently v2.2 now out of date)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either: &lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;#160; &lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/84687"&gt;
version 3.1 and 3.5 Data Context Driver(V2.1)&lt;/a&gt;, &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;
version 3.0 and 3.1 Data Context Driver(V2.0)&lt;/a&gt; or &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;
version 2.6 Data Context Driver(V1.1)&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV3.5.DataContextDriverV2.1.lpx, AW.LLBLGenV3.1.DataContextDriverV2.1.lpx,&amp;#160;
&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;#160; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557383"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557384" width="1028" height="453" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;p&gt;There are 4 options for display the results of a query in a grid&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Exclude EntityBase Properties &lt;/li&gt;&lt;li&gt;Default Linqpad behaviour &lt;/li&gt;&lt;li&gt;Use the Editable Data Grid included with the driver rather than the read-only LinqPad one
&lt;/li&gt;&lt;li&gt;Use the Editable Data Grid with a page size of 10 &lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases. This is redundant now that LINQPad has the ‘Create Similar Connection…’ feature.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625384"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625385" width="1018" height="612" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in ‘Driver’ tab of the connection dialog shown above or in the ‘Additional Assemblies and Namespaces’ tab
 shown below.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625386"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625387" width="704" height="663" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; margin:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;
&lt;br&gt;
The ‘Driver’ tab assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, while the ‘Additional Assemblies and Namespaces’ (version 2.3 and later only) are per connection. The additional assemblies can have relative or absolute paths. This
 an alternative to specifying them in each query. The ‘Add namespaces from selected assemblies’ button adds all the namespaces from any selected assemblies in the ‘Additional Assemblies’ grid plus all the assemblies defined in the driver.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;The LLBL version 3.5 driver will show a non-executable SQL log in the SQL Translation Tab when a query is run using the TraceHelper.QueryExecutionSwitch. In earlier versions or to view executable SQL you must define an event called SQLTraceEvent in your
 data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/p&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery property Query. For example:&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt;
&lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs &lt;br&gt;
{ &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;#160; &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query {
&lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;
set&lt;/span&gt;; } &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;#160; &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
&lt;br&gt;
&amp;#160; { &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query ==
&lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;
new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;);
&lt;br&gt;
&amp;#160;&amp;#160;&amp;#160; Query = query; &lt;br&gt;
&amp;#160; } &lt;br&gt;
}&lt;/p&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.
&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter:&lt;/p&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Extras&lt;/p&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro thread on LINQPad forum&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/RichClient/DataContextDrivers.aspx"&gt;LINQPad Supplementary Data Context Drivers&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;p style="color:black; background-color:white"&gt;QuerySpec&lt;/p&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;p&gt;&lt;span style="color:#0000ff"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Northwind (adapter)&lt;/p&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter =
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) &lt;br&gt;
{ &lt;br&gt;
&amp;#160; &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory();
&lt;br&gt;
&amp;#160; &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer &lt;br&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId)
&lt;br&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId)
&lt;br&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId))
&lt;br&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);
&lt;br&gt;
&lt;br&gt;
&amp;#160; adapter.FetchQuery(q).Dump(); &lt;br&gt;
}&lt;/p&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Sun, 17 Feb 2013 10:20:50 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20130217102050A</guid></item><item><title>Updated Wiki: LLBL4linqpad</title><link>https://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=112</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the &lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;
Official LINQPad driver for LLBLGen Pro v3.5&lt;/a&gt;, some of the differences are: it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;Doesn't require changes to the source code to show a SQL trace &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support Additional assemblies and namespaces via driver &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more likely to work I expect &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via &lt;span&gt;LINQPad drivers gallery (currently v2.2 now out of date)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either: &lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;#160; &lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/84687"&gt;
version 3.1 and 3.5 Data Context Driver(V2.1)&lt;/a&gt;, &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;
version 3.0 and 3.1 Data Context Driver(V2.0)&lt;/a&gt; or &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;
version 2.6 Data Context Driver(V1.1)&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV3.5.DataContextDriverV2.1.lpx, AW.LLBLGenV3.1.DataContextDriverV2.1.lpx,&amp;#160;
&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;#160; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557383"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557384" width="1028" height="453" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;p&gt;There are 4 options for display the results of a query in a grid&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Exclude EntityBase Properties &lt;/li&gt;&lt;li&gt;Default Linqpad behaviour &lt;/li&gt;&lt;li&gt;Use the Editable Data Grid included with the driver rather than the read-only LinqPad one
&lt;/li&gt;&lt;li&gt;Use the Editable Data Grid with a page size of 10 &lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases. This is redundant now that LINQPad has the ‘Create Similar Connection…’ feature.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625384"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625385" width="1018" height="612" style="border-top:0px; border-right:0px; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; display:inline; padding-right:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in ‘Driver’ tab of the connection dialog shown above or in the ‘Additional Assemblies and Namespaces’ tab
 shown below.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625386"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625387" width="704" height="663" style="border-top:0px; border-right:0px; border-bottom:0px; padding-top:0px; padding-left:0px; margin:0px; border-left:0px; display:inline; padding-right:0px"&gt;&lt;/a&gt;
&lt;br&gt;
The ‘Driver’ tab assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, while the ‘Additional Assemblies and Namespaces’ (version 2.3 and later only) are per connection. The additional assemblies can have relative or absolute paths. This
 an alternative to specifying them in each query. The ‘Add namespaces from selected assemblies’ button adds all the namespaces from any selected assemblies in the ‘Additional Assemblies’ grid plus all the assemblies defined in the driver.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;The LLBL version 3.5 driver will show a non-executable SQL log in the SQL Translation Tab when a query is run using the TraceHelper.QueryExecutionSwitch. In earlier versions or to view executable SQL you must define an event called SQLTraceEvent in your
 data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/p&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery property Query. For example:&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt;
&lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs &lt;br&gt;
{ &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;#160; &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query {
&lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;
set&lt;/span&gt;; } &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;#160; &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
&lt;br&gt;
&amp;#160; { &lt;br&gt;
&lt;span style="color:blue"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query ==
&lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;
new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;);
&lt;br&gt;
&amp;#160;&amp;#160;&amp;#160; Query = query; &lt;br&gt;
&amp;#160; } &lt;br&gt;
}&lt;/p&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.
&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;#160;&lt;/p&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro thread on LINQPad forum&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/RichClient/DataContextDrivers.aspx"&gt;LINQPad Supplementary Data Context Drivers&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;#160;&lt;/p&gt;
&lt;h5 style="color:black"&gt;QuerySpec&lt;/h5&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;p&gt;&lt;span style="color:#0000ff"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;h4&gt;Northwind (adapter)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;#160;&lt;/p&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter = &lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) 
{ 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory(); 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer 
            .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId) 
                             .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId) 
                             .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId)) 
            .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);

  adapter.FetchQuery(q).Dump(); 
}&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Sun, 17 Feb 2013 10:18:14 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20130217101814A</guid></item><item><title>Updated Wiki: LLBL4linqpad</title><link>https://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=111</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the &lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;
Official LINQPad driver for LLBLGen Pro v3.5&lt;/a&gt;, some of the differences are: it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;Doesn't require changes to the source code to show a SQL trace &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support Additional assemblies and namespaces via driver &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more likely to work I expect &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via &lt;span&gt;LINQPad drivers gallery (currently v2.2 now out of date)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either: &lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;#160; &lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/84687"&gt;
version 3.1 and 3.5 Data Context Driver(V2.1)&lt;/a&gt;, &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;
version 3.0 and 3.1 Data Context Driver(V2.0)&lt;/a&gt; or &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;
version 2.6 Data Context Driver(V1.1)&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV3.5.DataContextDriverV2.1.lpx, AW.LLBLGenV3.1.DataContextDriverV2.1.lpx,&amp;#160;
&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;#160; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557383"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557384" width="1028" height="453" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;p&gt;There are 4 options for display the results of a query in a grid&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Exclude EntityBase Properties &lt;/li&gt;&lt;li&gt;Default Linqpad behaviour &lt;/li&gt;&lt;li&gt;Use the Editable Data Grid included with the driver rather than the read-only LinqPad one
&lt;/li&gt;&lt;li&gt;Use the Editable Data Grid with a page size of 10 &lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;#160;&lt;/p&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases. This is redundant now that LINQPad has the ‘Create Similar Connection…’ feature.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625384"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625385" width="1018" height="612" style="border-top:0px; border-right:0px; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; display:inline; padding-right:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;&amp;#160;&lt;/h3&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in ‘Driver’ tab of the connection dialog shown above or in the ‘Additional Assemblies and Namespaces’ tab
 shown below. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625386"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=625387" width="704" height="663" style="border-top:0px; border-right:0px; border-bottom:0px; padding-top:0px; padding-left:0px; margin:0px; border-left:0px; display:inline; padding-right:0px"&gt;&lt;/a&gt;
&lt;br&gt;
The ‘Driver’ tab assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, while the ‘Additional Assemblies and Namespaces’ (version 2.3 and later only) are per connection. The additional assemblies can have relative or absolute paths. This
 an alternative to specifying them in each query. The ‘Add namespaces from selected assemblies’ buttons adds all the namespaces from any selected assemblies in the ‘Additional Assemblies’ grid plus all the assemblies defined in the driver.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;The LLBL version 3.5 driver will show a non-executable SQL log in the SQL Translation Tab when a query is run using the TraceHelper.QueryExecutionSwitch. In earlier versions or to view executable SQL you must define an event called SQLTraceEvent in your
 data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;#160;&lt;/p&gt;
&lt;pre&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/pre&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery property Query. For example:&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;#160;&lt;/p&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs
{
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query { &lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;set&lt;/span&gt;; }
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
  {
&lt;span style="color:blue"&gt;    &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query == &lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;);
    Query = query;
  }
}&lt;/pre&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.
&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;#160;&lt;/p&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro thread on LINQPad forum&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/RichClient/DataContextDrivers.aspx"&gt;LINQPad Supplementary Data Context Drivers&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;#160;&lt;/p&gt;
&lt;h5 style="color:black"&gt;QuerySpec&lt;/h5&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;p&gt;&lt;span style="color:#0000ff"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;h4&gt;Northwind (adapter)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;#160;&lt;/p&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter = &lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) 
{ 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory(); 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer 
            .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId) 
                             .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId) 
                             .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId)) 
            .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);

  adapter.FetchQuery(q).Dump(); 
}&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Sun, 17 Feb 2013 10:02:29 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20130217100229A</guid></item><item><title>Updated Wiki: LLBL4linqpad</title><link>http://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=110</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the &lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;
Official LINQPad driver for LLBLGen Pro v3.5&lt;/a&gt;, some of the differences are: it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;Doesn't require changes to the source code to show a SQL trace &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support Additional assemblies and namespaces via driver &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more likely to work I expect &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via &lt;span&gt;LINQPad drivers gallery (currently v2.2 now out of date)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either: &lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;nbsp; &lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/84687"&gt;
version 3.1 and 3.5 Data Context Driver(V2.1)&lt;/a&gt;, &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;
version 3.0 and 3.1 Data Context Driver(V2.0)&lt;/a&gt; or &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;
version 2.6 Data Context Driver(V1.1)&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV3.5.DataContextDriverV2.1.lpx, AW.LLBLGenV3.1.DataContextDriverV2.1.lpx,&amp;nbsp;
&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;nbsp; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557383"&gt;&lt;img title="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557384" border="0" alt="image" width="1028" height="453" style="padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;p&gt;There are 4 options for display the results of a query in a grid&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Exclude EntityBase Properties &lt;/li&gt;&lt;li&gt;Default Linqpad behaviour &lt;/li&gt;&lt;li&gt;Use the Editable Data Grid included with the driver rather than the read-only LinqPad one
&lt;/li&gt;&lt;li&gt;Use the Editable Data Grid with a page size of 10 &lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266264"&gt;&lt;img title="image" src="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266265" border="0" alt="image" width="942" height="563" style="padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in third tab of the connection dialog shown above.
&lt;br&gt;
Unfortunately these assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, I investigated having them per connection but the additional assemblies and namespaces for the driver are set before the connection is loaded into the driver.
&lt;br&gt;
The additional assemblies can have relative or absolute paths. This an alternative to specifying them in each query.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;To view the SQL generated when a query is run in the SQL Translation Tab you must define an event called SQLTraceEvent in your data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery property Query. For example:&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs
{
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query { &lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;set&lt;/span&gt;; }
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
  {
&lt;span style="color:blue"&gt;    &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query == &lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;);
    Query = query;
  }
}&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.
&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro thread on LINQPad forum&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/RichClient/DataContextDrivers.aspx"&gt;LINQPad Supplementary Data Context Drivers&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;nbsp;&lt;/p&gt;
&lt;h5 style="color:black"&gt;QuerySpec&lt;/h5&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;p&gt;&lt;span style="color:#0000ff"&gt;&lt;/p&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/span&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Northwind (adapter)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;p style="color:black; background-color:white"&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter = &lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) 
{ 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory(); 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer 
            .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId) 
                             .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId) 
                             .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId)) 
            .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);

  adapter.FetchQuery(q).Dump(); 
}&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Sun, 17 Feb 2013 09:04:31 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20130217090431A</guid></item><item><title>Updated Wiki: LLBL4linqpad</title><link>http://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=109</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the &lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;
Official LINQPad driver for LLBLGen Pro v3.5&lt;/a&gt;, some of the differences are: it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;Doesn't require changes to the source code to show a SQL trace &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support Additional assemblies and namespaces via driver &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more likely to work I expect &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via &lt;span&gt;LINQPad drivers gallery (currently v2.2)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either: &lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;nbsp; &lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/84687"&gt;
version 3.1 and 3.5 Data Context Driver(V2.1)&lt;/a&gt;, &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;
version 3.0 and 3.1 Data Context Driver(V2.0)&lt;/a&gt; or &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;
version 2.6 Data Context Driver(V1.1)&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV3.5.DataContextDriverV2.1.lpx, AW.LLBLGenV3.1.DataContextDriverV2.1.lpx,&amp;nbsp;
&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;nbsp; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557383"&gt;&lt;img title="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557384" border="0" alt="image" width="1028" height="453" style="padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;p&gt;There are 4 options for display the results of a query in a grid&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Exclude EntityBase Properties &lt;/li&gt;&lt;li&gt;Default Linqpad behaviour &lt;/li&gt;&lt;li&gt;Use the Editable Data Grid included with the driver rather than the read-only LinqPad one
&lt;/li&gt;&lt;li&gt;Use the Editable Data Grid with a page size of 10 &lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;/p&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266264"&gt;&lt;img title="image" src="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266265" border="0" alt="image" width="942" height="563" style="padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in third tab of the connection dialog shown above.
&lt;br&gt;
Unfortunately these assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, I investigated having them per connection but the additional assemblies and namespaces for the driver are set before the connection is loaded into the driver.
&lt;br&gt;
The additional assemblies can have relative or absolute paths. This an alternative to specifying them in each query.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;To view the SQL generated when a query is run in the SQL Translation Tab you must define an event called SQLTraceEvent in your data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;/p&gt;
&lt;pre&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery property Query. For example:&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs
{
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query { &lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;set&lt;/span&gt;; }
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
  {
&lt;span style="color:blue"&gt;    &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query == &lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;);
    Query = query;
  }
}&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.
&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter&lt;/p&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro thread on LINQPad forum&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;/p&gt;
&lt;h5 style="color:black"&gt;QuerySpec&lt;/h5&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;span style="color:#0000ff"&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/span&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h4&gt;Northwind (adapter)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;p style="color:black; background-color:white"&gt;&lt;/p&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter = &lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) 
{ 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory(); 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer 
            .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId) 
                             .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId) 
                             .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId)) 
            .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);

  adapter.FetchQuery(q).Dump(); 
}&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Sat, 01 Dec 2012 08:56:21 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20121201085621A</guid></item><item><title>Updated Wiki: LLBL4linqpad</title><link>http://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=108</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the &lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;
Official LINQPad driver for LLBLGen Pro v3.5&lt;/a&gt;, some of the differences are: it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;Doesn't require changes to the source code to show a SQL trace &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support Additional assemblies and namespaces via driver &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more likely to work I expect &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via &lt;span&gt;LINQPad drivers gallery (currently v2.2)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either: &lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;nbsp; &lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/84687"&gt;
version 3.1 and 3.5 Data Context Driver(V2.1)&lt;/a&gt;, &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;
version 3.0 and 3.1 Data Context Driver(V2.0)&lt;/a&gt; or &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;
version 2.6 Data Context Driver(V1.1)&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV3.5.DataContextDriverV2.1.lpx, AW.LLBLGenV3.1.DataContextDriverV2.1.lpx,&amp;nbsp;
&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;nbsp; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557383"&gt;&lt;img title="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557384" border="0" alt="image" width="1028" height="453" style="padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;p&gt;There are 4 options for display the results of a query in a grid&lt;/p&gt;
&lt;li&gt;Exclude EntityBase Properties &lt;/li&gt;&lt;li&gt;Default Linqpad behaviour &lt;/li&gt;&lt;li&gt;Use the Editable Data Grid included with the driver rather than the read-only LinqPad one
&lt;/li&gt;&lt;li&gt;Use the Editable Data Grid with a page size of 10
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266264"&gt;&lt;img title="image" src="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266265" border="0" alt="image" width="942" height="563" style="padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in third tab of the connection dialog shown above.
&lt;br&gt;
Unfortunately these assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, I investigated having them per connection but the additional assemblies and namespaces for the driver are set before the connection is loaded into the driver.
&lt;br&gt;
The additional assemblies can have relative or absolute paths. This an alternative to specifying them in each query.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;To view the SQL generated when a query is run in the SQL Translation Tab you must define an event called SQLTraceEvent in your data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery property Query. For example:&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs
{
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query { &lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;set&lt;/span&gt;; }
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
  {
&lt;span style="color:blue"&gt;    &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query == &lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;);
    Query = query;
  }
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.
&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro thread on LINQPad forum&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;h5 style="color:black"&gt;QuerySpec&lt;/h5&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;span style="color:#0000ff"&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;h4&gt;Northwind (adapter)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter = &lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) 
{ 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory(); 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer 
            .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId) 
                             .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId) 
                             .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId)) 
            .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);

  adapter.FetchQuery(q).Dump(); 
}&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/li&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Sat, 01 Dec 2012 08:55:31 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20121201085531A</guid></item><item><title>Updated Wiki: LLBL4linqpad</title><link>http://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=107</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the &lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;
Official LINQPad driver for LLBLGen Pro v3.5&lt;/a&gt;, some of the differences are: it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;Doesn't require changes to the source code to show a SQL trace &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support Additional assemblies and namespaces via driver &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more likely to work I expect &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via &lt;span&gt;LINQPad drivers gallery (currently v2.2)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either: &lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;nbsp; &lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/84687"&gt;
version 3.1 and 3.5 Data Context Driver(V2.1)&lt;/a&gt;, &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;
version 3.0 and 3.1 Data Context Driver(V2.0)&lt;/a&gt; or &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;
version 2.6 Data Context Driver(V1.1)&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV3.5.DataContextDriverV2.1.lpx, AW.LLBLGenV3.1.DataContextDriverV2.1.lpx,&amp;nbsp;
&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;nbsp; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557383"&gt;&lt;img title="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557384" border="0" alt="image" width="1028" height="453" style="padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;p&gt;There are 4 options for display the results of a query in a grid&lt;/p&gt;
&lt;li&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:#a31515"&gt;Exclude EntityBase Properties&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:#a31515"&gt;Default Linqpad behaviour&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:#a31515"&gt;Use the Editable Data Grid included with the driver rather than the read-only LinqPad one&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:#a31515"&gt;Use the Editable Data Grid with a page size of 10&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266264"&gt;&lt;img title="image" src="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266265" border="0" alt="image" width="942" height="563" style="padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in third tab of the connection dialog shown above.
&lt;br&gt;
Unfortunately these assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, I investigated having them per connection but the additional assemblies and namespaces for the driver are set before the connection is loaded into the driver.
&lt;br&gt;
The additional assemblies can have relative or absolute paths. This an alternative to specifying them in each query.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;To view the SQL generated when a query is run in the SQL Translation Tab you must define an event called SQLTraceEvent in your data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery property Query. For example:&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs
{
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query { &lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;set&lt;/span&gt;; }
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
  {
&lt;span style="color:blue"&gt;    &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query == &lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;);
    Query = query;
  }
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.
&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro thread on LINQPad forum&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;h5 style="color:black"&gt;QuerySpec&lt;/h5&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;span style="color:#0000ff"&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;h4&gt;Northwind (adapter)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter = &lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) 
{ 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory(); 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer 
            .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId) 
                             .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId) 
                             .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId)) 
            .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);

  adapter.FetchQuery(q).Dump(); 
}&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/li&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Sat, 01 Dec 2012 08:52:50 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20121201085250A</guid></item><item><title>Updated Wiki: LLBL4linqpad</title><link>https://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=106</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the &lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;
Official LINQPad driver for LLBLGen Pro v3.5&lt;/a&gt;, some of the differences are: it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;Doesn't require changes to the source code to show a SQL trace &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support Additional assemblies and namespaces via driver &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more likely to work I expect &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via &lt;span&gt;LINQPad drivers gallery (currently v2.2)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either: &lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;#160; &lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/84687"&gt;
version 3.1 and 3.5 Data Context Driver(V2.1)&lt;/a&gt;, &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;
version 3.0 and 3.1 Data Context Driver(V2.0)&lt;/a&gt; or &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;
version 2.6 Data Context Driver(V1.1)&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV3.5.DataContextDriverV2.1.lpx, AW.LLBLGenV3.1.DataContextDriverV2.1.lpx,&amp;#160;
&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;#160; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557383"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557384" width="1028" height="453" style="border-top:0px; border-right:0px; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; display:inline; padding-right:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;p&gt;There are 4 options for display the results of a query in a grid&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:#a31515"&gt;Exclude EntityBase Properties&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:#a31515"&gt;Default Linqpad behaviour&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:#a31515"&gt;Use the Editable Data Grid included with the driver rather than the read-only LinqPad one&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:#a31515"&gt;Use the Editable Data Grid with a page size of 10&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266264"&gt;&lt;img title="image" border="0" alt="image" src="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266265" width="942" height="563" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in third tab of the connection dialog shown above.
&lt;br&gt;
Unfortunately these assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, I investigated having them per connection but the additional assemblies and namespaces for the driver are set before the connection is loaded into the driver.
&lt;br&gt;
The additional assemblies can have relative or absolute paths. This an alternative to specifying them in each query.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;To view the SQL generated when a query is run in the SQL Translation Tab you must define an event called SQLTraceEvent in your data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery property Query. For example:&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs
{
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query { &lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;set&lt;/span&gt;; }
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
  {
&lt;span style="color:blue"&gt;    &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query == &lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;);
    Query = query;
  }
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.
&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro thread on LINQPad forum&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;h5 style="color:black"&gt;QuerySpec&lt;/h5&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;span style="color:#0000ff"&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;h4&gt;Northwind (adapter)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter = &lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) 
{ 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory(); 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer 
            .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId) 
                             .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId) 
                             .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId)) 
            .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);

  adapter.FetchQuery(q).Dump(); 
}&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Sat, 01 Dec 2012 08:51:34 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20121201085134A</guid></item><item><title>Updated Wiki: LLBL4linqpad</title><link>https://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=105</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the &lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;
Official LINQPad driver for LLBLGen Pro v3.5&lt;/a&gt;, some of the differences are: it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;Doesn't require changes to the source code to show a SQL trace &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support Additional assemblies and namespaces via driver &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more likely to work I expect &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via &lt;span&gt;LINQPad drivers gallery (currently v2.2)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either: &lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;#160; &lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/84687"&gt;
version 3.1 and 3.5 Data Context Driver(V2.1)&lt;/a&gt;, &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;
version 3.0 and 3.1 Data Context Driver(V2.0)&lt;/a&gt; or &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;
version 2.6 Data Context Driver(V1.1)&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV3.5.DataContextDriverV2.1.lpx, AW.LLBLGenV3.1.DataContextDriverV2.1.lpx,&amp;#160;
&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;#160; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557383"&gt;&lt;img title="image" border="0" alt="image" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=RapidDevBookCode&amp;DownloadId=557384" width="1028" height="453" style="border-top:0px; border-right:0px; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; display:inline; padding-right:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;  &lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;enum&lt;/span&gt; DisplayInGrid
  {
    [Description(&lt;span style="color:#a31515"&gt;&amp;quot;Exclude EntityBase Properties&amp;quot;&lt;/span&gt;)]
    ExcludeEntityBaseProperties,
    [Description(&lt;span style="color:#a31515"&gt;&amp;quot;Default Linqpad behaviour&amp;quot;&lt;/span&gt;)]
    AllProperties,
    [Description(&lt;span style="color:#a31515"&gt;&amp;quot;Use the Editable Data Grid included with the driver rather than the LinqPad one&amp;quot;&lt;/span&gt;)]
    UseEditableGrid,
    [Description(&lt;span style="color:#a31515"&gt;&amp;quot;Use the Editable Data Grid with a page size of 10&amp;quot;&lt;/span&gt;)]
    UseEditableGridPaged
  }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266264"&gt;&lt;img title="image" border="0" alt="image" src="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266265" width="942" height="563" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in third tab of the connection dialog shown above.
&lt;br&gt;
Unfortunately these assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, I investigated having them per connection but the additional assemblies and namespaces for the driver are set before the connection is loaded into the driver.
&lt;br&gt;
The additional assemblies can have relative or absolute paths. This an alternative to specifying them in each query.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;To view the SQL generated when a query is run in the SQL Translation Tab you must define an event called SQLTraceEvent in your data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery property Query. For example:&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs
{
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query { &lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;set&lt;/span&gt;; }
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
  {
&lt;span style="color:blue"&gt;    &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query == &lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;);
    Query = query;
  }
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.
&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro thread on LINQPad forum&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;h5 style="color:black"&gt;QuerySpec&lt;/h5&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;span style="color:#0000ff"&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;h4&gt;Northwind (adapter)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter = &lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) 
{ 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory(); 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer 
            .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId) 
                             .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId) 
                             .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId)) 
            .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);

  adapter.FetchQuery(q).Dump(); 
}&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Sat, 01 Dec 2012 08:44:56 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20121201084456A</guid></item><item><title>Updated Wiki: LLBL4linqpad</title><link>https://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=104</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the &lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;
Official LINQPad driver for LLBLGen Pro v3.5&lt;/a&gt;, some of the differences are: it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;Doesn't require changes to the source code to show a SQL trace &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support Additional assemblies and namespaces via driver &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more likely to work I expect &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via &lt;span&gt;LINQPad drivers gallery (currently v2.2)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either: &lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;#160; &lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/84687"&gt;
version 3.1 and 3.5 Data Context Driver(V2.1)&lt;/a&gt;, &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;
version 3.0 and 3.1 Data Context Driver(V2.0)&lt;/a&gt; or &lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;
version 2.6 Data Context Driver(V1.1)&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV3.5.DataContextDriverV2.1.lpx, AW.LLBLGenV3.1.DataContextDriverV2.1.lpx,&amp;#160;
&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;#160; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266262"&gt;&lt;img title="image" border="0" alt="image" src="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266263" width="933" height="410" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;  &lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;enum&lt;/span&gt; DisplayInGrid
  {
    [Description(&lt;span style="color:#a31515"&gt;&amp;quot;Exclude EntityBase Properties&amp;quot;&lt;/span&gt;)]
    ExcludeEntityBaseProperties,
    [Description(&lt;span style="color:#a31515"&gt;&amp;quot;Default Linqpad behaviour&amp;quot;&lt;/span&gt;)]
    AllProperties,
    [Description(&lt;span style="color:#a31515"&gt;&amp;quot;Use the Editable Data Grid included with the driver rather than the LinqPad one&amp;quot;&lt;/span&gt;)]
    UseEditableGrid,
    [Description(&lt;span style="color:#a31515"&gt;&amp;quot;Use the Editable Data Grid with a page size of 10&amp;quot;&lt;/span&gt;)]
    UseEditableGridPaged
  }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266264"&gt;&lt;img title="image" border="0" alt="image" src="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266265" width="942" height="563" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; padding-top:0px; padding-left:0px; display:inline; padding-right:0px; border-top-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in third tab of the connection dialog shown above.
&lt;br&gt;
Unfortunately these assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, I investigated having them per connection but the additional assemblies and namespaces for the driver are set before the connection is loaded into the driver.
&lt;br&gt;
The additional assemblies can have relative or absolute paths. This an alternative to specifying them in each query.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;To view the SQL generated when a query is run in the SQL Translation Tab you must define an event called SQLTraceEvent in your data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery property Query. For example:&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs
{
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query { &lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;set&lt;/span&gt;; }
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
  {
&lt;span style="color:blue"&gt;    &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query == &lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;);
    Query = query;
  }
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.
&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro thread on LINQPad forum&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;h5 style="color:black"&gt;QuerySpec&lt;/h5&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;span style="color:#0000ff"&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;h4&gt;Northwind (adapter)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter = &lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) 
{ 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory(); 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer 
            .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId) 
                             .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId) 
                             .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId)) 
            .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);

  adapter.FetchQuery(q).Dump(); 
}&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Sat, 01 Dec 2012 08:40:46 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20121201084046A</guid></item><item><title>Updated Wiki: LLBL4linqpad</title><link>http://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=103</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the&amp;nbsp;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5&lt;/a&gt;, some of the&amp;nbsp;differences&amp;nbsp;are:
 it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column&amp;nbsp;names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;Doesn't require changes to the source code to show a&amp;nbsp;SQL trace &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support&amp;nbsp;DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support&amp;nbsp;Additional assemblies and namespaces via driver &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more&amp;nbsp;likely&amp;nbsp;to work I&amp;nbsp;expect &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via&amp;nbsp;&lt;span&gt;LINQPad drivers gallery (currently&amp;nbsp;v2.2)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either:&lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;nbsp;&lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro&amp;nbsp;&lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/84687"&gt;version 3.1 and 3.5 Data Context Driver(V2.1)&lt;/a&gt;,&amp;nbsp;&lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;version 3.0 and 3.1 Data Context
 Driver(V2.0)&lt;/a&gt;&amp;nbsp;or&amp;nbsp;&lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;version 2.6 Data Context Driver(V1.1)&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV3.5.DataContextDriverV2.1.lpx,&amp;nbsp;AW.LLBLGenV3.1.DataContextDriverV2.1.lpx,&amp;nbsp;&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;nbsp; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266262"&gt;&lt;img title="image" src="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266263" border="0" alt="image" width="933" height="410" style="padding-left:0px; padding-right:0px; display:inline; padding-top:0px; border-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;  &lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;enum&lt;/span&gt; DisplayInGrid
  {
    [Description(&lt;span style="color:#a31515"&gt;&amp;quot;Exclude EntityBase Properties&amp;quot;&lt;/span&gt;)]
    ExcludeEntityBaseProperties,
    [Description(&lt;span style="color:#a31515"&gt;&amp;quot;Default Linqpad behaviour&amp;quot;&lt;/span&gt;)]
    AllProperties,
    [Description(&lt;span style="color:#a31515"&gt;&amp;quot;Use the Editable Data Grid included with the driver rather than the LinqPad one&amp;quot;&lt;/span&gt;)]
    UseEditableGrid,
    [Description(&lt;span style="color:#a31515"&gt;&amp;quot;Use the Editable Data Grid with a page size of 10&amp;quot;&lt;/span&gt;)]
    UseEditableGridPaged
  }
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;div style="background-color:white; color:black"&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266264"&gt;&lt;img title="image" src="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266265" border="0" alt="image" width="942" height="563" style="padding-left:0px; padding-right:0px; display:inline; padding-top:0px; border-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;div style="background-color:white; color:black"&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in third tab of the connection dialog shown above.
&lt;br&gt;
Unfortunately these assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, I investigated having them per connection but the additional assemblies and namespaces for the driver are set before the connection is loaded into the driver.
&lt;br&gt;
The additional assemblies can have relative or absolute paths. This an alternative to specifying them in each query.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;To view the SQL generated when a query is run in the SQL Translation Tab you must define an event called SQLTraceEvent in your data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;div style="background-color:white; color:black"&gt;
&lt;pre&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery&amp;nbsp;property Query. For example:&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs
{
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query { &lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;set&lt;/span&gt;; }
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
  {
&lt;span style="color:blue"&gt;    &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query == &lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;);
    Query = query;
  }
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter&lt;/p&gt;
&lt;div style="background-color:white; color:black"&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="http://forums.oreilly.com/content/C-3-0-in-a-Nutshell/996/Linqpad-Support-For-Llbl"&gt;&lt;/a&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro&amp;nbsp;thread on&amp;nbsp;LINQPad
 forum&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;div style="background-color:white; color:black"&gt;
&lt;h5 style="color:black"&gt;QuerySpec&lt;/h5&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;span style="color:#0000ff"&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;h4&gt;Northwind (adapter)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;div style="background-color:white; color:black"&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter = &lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) 
{ 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory(); 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer 
            .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId) 
                             .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId) 
                             .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId)) 
            .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);

  adapter.FetchQuery(q).Dump(); 
}&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="background-color:white; color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Wed, 22 Aug 2012 11:21:09 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20120822112109A</guid></item><item><title>Updated Wiki: BookSourceCode</title><link>http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode&amp;version=17</link><description>&lt;div class="wikidoc"&gt;&lt;b&gt;There are six versions of the source code:&lt;/b&gt;
&lt;ol&gt;&lt;li&gt;&lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/16468"&gt;Original source code that came with the book&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/38670"&gt;Source code updated to LLBL Pro version 2.6&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;VS2008&lt;/b&gt; branch in the repository (Visual Studio 2008/LLBL v2.6)&lt;/li&gt;
&lt;li&gt;&lt;b&gt;VS2010&lt;/b&gt; branch in the repository (Visual Studio 2010/LLBL v3.0)&lt;/li&gt;
&lt;li&gt;&lt;b&gt;LLBL Pro v3.1&lt;/b&gt; branch in the repository (Visual Studio 2010/LLBL v3.1)&lt;/li&gt;
&lt;li&gt;&lt;b&gt;LLBL Pro v3.5&lt;/b&gt; branch in the repository (Visual Studio 2010/LLBL v3.5)&lt;/li&gt;&lt;/ol&gt;
The repository code is downloadable from the source code tab in a zip file but I recommend using &lt;a href="http://codeplex.codeplex.com/Wiki/View.aspx?title=Using%20TortoiseSVN%20with%20CodePlex"&gt;TortoiseSVN&lt;/a&gt; to get it, for instance use &lt;a href="https://rapiddevbookcode.svn.codeplex.com/svn/LLBL Pro v3.1"&gt;https://rapiddevbookcode.svn.codeplex.com/svn/LLBL Pro v3.1&lt;/a&gt; to get the LLBL Pro v3.1 branch only.&lt;br /&gt;&lt;table&gt;&lt;tr&gt;&lt;th&gt; Solutions files in LLBL Pro v3.1 branch &lt;/th&gt;&lt;th&gt; Contains projects needed for &lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; AW.sln &lt;/td&gt;&lt;td&gt; Joseph Chancellor’s worked example with tests &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; AW-NoTests.sln &lt;/td&gt;&lt;td&gt; Joseph Chancellor’s worked example &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; AW.LINQPad.sln &lt;/td&gt;&lt;td&gt; The &lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;referringTitle=BookSourceCode"&gt;LINQPad driver&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=LINQPadCustomVisualizer&amp;referringTitle=BookSourceCode"&gt;Custom Visualizer&lt;/a&gt; with tests &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; AW.DebugVisualizers.sln &lt;/td&gt;&lt;td&gt; &lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=EnumerableDebugVisualizer&amp;referringTitle=BookSourceCode"&gt;Enumerable Debugger Visualizer&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; AW.DebugVisualizersWithTests.sln &lt;/td&gt;&lt;td&gt; &lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=EnumerableDebugVisualizer&amp;referringTitle=BookSourceCode"&gt;Enumerable Debugger Visualizer&lt;/a&gt; with tests &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; AW with Everything.sln &lt;/td&gt;&lt;td&gt; Contains all the projects  &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;b&gt;How to use the book code&lt;/b&gt;
&lt;ol&gt;&lt;li&gt;Obtain a version of the source code&lt;/li&gt;
&lt;li&gt;Install the Adventure Works(2005) DB (if you don&amp;#39;t already have it see the related project).&lt;/li&gt;
&lt;li&gt;Edit the app.config to point to your Adventure Works DB.&lt;/li&gt;
&lt;li&gt;Build AW.sln or AW-NoTests.sln (if using Visual studio you might get errors about solution bindings - ignore them).&lt;/li&gt;
&lt;li&gt;Run.&lt;/li&gt;
&lt;li&gt;Optionally install the &lt;a href="http://www.llblgen.com/pages/demo.aspx"&gt;Llblgen Pro demo&lt;/a&gt; to modify the entity classes or to see the Llblgen project file&lt;/li&gt;&lt;/ol&gt;
&lt;b&gt;Differences between the current code and the original&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;Upgrade to &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; 2.6, 3.0, 3.1 and 3.5&lt;/li&gt;
&lt;li&gt;Validation has been completely reworked and is now specified using System.ComponentModel.DataAnnotations.&lt;/li&gt;
&lt;li&gt;Most of the queries have been moved to a query folder in AW.Data.&lt;/li&gt;
&lt;li&gt;Some disabled code has been enabled.&lt;/li&gt;
&lt;li&gt;Some refactoring.&lt;/li&gt;
&lt;li&gt;Added inheritance to the LLBL project and hence the domain model (VS2010, LLBL Pro v3.1 and LLBL Pro v3.5 Branches).&lt;/li&gt;&lt;/ul&gt;
&lt;b&gt;Additions to the original&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;LINQ versions of the queries added.&lt;/li&gt;
&lt;li&gt;A second order search form has been added which doesn&amp;#39;t use any fields from CustomerViewRelated.&lt;/li&gt;
&lt;li&gt;A form to edit the employee organization structure using a &lt;a href="http://www.codeproject.com/KB/tree/bindablehierarchicaltree.aspx"&gt;Databound TreeView control&lt;/a&gt; (FrmOrganizationStructure).&lt;/li&gt;
&lt;li&gt;A query runner (poor man&amp;#39;s version of &lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt;) &lt;a href="http://www.csscript.net"&gt;using the C# Script Engine&lt;/a&gt; (AW.Winforms.Helpers - FrmQueryRunner).&lt;/li&gt;
&lt;li&gt;A trace window to view the generated SQL (FrmTrace).&lt;/li&gt;
&lt;li&gt;Added all the other Adventure Works tables to the domain model(VS2010, LLBL Pro v3.1 and LLBL Pro v3.5 Branches only).&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=Notes&amp;referringTitle=BookSourceCode"&gt;Background&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Links&lt;/b&gt;&lt;br /&gt;&lt;a href="http://www.lulu.com/josephchancellor"&gt;http://www.lulu.com/josephchancellor&lt;/a&gt;&lt;br /&gt;&lt;a href="http://josephchancellor.wordpress.com"&gt;http://josephchancellor.wordpress.com&lt;/a&gt;&lt;br /&gt;&lt;a href="https://tfs.codeplex.com/tfs/services/v1.0/ServerStatus.asmx?op=CheckAuthentication"&gt;https://tfs.codeplex.com/tfs/services/v1.0/ServerStatus.asmx?op=CheckAuthentication&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Thanks to Joseph Chancellor for writing the book and making the code available for this project&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Wed, 08 Aug 2012 09:05:18 GMT</pubDate><guid isPermaLink="false">Updated Wiki: BookSourceCode 20120808090518A</guid></item><item><title>Updated Wiki: Documentation</title><link>http://rapiddevbookcode.codeplex.com/documentation?version=22</link><description>&lt;div class="wikidoc"&gt;
&lt;h2&gt;Project Description&lt;/h2&gt;
&lt;p&gt;The worked example in &lt;a href="http://www.lulu.com/josephchancellor"&gt;Joseph Chancellor&lt;/a&gt;&amp;rsquo;s book
&lt;a href="http://www.lulu.com/product/paperback/rapid-c%23-windows-development-visual-studio-2005-sql-server-2005-and-llblgen-pro/408111"&gt;
Rapid C# Windows Development&lt;/a&gt; which uses &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; to connect to the
&lt;a href="http://msftdbprodsamples.codeplex.com/"&gt;Adventure Works sample database&lt;/a&gt;.
&lt;br&gt;
It also contains an &lt;a href="/wikipage?title=EnumerableDebugVisualizer&amp;referringTitle=Documentation"&gt;
Enumerable Debugger Visualizer&lt;/a&gt;, some &lt;a href="/wikipage?title=LINQPad&amp;referringTitle=Documentation"&gt;
LINQPad Extensions and Tools&lt;/a&gt; and a few &lt;a href="/wikipage?title=Controls&amp;referringTitle=Documentation"&gt;
Controls&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://www.lulu.com/product/paperback/rapid-c%23-windows-development-visual-studio-2005-sql-server-2005-and-llblgen-pro/408111"&gt;
book&lt;/a&gt;, published in February 2006 about 'Quickly Build Robust, Database-Driven Applications', along with the code is a great introduction into performing common tasks in Database-Driven Applications, however it was written with version 1.X of
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; so I have updated it to work with the later versions (2.6, 3.0 and 3.1). At the same time I wanted to use this code as a starting point for evaluating LINQ To LLBLGen so I have converted all of the queries to
 use LINQ (but kept the originals for comparison). &lt;br&gt;
&lt;br&gt;
&lt;strong&gt;&lt;a href="wikipage?title=BookSourceCode&amp;referringTitle=Documentation"&gt;Book source code details&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;Additional controls and tools contained in this project&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&amp;nbsp;&lt;a href="wikipage?title=LINQPad&amp;referringTitle=Documentation"&gt;LINQPad Extensions and Tools&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/wikipage?title=LINQPadCustomVisualizer"&gt;Custom Visualizer&lt;/a&gt;&amp;nbsp;for editing and persisting the results of a LINQ query or any other Enumerable.
&lt;/li&gt;&lt;li&gt;Enumerable &lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=LINQPadDataEditor&amp;referringTitle=LINQPad"&gt;
DataEditor&lt;/a&gt; for editing and persisting the results of a LINQ query or any Enumerable.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LINQPad"&gt;HierarchyEditor&lt;/a&gt; for displaying and editing
&lt;a href="http://articles.sitepoint.com/article/hierarchical-data-database"&gt;Adjacency List&lt;/a&gt;(self referencing) data.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;referringTitle=LINQPad"&gt;Static LLBLGen Pro Data Context Driver&lt;/a&gt; to show
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; generated entities in the Schema Explorer.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=EntityDataBrowser&amp;referringTitle=LINQPad"&gt;Entity Data Browser&lt;/a&gt; to browse, view and edit
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; entities from a database. &lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="wikipage?title=EnumerableDebugVisualizer&amp;referringTitle=Documentation"&gt;Enumerable Debugger Visualizer&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="wikipage?title=ObjectInspector&amp;referringTitle=Documentation"&gt;Object Inspector&lt;/a&gt; for browsing the properties of an object and any objects it references.
&lt;/li&gt;&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="wikipage?title=Controls&amp;referringTitle=Documentation"&gt;Controls&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DataTreeView&lt;/strong&gt;. An enhanced version of a &lt;a href="http://www.codeproject.com/KB/tree/bindablehierarchicaltree.aspx"&gt;
Databound TreeView control&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;GridDataEditor&lt;/strong&gt;. A paged &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx"&gt;
DataGridView&lt;/a&gt; is a user control containing a &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx"&gt;
DataGridView&lt;/a&gt; and two &lt;a href="http://msdn.microsoft.com/en-us/library/b9y7cz6d.aspx"&gt;
BindingNavigator&lt;/a&gt;&amp;rsquo;s, one for the data and one for the pages. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;QueryRunner&lt;/strong&gt;. A query runner user control (poor man's version of
&lt;a href="http://www.linqpad.net"&gt;LINQPad&lt;/a&gt;). &lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;To do&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Finish the employee organization structure editor (FrmOrganizationStructure).
&lt;/li&gt;&lt;li&gt;Improve the paging in the &lt;a href="wikipage?title=LINQPadDataEditor&amp;referringTitle=Documentation"&gt;
LINQPad DataEditor&lt;/a&gt;. &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;br&gt;
&lt;a href="wikipage?title=Notes&amp;referringTitle=Documentation"&gt;Background&lt;/a&gt; &lt;br&gt;
&lt;a href="wikipage?title=Attributions&amp;referringTitle=Documentation"&gt;Acknowledgements, credits and attributions&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Links&lt;/h3&gt;
&lt;p&gt;&lt;a href="http://www.lulu.com/josephchancellor"&gt;http://www.lulu.com/josephchancellor&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://josephchancellor.wordpress.com"&gt;http://josephchancellor.wordpress.com&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://www.llblgen.com"&gt;http://www.llblgen.com&lt;/a&gt; &lt;br&gt;
&lt;a href="http://www.linqpad.net"&gt;http://www.linqpad.net&lt;/a&gt; &lt;br&gt;
&lt;br&gt;
Thanks to &lt;a href="http://www.lulu.com/josephchancellor"&gt;Joseph Chancellor&lt;/a&gt; for writing the book and making the code available for this project&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Wed, 08 Aug 2012 08:59:13 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Documentation 20120808085913A</guid></item><item><title>Updated Wiki: Documentation</title><link>http://rapiddevbookcode.codeplex.com/documentation?version=21</link><description>&lt;div class="wikidoc"&gt;
&lt;h2&gt;Project Description&lt;/h2&gt;
&lt;p&gt;The worked example in &lt;a href="http://www.lulu.com/josephchancellor"&gt;Joseph Chancellor&lt;/a&gt;&amp;rsquo;s book
&lt;a href="http://www.lulu.com/product/paperback/rapid-c%23-windows-development-visual-studio-2005-sql-server-2005-and-llblgen-pro/408111"&gt;
Rapid C# Windows Development&lt;/a&gt; which uses &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; to connect to the
&lt;a href="http://msftdbprodsamples.codeplex.com/"&gt;Adventure Works sample database&lt;/a&gt;.
&lt;br&gt;
It also contains an &lt;a href="/wikipage?title=EnumerableDebugVisualizer&amp;referringTitle=Documentation"&gt;
Enumerable Debugger Visualizer&lt;/a&gt;, some &lt;a href="/wikipage?title=LINQPad&amp;referringTitle=Documentation"&gt;
LINQPad Extensions and Tools&lt;/a&gt; and a few &lt;a href="/wikipage?title=Controls&amp;referringTitle=Documentation"&gt;
Controls&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://www.lulu.com/product/paperback/rapid-c%23-windows-development-visual-studio-2005-sql-server-2005-and-llblgen-pro/408111"&gt;
book&lt;/a&gt;, published in February 2006 about 'Quickly Build Robust, Database-Driven Applications', along with the code is a great introduction into performing common tasks in Database-Driven Applications, however it was written with version 1.X of
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; so I have updated it to work with the later versions (2.6, 3.0 and 3.1). At the same time I wanted to use this code as a starting point for evaluating LINQ To LLBLGen so I have converted all of the queries to
 use LINQ (but kept the originals for comparison). &lt;br&gt;
&lt;br&gt;
&lt;strong&gt;&lt;a href="wikipage?title=BookSourceCode&amp;referringTitle=Documentation"&gt;Book source code details&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;Additional controls and tools contained in this project&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&amp;nbsp;&lt;a href="wikipage?title=LINQPad&amp;referringTitle=Documentation"&gt;LINQPad Extensions and Tools&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/wikipage?title=LINQPadCustomVisualizer"&gt;Custom Visualizer&lt;/a&gt;&amp;nbsp;for editing and persisting the results of a LINQ query or any other Enumerable.
&lt;/li&gt;&lt;li&gt;Enumerable &lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=LINQPadDataEditor&amp;referringTitle=LINQPad"&gt;
DataEditor&lt;/a&gt; for editing and persisting the results of a LINQ query or any Enumerable.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LINQPad"&gt;HierarchyEditor&lt;/a&gt; for displaying and editing
&lt;a href="http://articles.sitepoint.com/article/hierarchical-data-database"&gt;Adjacency List&lt;/a&gt;(self referencing) data.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;referringTitle=LINQPad"&gt;Static LLBLGen Pro Data Context Driver&lt;/a&gt; to show
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; generated entities in the Schema Explorer.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=EntityDataBrowser&amp;referringTitle=LINQPad"&gt;Entity Data Browser&lt;/a&gt; to browse, view and edit
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; entities from a database. &lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="wikipage?title=EnumerableDebugVisualizer&amp;referringTitle=Documentation"&gt;Enumerable Debugger Visualizer&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="wikipage?title=ObjectInspector&amp;referringTitle=Documentation"&gt;Object Inspector&lt;/a&gt; for browsing the properties of an object and any objects it references.
&lt;/li&gt;&lt;li&gt;&lt;a href="wikipage?title=Controls&amp;referringTitle=Documentation"&gt;Controls&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&amp;nbsp;&lt;a href="wikipage?title=Controls&amp;referringTitle=Documentation"&gt;Controls&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DataTreeView&lt;/strong&gt;. An enhanced version of a &lt;a href="http://www.codeproject.com/KB/tree/bindablehierarchicaltree.aspx"&gt;
Databound TreeView control&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;GridDataEditor&lt;/strong&gt;. A paged &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx"&gt;
DataGridView&lt;/a&gt; is a user control containing a &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx"&gt;
DataGridView&lt;/a&gt; and two &lt;a href="http://msdn.microsoft.com/en-us/library/b9y7cz6d.aspx"&gt;
BindingNavigator&lt;/a&gt;&amp;rsquo;s, one for the data and one for the pages. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;QueryRunner&lt;/strong&gt;. A query runner user control (poor man's version of
&lt;a href="http://www.linqpad.net"&gt;LINQPad&lt;/a&gt;). &lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;To do&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Finish the employee organization structure editor (FrmOrganizationStructure).
&lt;/li&gt;&lt;li&gt;Improve the paging in the &lt;a href="wikipage?title=LINQPadDataEditor&amp;referringTitle=Documentation"&gt;
LINQPad DataEditor&lt;/a&gt;. &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;br&gt;
&lt;a href="wikipage?title=Notes&amp;referringTitle=Documentation"&gt;Background&lt;/a&gt; &lt;br&gt;
&lt;a href="wikipage?title=Attributions&amp;referringTitle=Documentation"&gt;Acknowledgements, credits and attributions&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Links&lt;/h3&gt;
&lt;p&gt;&lt;a href="http://www.lulu.com/josephchancellor"&gt;http://www.lulu.com/josephchancellor&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://josephchancellor.wordpress.com"&gt;http://josephchancellor.wordpress.com&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://www.llblgen.com"&gt;http://www.llblgen.com&lt;/a&gt; &lt;br&gt;
&lt;a href="http://www.linqpad.net"&gt;http://www.linqpad.net&lt;/a&gt; &lt;br&gt;
&lt;br&gt;
Thanks to &lt;a href="http://www.lulu.com/josephchancellor"&gt;Joseph Chancellor&lt;/a&gt; for writing the book and making the code available for this project&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Wed, 08 Aug 2012 08:58:17 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Documentation 20120808085817A</guid></item><item><title>Updated Wiki: Documentation</title><link>http://rapiddevbookcode.codeplex.com/documentation?version=20</link><description>&lt;div class="wikidoc"&gt;
&lt;h2&gt;Project Description&lt;/h2&gt;
&lt;p&gt;The worked example in &lt;a href="http://www.lulu.com/josephchancellor"&gt;Joseph Chancellor&lt;/a&gt;&amp;rsquo;s book
&lt;a href="http://www.lulu.com/product/paperback/rapid-c%23-windows-development-visual-studio-2005-sql-server-2005-and-llblgen-pro/408111"&gt;
Rapid C# Windows Development&lt;/a&gt; which uses &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; to connect to the
&lt;a href="http://msftdbprodsamples.codeplex.com/"&gt;Adventure Works sample database&lt;/a&gt;.
&lt;br&gt;
It also contains an &lt;a href="/wikipage?title=EnumerableDebugVisualizer&amp;referringTitle=Documentation"&gt;
Enumerable Debugger Visualizer&lt;/a&gt;, some &lt;a href="/wikipage?title=LINQPad&amp;referringTitle=Documentation"&gt;
LINQPad Extensions and Tools&lt;/a&gt; and a few &lt;a href="/wikipage?title=Controls&amp;referringTitle=Documentation"&gt;
Controls&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://www.lulu.com/product/paperback/rapid-c%23-windows-development-visual-studio-2005-sql-server-2005-and-llblgen-pro/408111"&gt;
book&lt;/a&gt;, published in February 2006 about 'Quickly Build Robust, Database-Driven Applications', along with the code is a great introduction into performing common tasks in Database-Driven Applications, however it was written with version 1.X of
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; so I have updated it to work with the later versions (2.6, 3.0 and 3.1). At the same time I wanted to use this code as a starting point for evaluating LINQ To LLBLGen so I have converted all of the queries to
 use LINQ (but kept the originals for comparison). &lt;br&gt;
&lt;br&gt;
&lt;strong&gt;&lt;a href="wikipage?title=BookSourceCode&amp;referringTitle=Documentation"&gt;Book source code details&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;Additional controls and tools contained in this project&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&amp;nbsp;&lt;a href="wikipage?title=LINQPad&amp;referringTitle=Documentation"&gt;LINQPad Extensions and Tools&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/wikipage?title=LINQPadCustomVisualizer"&gt;Custom Visualizer&lt;/a&gt;&amp;nbsp;for editing and persisting the results of a LINQ query or any other Enumerable.
&lt;/li&gt;&lt;li&gt;Enumerable &lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=LINQPadDataEditor&amp;referringTitle=LINQPad"&gt;
DataEditor&lt;/a&gt; for editing and persisting the results of a LINQ query or any Enumerable.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LINQPad"&gt;HierarchyEditor&lt;/a&gt; for displaying and editing
&lt;a href="http://articles.sitepoint.com/article/hierarchical-data-database"&gt;Adjacency List&lt;/a&gt;(self referencing) data.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;referringTitle=LINQPad"&gt;Static LLBLGen Pro Data Context Driver&lt;/a&gt; to show
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; generated entities in the Schema Explorer.
&lt;/li&gt;&lt;li&gt;&lt;a href="http://rapiddevbookcode.codeplex.com/wikipage?title=EntityDataBrowser&amp;referringTitle=LINQPad"&gt;Entity Data Browser&lt;/a&gt; to browse, view and edit
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; entities from a database. &lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="wikipage?title=EnumerableDebugVisualizer&amp;referringTitle=Documentation"&gt;Enumerable Debugger Visualizer&lt;/a&gt;.
&lt;/li&gt;&lt;li&gt;&lt;a href="wikipage?title=ObjectInspector&amp;referringTitle=Documentation"&gt;Object Inspector&lt;/a&gt; for browsing the properties of an object and any objects it references.
&lt;/li&gt;&lt;li&gt;&lt;a href="wikipage?title=Controls&amp;referringTitle=Documentation"&gt;Controls&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&amp;nbsp;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DataTreeView&lt;/strong&gt;. An enhanced version of a &lt;a href="http://www.codeproject.com/KB/tree/bindablehierarchicaltree.aspx"&gt;
Databound TreeView control&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;GridDataEditor&lt;/strong&gt;. A paged &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx"&gt;
DataGridView&lt;/a&gt; is a user control containing a &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx"&gt;
DataGridView&lt;/a&gt; and two &lt;a href="http://msdn.microsoft.com/en-us/library/b9y7cz6d.aspx"&gt;
BindingNavigator&lt;/a&gt;&amp;rsquo;s, one for the data and one for the pages. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;QueryRunner&lt;/strong&gt;. A query runner user control (poor man's version of
&lt;a href="http://www.linqpad.net"&gt;LINQPad&lt;/a&gt;). &lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;To do&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Finish the employee organization structure editor (FrmOrganizationStructure).
&lt;/li&gt;&lt;li&gt;Improve the paging in the &lt;a href="wikipage?title=LINQPadDataEditor&amp;referringTitle=Documentation"&gt;
LINQPad DataEditor&lt;/a&gt;. &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;br&gt;
&lt;a href="wikipage?title=Notes&amp;referringTitle=Documentation"&gt;Background&lt;/a&gt; &lt;br&gt;
&lt;a href="wikipage?title=Attributions&amp;referringTitle=Documentation"&gt;Acknowledgements, credits and attributions&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Links&lt;/h3&gt;
&lt;p&gt;&lt;a href="http://www.lulu.com/josephchancellor"&gt;http://www.lulu.com/josephchancellor&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://josephchancellor.wordpress.com"&gt;http://josephchancellor.wordpress.com&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://www.llblgen.com"&gt;http://www.llblgen.com&lt;/a&gt; &lt;br&gt;
&lt;a href="http://www.linqpad.net"&gt;http://www.linqpad.net&lt;/a&gt; &lt;br&gt;
&lt;br&gt;
Thanks to &lt;a href="http://www.lulu.com/josephchancellor"&gt;Joseph Chancellor&lt;/a&gt; for writing the book and making the code available for this project&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Wed, 08 Aug 2012 08:57:46 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Documentation 20120808085746A</guid></item><item><title>Updated Wiki: LLBL4linqpad</title><link>http://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad&amp;version=102</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;LLBLGen Pro Typed Data Context Driver for LINQPad&lt;/h1&gt;
&lt;p&gt;I have written a &lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; Typed Data Context Driver for
&lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; which provides first-class support for
&lt;a href="http://www.llblgen.com"&gt;LLBLGen Pro&lt;/a&gt; ILinqMetaData to enable, amongst other things, the generated entities to be shown in the Schema Explorer.&lt;/p&gt;
&lt;p&gt;Even if you are not using Linq you can still use LINQPad to run classic LLBL API or the newer QuerySpec queries by specifying the an IElementCreator rather than an ILinqMetaData type. (v2.x only).&lt;/p&gt;
&lt;p&gt;Solutions Design have produced the&amp;nbsp;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5&lt;/a&gt;, some of the&amp;nbsp;differences&amp;nbsp;are:
 it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Has a simpler connection dialog &lt;/li&gt;&lt;li&gt;Doesn't have the schema explorer tooltips mine has nor displays SQL column&amp;nbsp;names
&lt;/li&gt;&lt;li&gt;Doesn't fully support SQL execution &lt;/li&gt;&lt;li&gt;Doesn't require changes to the source code to show a&amp;nbsp;SQL trace &lt;/li&gt;&lt;li&gt;SQL trace is not executable &lt;/li&gt;&lt;li&gt;Doesn't support&amp;nbsp;DataAccessAdapter factories &lt;/li&gt;&lt;li&gt;Doesn't support&amp;nbsp;Additional assemblies and namespaces via driver &lt;/li&gt;&lt;li&gt;Is a single Assembly (mine is about 5) &lt;/li&gt;&lt;li&gt;Is more&amp;nbsp;likely&amp;nbsp;to work &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Binary via&amp;nbsp;&lt;span&gt;LINQPad drivers gallery&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run LINQPad &lt;/li&gt;&lt;li&gt;Click 'Add connection' &lt;/li&gt;&lt;li&gt;Click 'View more drivers' &lt;/li&gt;&lt;li&gt;In the 'LINQPad Supplementary Data Context Drivers' page select either:&lt;br&gt;
Download Alternative Driver for LLBLGen 3.5&amp;#43;&amp;nbsp;&lt;br&gt;
Download Alternative Driver for LLBLGen 3.1 &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Binary from file&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the LLBLGen Pro&amp;nbsp;&lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/84687"&gt;version 3.1 and 3.5 Data Context Driver(V2.1)&lt;/a&gt;,&amp;nbsp;&lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/71936"&gt;version 3.0 and 3.1 Data Context
 Driver(V2.0)&lt;/a&gt;&amp;nbsp;or&amp;nbsp;&lt;a href="http://rapiddevbookcode.codeplex.com/releases/view/48255"&gt;version 2.6 Data Context Driver(V1.1)&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Do steps 2-4 above &lt;/li&gt;&lt;li&gt;Browse to and select one of: AW.LLBLGenV3.5.DataContextDriverV2.1.lpx,&amp;nbsp;AW.LLBLGenV3.1.DataContextDriverV2.1.lpx,&amp;nbsp;&lt;br&gt;
AW.LLBLGenV3.1.DataContextDriverV2.0.lpx,&amp;nbsp; AW.LLBLGenV3.0.DataContextDriverV2.0.lpx or AW.LLBLGenV2.6.DataContextDriver.lpx
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a title="Get the source" href="http://rapiddevbookcode.codeplex.com/wikipage?title=BookSourceCode"&gt;Get the source&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Compile AW.LINQPad.sln or 'AW with Everything.sln' (you will probably need to fix the reference to LINQPad.exe)
&lt;/li&gt;&lt;li&gt;Run AW.LLBLGen.DataContextDriver\bin\Debug\DevDeploy.bat (or DevDeploy4.bat) &lt;/li&gt;&lt;li&gt;Then in LINQPad:
&lt;ol&gt;
&lt;li&gt;Click add connection &lt;/li&gt;&lt;li&gt;Select AW LLBL Driver, click next &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Example usage&lt;/h3&gt;
&lt;p&gt;In the connection dialog put in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;AW.Data.dll&lt;/em&gt; (with full path) &lt;/li&gt;&lt;li&gt;&lt;em&gt;AW.Data.Linq.LinqMetaData&lt;/em&gt; (type or click choose) &lt;/li&gt;&lt;li&gt;Either &lt;em&gt;AW.Win.exe.config&lt;/em&gt; or &lt;em&gt;data source=(local)\sqlexpress;initial catalog=AdventureWorks;integrated security=SSPI&lt;/em&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266262"&gt;&lt;img title="image" src="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266263" border="0" alt="image" width="933" height="410" style="padding-left:0px; padding-right:0px; display:inline; padding-top:0px; border-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;DataAccessAdapter factory&lt;/h3&gt;
&lt;p&gt;There is an alternative way of creating the adapter and that is to have a static DataAccessAdapter factory method with this signature:&lt;/p&gt;
&lt;div style="background-color:white; color:black"&gt;
&lt;pre&gt;Func&amp;lt;string, IDataAccessAdapter&amp;gt; &lt;br&gt;&lt;span style="font-family:calibri"&gt;e.g.&lt;/span&gt; public static DataAccessAdapterBase CreateDataAccessAdapter(string connectionString)&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This allows you to have custom code executed when the adapter is created and maybe select the appropriate adapter based on the connection string (or whatever data the string parameter has). The assembly, type and method name must be supplied.&lt;/p&gt;
&lt;h3&gt;Default connection properties&lt;/h3&gt;
&lt;p&gt;If you want to have a lot of connections with similar properties you can specify defaults to populate new connections. These can set by either the 'save as default' button in the first tab of the connection dialog or by editing them directly in the third
 tab shown below. This allows you to easily clone a connection say if you want to have the same code connected to multiple databases.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266264"&gt;&lt;img title="image" src="http://download.codeplex.com/download?ProjectName=RapidDevBookCode&amp;DownloadId=266265" border="0" alt="image" width="942" height="563" style="padding-left:0px; padding-right:0px; display:inline; padding-top:0px; border-width:0px"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Additional assemblies and namespaces&lt;/h3&gt;
&lt;p&gt;The driver adds these namespaces and assemblies to the ones LINQPad provides&lt;/p&gt;
&lt;div style="background-color:white; color:black"&gt;
&lt;pre&gt;&lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SD.LLBLGen.Pro.LinqSupportClasses&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Helper&amp;quot;&lt;/span&gt;, &lt;br&gt;&lt;span class="str"&gt;&amp;quot;AW.Helper.LLBL&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.DataEditor&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;AW.Winforms.Helpers.LLBL&amp;quot;, &amp;quot;AW.LinqPadExtensions&amp;quot;, &lt;br&gt;&amp;quot;AW.LLBLGen.DataContextDriver&amp;quot;, &lt;/span&gt;&amp;quot;AW.LLBLGen.DataContextDriver.Static&amp;quot;&lt;/pre&gt;
&lt;pre&gt;&amp;quot;SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll&amp;quot;, &amp;quot;SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll&amp;quot;,
&amp;quot;AW.Helper.dll&amp;quot;, &amp;quot;AW.Helper.LLBL.dll&amp;quot;, &amp;quot;System.Windows.Forms.dll&amp;quot;,&amp;quot;AW.Winforms.Helpers.dll&amp;quot;, &lt;br&gt;&amp;quot;AW.Winforms.Helpers.LLBL.dll&amp;quot;, &amp;quot;AW.LinqPadExtensions.dll&amp;quot;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;If you want to have additional assemblies and namespaces used in the queries against your typed data context (ILinqMetaData) these can be specified in third tab of the connection dialog shown above.
&lt;br&gt;
Unfortunately these assemblies and namespaces are global to the AW.LLBLGen.DataContextDriver, I investigated having them per connection but the additional assemblies and namespaces for the driver are set before the connection is loaded into the driver.
&lt;br&gt;
The additional assemblies can have relative or absolute paths. This an alternative to specifying them in each query.&lt;/p&gt;
&lt;h3&gt;SQL Translation Tab&lt;/h3&gt;
&lt;p&gt;To view the SQL generated when a query is run in the SQL Translation Tab you must define an event called SQLTraceEvent in your data adapters or, if using LLBL 3.x selfservicing, a static event of that name in the CommonDaoBase class, e.g&lt;/p&gt;
&lt;div style="background-color:white; color:black"&gt;
&lt;pre&gt;public static event EventHandler&lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;SQLTraceEventArgs&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;&lt;/span&gt; SQLTraceEvent;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;where SQLTraceEventArgs is a descendent of EventArgs and has a public SD.LLBLGen.Pro.ORMSupportClasses.IQuery&amp;nbsp;property Query. For example:&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;class&lt;/span&gt; SQLTraceEventArgs : EventArgs
{
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; IQuery Query { &lt;span style="color:blue"&gt;get&lt;/span&gt;; &lt;span style="color:blue"&gt;private&lt;/span&gt; &lt;span style="color:blue"&gt;set&lt;/span&gt;; }
&lt;span style="color:blue"&gt;  &lt;/span&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; SQLTraceEventArgs(IQuery query)
  {
&lt;span style="color:blue"&gt;    &lt;/span&gt;&lt;span style="color:blue"&gt;if&lt;/span&gt; (query == &lt;span style="color:blue"&gt;null&lt;/span&gt;) &lt;span style="color:blue"&gt;throw&lt;/span&gt; &lt;span style="color:blue"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#a31515"&gt;&amp;quot;query&amp;quot;&lt;/span&gt;);
    Query = query;
  }
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;See &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/96802#1678263"&gt;
SQLTraceEventArgs.cs&lt;/a&gt; and &lt;a href="http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733"&gt;
CommonDaoBase.Extended.cs&lt;/a&gt; in the LLBL Pro v3.1 branch for an example of how to do this.
&lt;br&gt;
For selfservicing the SQL trace only works for entity queries but not projections.&lt;br&gt;
&lt;br&gt;
For Adapter you could add references to AW.Helper.dll and AW.Helper.LLBL.dll and then put this in your DataAccessAdapter&lt;/p&gt;
&lt;div style="background-color:white; color:black"&gt;
&lt;pre&gt;&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode&lt;/span&gt;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Event which is raised whenever a query is executed. Use this event to perform SQL tracing. &lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;event&lt;/span&gt; EventHandler&amp;lt;SQLTraceEventArgs&amp;gt; SQLTraceEvent;

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; Called whenever a query is executed.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;query&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The query.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; OnExecuteQuery(IQuery query)
{
&lt;span style="color:blue"&gt;  if&lt;/span&gt; (SQLTraceEvent != &lt;span style="color:blue"&gt;null&lt;/span&gt;) 
    SQLTraceEvent(&lt;span style="color:blue"&gt;this&lt;/span&gt;, &lt;span style="color:blue"&gt;new&lt;/span&gt; SQLTraceEventArgs(query));
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Executes the passed in action query and, if not null, runs it inside the passed in transaction.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;queryToExecute&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ActionQuery to execute.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;execution result, which is the amount of rows affected (if applicable)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; &lt;span style="color:blue"&gt;int&lt;/span&gt; ExecuteActionQuery(IActionQuery queryToExecute)
{
  OnExecuteQuery(queryToExecute);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; &lt;span style="color:blue"&gt;base&lt;/span&gt;.ExecuteActionQuery(queryToExecute);
}

&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt; 	Creates a new Select DQ for the fields passed in using the parameters specified.&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;fieldsToFetch&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;fields to fetch using the select&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;persistenceInfoObjects&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;persistence info objects for the fields&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;filter&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;filter to use for the where clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;maxNumberOfItemsToReturn&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;max. amount of rows to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;sortClauses&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;sort clause specifications to use&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;relationsToWalk&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;relations to walk to build the FROM clause&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;allowDuplicates&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;flag to specify if duplicates should be returned&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;groupByClause&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;group by clause to embed in the query&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageNumber&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;The page number to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name = &amp;quot;pageSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;the page size to retrieve&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green"&gt;ready to use query to use.&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue"&gt;protected&lt;/span&gt; &lt;span style="color:blue"&gt;override&lt;/span&gt; IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
	IPredicateExpression filter, &lt;span style="color:blue"&gt;long&lt;/span&gt; maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; allowDuplicates, IGroupByCollection groupByClause, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageNumber, &lt;span style="color:blue"&gt;int&lt;/span&gt; pageSize)
{
&lt;span style="color:blue"&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;var&lt;/span&gt; query = &lt;span style="color:blue"&gt;base&lt;/span&gt;.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
  allowDuplicates, groupByClause, pageNumber, pageSize);
  OnExecuteQuery(query);
&lt;span style="color:blue"&gt;  return&lt;/span&gt; query;
}

&lt;span style="color:green"&gt;// __LLBLGENPRO_USER_CODE_REGION_END&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The driver also includes &lt;a href="/wikipage?title=LINQPadDataEditor&amp;referringTitle=LLBL4linqpad"&gt;
this DataEditor&lt;/a&gt;, &lt;a href="/wikipage?title=LINQPadHierarchyEditor&amp;referringTitle=LLBL4linqpad"&gt;
this HierarchyEditor&lt;/a&gt; and &lt;a href="/wikipage?title=EntityDataBrowser&amp;referringTitle=LLBL4linqpad"&gt;
this Entity Data Browser.&lt;/a&gt;, the appropriate assemblies and namespaces are automatically included.&lt;/p&gt;
&lt;h3&gt;Related links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design" href="http://llblgenlinqpad.codeplex.com/" target="_blank"&gt;Official LINQPad driver for LLBLGen Pro v3.5 from Solutions Design&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LINQPad thread on the LLBLGen Pro forum.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="http://forums.oreilly.com/content/C-3-0-in-a-Nutshell/996/Linqpad-Support-For-Llbl"&gt;&lt;/a&gt;&lt;a title="LLBL Forum about LinqPad for Linq to LLBL" href="http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15083"&gt;LLBLGen Pro&amp;nbsp;thread on&amp;nbsp;LINQPad
 forum&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.linqpad.net/Extensibility.aspx"&gt;LINQPad Data Context Extensibility Model&lt;/a&gt; which offers first-class support in LINQPad for querying other data sources.
&lt;/li&gt;&lt;li&gt;The .linq files in the SampleQueryFiles folder. &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Example Non Linq LLBL queries (Language C# Statement):&lt;/h3&gt;
&lt;h4&gt;AdventureWorks (selfservicing)&lt;/h4&gt;
&lt;div style="background-color:white; color:black"&gt;
&lt;h5 style="color:black"&gt;QuerySpec&lt;/h5&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.FactoryClasses.QueryFactory(); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Address.Where(AddressFields.AddressID == 3); 
&lt;span style="color:blue"&gt;var&lt;/span&gt; addresses = &lt;span style="color:blue"&gt;new&lt;/span&gt; AddressCollection(); 
addresses.GetMulti(q); 
addresses.Dump();&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;span style="color:#0000ff"&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; soh = &lt;span style="color:blue"&gt;new&lt;/span&gt; AW.Data.EntityClasses.SalesOrderHeaderEntity (43659);&lt;br&gt;soh.GetMultiSalesOrderDetails(&lt;span style="color:blue"&gt;false&lt;/span&gt;).Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;h4&gt;Northwind (adapter)&lt;/h4&gt;
&lt;h5&gt;QuerySpec&lt;/h5&gt;
&lt;div style="background-color:white; color:black"&gt;
&lt;pre style="color:black"&gt;&lt;span style="color:blue"&gt;using&lt;/span&gt; (&lt;span style="color:blue"&gt;var&lt;/span&gt; adapter = &lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse) 
{ 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; qf = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.FactoryClasses.QueryFactory(); 
  &lt;span style="color:blue"&gt;var&lt;/span&gt; q = qf.Customer 
            .From(QueryTarget.InnerJoin(CustomerEntity.Relations.OrderEntityUsingCustomerId) 
                             .InnerJoin(OrderEntity.Relations.OrderDetailEntityUsingOrderId) 
                             .InnerJoin(OrderDetailEntity.Relations.ProductEntityUsingProductId)) 
            .Where(Northwind.DAL.HelperClasses.ProductFields.ProductId == 1);

  adapter.FetchQuery(q).Dump(); 
}&lt;/pre&gt;
&lt;h5&gt;LLBL Classic Query API&lt;/h5&gt;
&lt;div style="background-color:white; color:black"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; product = &lt;span style="color:blue"&gt;new&lt;/span&gt; Northwind.DAL.EntityClasses.ProductEntity(10);
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse.FetchEntityCollection(product.OrderDetails, product.GetRelationInfoOrderDetails()); 
product.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;h6&gt;Authorization example where 'this' is an IElementCreator rather than an ILinqMetaData&lt;/h6&gt;
&lt;div style="color:black"&gt;
&lt;pre&gt;SD.LLBLGen.Pro.Examples.Authorization.Identity.LoginHelper.Login(&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;,&lt;span style="color:#a31515"&gt;&amp;quot;cr1&amp;quot;&lt;/span&gt;);
&lt;span style="color:blue"&gt;var&lt;/span&gt; order = &lt;span style="color:blue"&gt;new&lt;/span&gt; SD.LLBLGen.Pro.Examples.Authorization.EntityClasses.OrdersEntity(10248);
LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;).FetchEntityCollection(order.OrderDetails, order.GetRelationInfoOrderDetails());
order.OrderDetails.Dump();&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note: For IElementCreator LLBLGenStaticDriver.GetAdapter(&lt;span style="color:blue"&gt;this&lt;/span&gt;) has to be used instead of
&lt;span style="color:blue"&gt;this&lt;/span&gt;.AdapterToUse&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>JezzaT</author><pubDate>Mon, 30 Apr 2012 23:29:42 GMT</pubDate><guid isPermaLink="false">Updated Wiki: LLBL4linqpad 20120430112942P</guid></item></channel></rss>