Forum:  LLBLGen Pro Runtime Framework

Thread:  LinqPad for Linq to LLBL


omar (User)   Posted on: 13-Jan-2009 21:03:16.
LinqPad is proving to be a very useful tool for learning LINQ and also proofing a LINQ query before using it in code.

I was wondering if anyone has tried (or knows how) to add support for LLBL's Linq provider to LinqPad?
MTrinder (User)   Posted on: 13-Jan-2009 22:31:40.
At the moment we don't think it will be an easy thing to do, as the LinqToLLBLGenPro code needs to be generated by LLBLGen before it can be used.

It may be worth contacting the maintainer of LinqPad to see what he thinks ?

Matt


mihies (User)   Posted on: 04-Feb-2009 10:37:38.
omar wrote:
LinqPad is proving to be a very useful tool for learning LINQ and also proofing a LINQ query before using it in code.

I was wondering if anyone has tried (or knows how) to add support for LLBL's Linq provider to LinqPad?


I started a similar project a while ago. Due to time restrictions it is in a half-done state
http://cs.rthand.com/blogs/blog_with_righthand/archive/2008/10/20/Providing-syntax-editor-within-a-.net-application.aspx
If there is enough interest I might consider finishing it.
omar (User)   Posted on: 04-Feb-2009 21:17:51.
Looks very promising. Count me in as an early tester

TomDog (User)   Posted on: 06-Aug-2009 10:52:10.
I've started using LINQPad with LLBL; works well though I had to jump through a few hoops, see this thread that I assume you started Omar: http://forums.oreilly.com/content/C-3-0-in-a-Nutshell/996/Linqpad-Support-For-Llbl/

Of course LINQPad is handy for a lot of more than just LINQ.

It's a pity mihies 'Righthand's LLBLGenPro Query Studio' never got released.
MTrinder (User)   Posted on: 06-Aug-2009 22:22:04.
Thanks for the update.

Matt


WayneBrantley (User)   Posted on: 07-Aug-2009 08:47:51.
Wow..that was a pain, BUT I finally have it WORKING complete with intellisense.
Very, very cool... CoolCool

mihies (User)   Posted on: 07-Aug-2009 11:33:52.
TomDog wrote:
I've started using LINQPad with LLBL; works well though I had to jump through a few hoops, see this thread that I assume you started Omar: http://forums.oreilly.com/content/C-3-0-in-a-Nutshell/996/Linqpad-Support-For-Llbl/

Of course LINQPad is handy for a lot of more than just LINQ.

It's a pity mihies 'Righthand's LLBLGenPro Query Studio' never got released.


Yep, time is not on my side lately nor is public interest. It isn't scratched though.


TomDog (User)   Posted on: 18-Dec-2009 11:03:38.
mihies wrote:
Yep, time is not on my side lately nor is public interest. It isn't scratched though.
Strange the lack of interest, I find LINQPad really handy, so much so I've created a LINQPad DataEditor and thanks to this new enhancement: LINQPad Data Context Extensibility Model there will be first-class support in LINQPad for LLBL as soon as someone writes a driver. Which I might have a go at... unless someone else is already going to - Frans???
Otis (LLBLGen Pro Team)   Posted on: 18-Dec-2009 14:17:13.
It's on my list to do this month, but v3 stuff has top priority at the moment so it's left for spare time coding. It shouldn't be too hard to fill in the blanks, I already had some discussions with Joe about this. Regular Smiley

If you have some spare time and want to have a go at it, by all means do Regular Smiley, though don't feel obligated to do this in any way, we'll get to it as soon as time permits.

If you need info from me, please let me know either in this thread or through email to support AT llblgen DOT com. Regular Smiley


mohamed (User)   Posted on: 18-Dec-2009 20:12:56.
I have found Linqer (http://www.sqltolinq.com/) extremely useful. It converts my SQL queries into LinqToSQL or LinqToEntitites (depending on my choice of data link mapping files I generate from VS.NET).

Imagine writing your SQL query and then asking Linqer (or some other software) to covert it to LinqToLLBL. Now thats a true time saver.

This is something I am currently experiencing first-hand in the current project. Writing complex LINQ queries is a breeze as I write my SQL queries and convert them to LinqToSQL and they would mostly work with no change for LinqToLLBL.
Otis (LLBLGen Pro Team)   Posted on: 21-Dec-2009 10:42:22.
Good tip! Never heard of the tool but it seems useful Regular Smiley

TomDog (User)   Posted on: 24-Dec-2009 02:18:40.
Otis wrote:
It's on my list to do this month, but v3 stuff has top priority at the moment so it's left for spare time coding.
If you have some spare time and want to have a go at it, by all means do Regular Smiley, though don't feel obligated to do this in any way, we'll get to it as soon as time permits.
Good to here it’s on its wayLaugh I’m not back at work from my Christmas break till the 11th so I guess I can wait till then.
Having said that I have made a small start on a static LLBL Data Context Driver if anyone wants to try it out. It populates the tree with what I want – though crashes LINQPad when using one of the context menu’s.
If I spend anytime coding I might put my efforts into making my DataEditor pageable instead.

I saw Linqer but our LLBL project mappings are to different from what it would generate for it to be much use I think, Shame, though I think in LINQ now there are others in my team who still think SQL first so might find it handy.

Anyway Merry Xmas all.
TomDog (User)   Posted on: 15-May-2010 14:14:07.
Otis wrote:
It's on my list to do this month, but v3 stuff has top priority at the moment so it's left for spare time coding. It shouldn't be too hard to fill in the blanks, I already had some discussions with Joe about this. Regular Smiley

If you have some spare time and want to have a go at it, by all means do Regular Smiley, though don't feel obligated to do this in any way, we'll get to it as soon as time permits.

I take it time hasn't been permitting for you Dissapointed but it has for me Regular Smiley - I've just released Version 1.0 of a Static LLBLGen Pro Data Context Driver for LINQPad. Give it a whirl.


Otis (LLBLGen Pro Team)   Posted on: 16-May-2010 10:30:31.
Awesome!! Laugh I'll give it a try first thing on monday! Regular Smiley great work!
JRR (User)   Posted on: 16-May-2010 17:49:13.
Just a quick question here - do you still get the sql output for the query - as Linqpad usually does?


My current practice is to create a Linqpad.config file that turns on llblgen tracing, and then I set the connection information in the code block itself. Then I can test out my llblgen queries using the adapter I just created.

But this method sounds way better. Cool


JRR (User)   Posted on: 16-May-2010 19:49:59.
JRR wrote:
Just a quick question here - do you still get the sql output for the query - as Linqpad usually does?


Just to answer my own question, you have to turn tracing on in your .config file specified to linqpad in order to see the sql generated by your linq query.

The llblgen trace sql will appear in the output pane, and there is no sql in the specific 'sql' pane.

(unless I missed something, that is)

Great work nonetheless! Cool
Otis (LLBLGen Pro Team)   Posted on: 17-May-2010 09:57:19.
I tried it with adapter, but I keep getting the No DataAccessAdapter instance set on LLBLGenProProvider2 instance. Can't execute query
error. The 'browse' on the dataaccessadapter assembly in the connection dialog says 'no public types found' error. I tried with v2.x and v3.0 assemblies. I think I miss a setting, e.g. where to specify the ormsupportclasses/linq assembly ref.

When I use selfservicing, I get 'connection string not initialized'... I feel like an uber n00b Wink


TomDog (User)   Posted on: 17-May-2010 10:50:22.
Otis wrote:
I tried it with adapter, but I keep getting the No DataAccessAdapter instance set on LLBLGenProProvider2 instance. Can't execute query
error. The 'browse' on the dataaccessadapter assembly in the connection dialog says 'no public types found' error. I tried with v2.x and v3.0 assemblies. I think I miss a setting, e.g. where to specify the ormsupportclasses/linq assembly ref.

When I use selfservicing, I get 'connection string not initialized'... I feel like an uber n00b Wink
Ha- shoe is on the other footRegular Smiley
Bummer looks like I will need to test it on more machines - I did find a lot of intermittant failure with assembly references.

I got the 'public types found' error on one or two occasions - then it went away without me doing very much at all.

Things to try:
Try it with both LINQPad 2 and 4 - sometimes that was enough to sort things out.
If that doesn't work you'll have to use the source and run AW.LLBLGen.DataContextDriver.csproj with C:\Program Files\LINQPad\LINQPad.exe(or whereever) as a start action.

The 2.6 assemblies are included in the driver.
TomDog (User)   Posted on: 26-May-2010 11:11:20.
Otis wrote:
I tried it with adapter, but I keep getting the No DataAccessAdapter instance set on LLBLGenProProvider2 instance. Can't execute query error. The 'browse' on the dataaccessadapter assembly in the connection dialog says 'no public types found' error.
When I use selfservicing, I get 'connection string not initialized'.
Ok I think I've fixed those problems in version 1.0.0.3 of my Static LLBLGen Pro Data Context Drivers for LINQPad - now there is a driver for version 3.0 as well as v2.6.


Otis (LLBLGen Pro Team)   Posted on: 26-May-2010 13:32:03.
Awesome! Regular Smiley We're in the final stages of pushing for RTM, so it will be next week till we have time to look at it, but nevertheless great work Regular Smiley
MarcoP (User)   Posted on: 03-Jun-2010 21:32:21.
Im new to linq pad, but i added the LLBL driver and I can see the results when executing a linq expression, but how do i see the sql generated from behind the scenes?

JRR (User)   Posted on: 03-Jun-2010 21:39:03.
Hi Marco,

I was able to get that working by turning on the LLBLGen DQE tracing in the app.config file linqpad uses.
MarcoP (User)   Posted on: 03-Jun-2010 22:14:46.
Hmm, I just tried adding the config section to linqpad.exe.config but no luck. can you paste in what you are specifying?

JRR (User)   Posted on: 03-Jun-2010 23:36:17.
Here's what worked for me:

1) Set app.config on the "Query Properties" form:




Then, just make sure your app.config file includes the diagnostic switch like this:

Code:

<?xml version="1.0"?>
<configuration>
    <appSettings>
        <add key="DBConn" value="data source=(local)\sqlexpress;initial catalog=xx;integrated security=SSPI;persist security info=False;packet size=4096"/>
    </appSettings>
    <system.diagnostics>
    <switches>
        <add name="SqlServerDQE" value="4" />
    </switches>
</system.diagnostics>
</configuration>


Now you should get the trace output above the actual query resuts. The sql does not show up in the sql tab, but if you are ok with that, this should do the trick.
MarcoP (User)   Posted on: 04-Jun-2010 02:49:01.
thanks!

Joe Albahari (User)   Posted on: 06-Jun-2010 15:10:50.
If you want the driver to populate LINQPad's SQL translation tab, you can do so by writing to Util.SqlOutputWriter. You can hook this up in the InitializeContext method.

Cheers

Joe
TomDog (User)   Posted on: 07-Jun-2010 13:51:48.
Joe Albahari wrote:
If you want the driver to populate LINQPad's SQL translation tab, you can do so by writing to Util.SqlOutputWriter. You can hook this up in the InitializeContext method.

As it happens I have just committed my first attempt at this here:
http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1095380, it works but trying to use a lambda event handler like you suggest in your documentation
Code:
EventHandler<EventArgs> handler = (sender, e) =>...
always gave me a 'Error binding to target method' exception, so I ended up just having a normal event handler method on the driver and assigning the executionManager to a field on the driver.

Joe - any idea how how to get the lambda event handler to work?


Joe Albahari (User)   Posted on: 07-Jun-2010 17:42:00.
Not quite sure if this answers you question, but you don't have to use reflection to access LLBLGen types. You can statically bind to LLBLGen's assemblies because the AssemblyVersion doesn't change between LLBLGEN updates. Hence you can use ordinary event handlers and access properties and methods directly.

Joe
TomDog (User)   Posted on: 07-Jun-2010 23:10:36.
Joe Albahari wrote:
Not quite sure if this answers you question, but you don't have to use reflection to access LLBLGen types. You can statically bind to LLBLGen's assemblies because the AssemblyVersion doesn't change between LLBLGEN updates. Hence you can use ordinary event handlers and access properties and methods directly.

SQLTraceEvent isn't a LLBLGen defined event, it's one that will have be added to every one's DAL code to enable SQL Translation Tab population. See http://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad
a lambda event handler works when I tried it in frmTrace.cs but not in the driver. Method attributes seem to be different.


TomDog (User)   Posted on: 05-Jul-2010 13:23:29.
I've released a new version of my LLBLGen LINQPad Data Context Driver (v1.1)
Main new feature is the SQL trace showing in the SQL Translation Tab (if you jump through a few hoops in your own code).
carni4 (User)   Posted on: 10-Aug-2010 16:04:58.
I'm getting the following error message with LinqPad4:

FileNotFoundException: Could not load file or assembly 'SD.LLBLGen.Pro.DQE.SqlServer.NET20, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27' or one of its dependencies. The system cannot find the file specified.

Any ideas on how to fix it? I tried launching LINQPad.exe from the directory containing that dll and it didn't help.

I also tried LinqPad v2.21 and got the following message:

Could not load file or assembly 'LINQPad, Version=1.0.0.0, Culture=neutral, PublicKeyToken=21353812cd2a2db5' or one of its dependencies. The system cannot find the file specified.

Any advice is much appreciated!


Joe Albahari (User)   Posted on: 10-Aug-2010 16:13:08.
carni4 wrote:
I'm getting the following error message with LinqPad4:

FileNotFoundException: Could not load file or assembly 'SD.LLBLGen.Pro.DQE.SqlServer.NET20, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27' or one of its dependencies. The system cannot find the file specified.

Any ideas on how to fix it? I tried launching LINQPad.exe from the directory containing that dll and it didn't help.

I also tried LinqPad v2.21 and got the following message:

Could not load file or assembly 'LINQPad, Version=1.0.0.0, Culture=neutral, PublicKeyToken=21353812cd2a2db5' or one of its dependencies. The system cannot find the file specified.

Any advice is much appreciated!


Do you get the same result with the latest beta build?
http://www.linqpad.net/beta.aspx
carni4 (User)   Posted on: 10-Aug-2010 17:11:12.
Update: It must have something to do with the fact that I have the very latest build of LLBLGen (from August 5th, 2010) because, after following the instructions at

http://rapiddevbookcode.codeplex.com/wikipage?title=LLBL4linqpad

to build from source--modifying the paths in the DevDeploy.bat file(s) because I am on Windows 7--I was able to get it working. However, at the moment only v2.21 is working. I am getting an error with LinqPad4 that it can't load "System.Design".

Thank you for your reply Joe. I tried again with beta 4.24 and I get the "System.Design" error message. I have attached a word document containing the error details for your review. However, I am satisfied at the moment because v2.21 is working just fine.

By the way, I'm not sure if this is important or not, but I do not have Visual Studio 2010 installed on this machine. (I edited TomDog's Visual Studio 2010 sln file to get it to open in 2008.) However, like I said I am on Windows 7 and according to the registry (HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP) version 4.0.30319 of the .NET framework is installed.


Otis (LLBLGen Pro Team)   Posted on: 10-Aug-2010 17:28:46.
It could be related to .NET 4.0 client profile vs. .NET 4.0 full framework profile (so you might have installed the .net 4.0 client profile framework which is a stripped down .net 4.0 which doesn't contain the design and web assemblies for example.) Our runtime currently requires .net 4.0 full framework as we haven't created a .net 4.0 build with separate assemblies for design and web specific stuff (as in the past this wasn't an issue, all assemblies were always there)
carni4 (User)   Posted on: 10-Aug-2010 17:41:26.
Otis wrote:
It could be related to .NET 4.0 client profile vs. .NET 4.0 full framework profile (so you might have installed the .net 4.0 client profile framework which is a stripped down .net 4.0 which doesn't contain the design and web assemblies for example.) Our runtime currently requires .net 4.0 full framework as we haven't created a .net 4.0 build with separate assemblies for design and web specific stuff (as in the past this wasn't an issue, all assemblies were always there)


Good call. That was it! I installed the .NET framework 4.0 Full and LINQPad v4.24 works now. (Again, using what I built from TomDog's source. I haven't retried the downloadable lpx.)

Thanks for the help!


TomDog (User)   Posted on: 28-Sep-2010 11:31:01.
Joe - if you reading this - Drag and drop from the Schema Explorer to query windows doesn't work with your DataContextDriverDemo and hence neither for my LLBL driver. How do I enable this?

Regards Jeremy
TomDog (User)   Posted on: 17-Dec-2010 12:18:36.
Just in time for xmas I've released version 1.2 of my LLBLGen LINQPad Data Context Driver for LLBL 3.0.
The one new feature is the Entity Data Browser.

There is also a new release (v1.3 for VS2010) of my Enumerable Debugger Visualizer.





WayneBrantley (User)   Posted on: 17-Dec-2010 17:58:38.
TomDog - Thanks for this update.
I have installed it.

How do I get the Entity Data Browser to come up?

I typed this.BrowseData() from about everywhere I can find. Not sure what 'this' is supposed to be.

If I open up a c# expression and type it - intellisense comes up - it is supposed to take a parameter? Providing it with a parameter makes it say 'no overload for BrowseData' takes 1 argument.

I can call ShowSelfServicingInGrid() from a linq query and from there can click 'view in object browser'

Probably a silly question, but I just cannot get it to start!
TomDog (User)   Posted on: 17-Dec-2010 18:56:28.
WayneBrantley wrote:
TomDog - Thanks for this update.
I have installed it.

How do I get the Entity Data Browser to come up?

I typed this.BrowseData() from about everywhere I can find. Not sure what 'this' is supposed to be.

If I open up a c# expression and type it - intellisense comes up - it is supposed to take a parameter? Providing it with a parameter makes it say 'no overload for BrowseData' takes 1 argument.

I can call ShowSelfServicingInGrid() from a linq query and from there can click 'view in object browser'

Probably a silly question, but I just cannot get it to start!

Not silly at all, an omission on my part sorryEmbarrassed, it needs to be called inside a C# statement not in the default expresson as expressons have an implicit '.Dump()' call after them which is giving the error as BrowseData() returns void.
I've updated the docs.

'view in object browser' is something different, it's an Object Inspector similar to the one in the LLBL designer.


TomDog (User)   Posted on: 18-Aug-2011 12:12:52.
I've released version 2.0 of my LLBLGen LINQPad Data Context Driver for LLBL versions 3.0 and 3.1.

New features include:
  • Schema Explorer nodes tooltips now show descriptions, custom properties, mapped database object info and display names associated with the node item
  • Schema Explorer field nodes text now shows the maximum value of the fields and if they are primary or foreign keys
  • Drag and drop nodes from the Schema Explorer to the query window
  • Support for LLBL model assemblies without an ILinqMetaData implementation
  • Improved Connection dialog with connection string editor for Microsoft data providers
  • UI for adding additional assemblies and namespaces including a button to quickly add those needed for QuerySpec
  • Connection dialog tab for SQL query configuration
joealbahari (User)   Posted on: 19-Aug-2011 03:45:54.
Sounds great. If you'd like me to add a link to download the driver from LINQPad's drivers gallery, let me know.

Joe


TomDog (User)   Posted on: 19-Aug-2011 04:23:12.
joealbahari wrote:
Sounds great. If you'd like me to add a link to download the driver from LINQPad's drivers gallery, let me know.

Yeah probably about time it was on there.

If we need to discuss it further maybe send me a message via my codeplex profile
http://www.codeplex.com/site/users/view/JezzaT

joenathan (User)   Posted on: 04-Nov-2011 16:44:01.
TomDog wrote:
I've released a new version of my LLBLGen LINQPad Data Context Driver (v1.1)
Main new feature is the SQL trace showing in the SQL Translation Tab (if you jump through a few hoops in your own code).


Are there any other hoops besides adding in that static event in the CommonDaoBase class?

I've added this

Code:

    partial class CommonDaoBase
    {
        public static event EventHandler<SQLTraceEventArgs> SQLTraceEvent;
        }


Along with the QueryToSQL.cs and SQLTraceEventArgs.cs that you have defined

http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106701

and

http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1108434

however I'm not getting any SQL to show up in the trace tab. It's not throwing any errors, just not displaying anything.


TomDog (User)   Posted on: 09-Nov-2011 11:06:23.
joenathan wrote:
TomDog wrote:
I've released a new version of my LLBLGen LINQPad Data Context Driver (v1.1)
Main new feature is the SQL trace showing in the SQL Translation Tab (if you jump through a few hoops in your own code).


Are there any other hoops besides adding in that static event in the CommonDaoBase class?

I've added this

Code:

    partial class CommonDaoBase
    {
        public static event EventHandler<SQLTraceEventArgs> SQLTraceEvent;
        }


Along with the QueryToSQL.cs and SQLTraceEventArgs.cs that you have defined

http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106701

and

http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1108434

however I'm not getting any SQL to show up in the trace tab. It's not throwing any errors, just not displaying anything.

Yes you'll need to add CommonDaoBase.Extended.cs - http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/67103#1106733
joenathan (User)   Posted on: 09-Nov-2011 13:37:14.
That worked like a charm thanks TomDog Regular Smiley

TomDog (User)   Posted on: 27-Jan-2012 11:12:44.
Continuation from http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=18186
Otis wrote:
talking about codeplex and sourcecode, we'll fork your LinqPad driver (which is buried inside a bigger project) and include it with v3.5. Of course you'll get full credit. We have to see whether we ship it as sourcecode (if the license is too restrictive) or binary only. This way more people will be able to use it as it's installed by default.

Ahh the moment I've been waiting forLaugh

Yes be good to ship the source - I'll change the license if that gets in the way.
I don’t think there is much point in shipping a binary as the easiest way to install it is to host the driver and get Joe Albahari to add it to the drivers gallery, I had an email conversation with him about adding mine but it took me a while to find a place to host it and I haven't heard back from him since I did.

Otis wrote:
Codeplex is incredibly slow at the moment (<20KB / sec), so I couldn't pull the full sourcecode (31mb) of the complete project with the linqpad driver. As far as I could see the linqpad driver still contains a tremendous amount of code. Is all that necessary to make it work with linqpad? (like: it needs to get a complete model?) If so, I can help with that, as I've done this 3 (or even more) times already for various frameworks (Dyn. data, ria services, and now with OData) so I think I can optimize it properly with code borrowed from one or all three. (so no reflection necessary)

Is there a separate project for the linqpad driver or do I need the complete 31 MB of code and cut it out of it?

How are you trying to get the source? TortoiseSVN is the best tool to get it.
There are 3 branches - the only one you need is [url]https://rapiddevbookcode.svn.codeplex.com/svn/LLBLPro v3.1[/url] though you do need to load the solution with everything in it - AW and DataContextDriver.sln
I'm currently working on version 2.1 of the driver which takes advantage of the new features in the LinqPad Beta, so obviously you will need the Beta to compile it.

As to the code in the driver there are 3 distinct parts to it:
Connection dialog
Schema explorer population
Query execution

It give me much joy to see all the reflection removed though I think it would take some changes to the LLBL support classes to do that but we'll see.
That would help remove a lot of code, also I've implemented two methods of populating the schema explorer, one is pretty much what came with Joe's sample driver and the newer one which uses IFieldPersistenceInfo etc to provide rich tooltips and to set the new SqlName and SqlTypeDeclaration fields in the ExplorerItem, you could get rid of the old method to reduce the size. Also the default connection properties in the Connection Dialog are no longer needed as maybe is support for LLBL model assemblies without an ILinqMetaData. There is probably more that could go.
Otis (LLBLGen Pro Team)   Posted on: 27-Jan-2012 16:56:33.
Ok, I'll get back to you next week about this. My naive assumption was to 'fork the code, recompile and include it in the beta', but that's a bit too much. We'll ship v3.5's beta on monday so after that I'll have some time to look into this and see whether we can create a build before RTM, otherwise we'll add it after RTM.

I think what's best is that I copy the code which forms the driver and create a new project (so effectively a fork without the rest of the code) on codeplex. I'll use Hg, are you familiar with that? I'll then add you as a full committer so you can commit the code changes you're planning to that code base, if you want to of course Wink.

Would that fit with the way you work on this? If not, that's fine too, it will then just require more code-copying I think, but it might fit better in your overall project to keep it there, not sure.


TomDog (User)   Posted on: 29-Jan-2012 10:28:38.
Otis wrote:
Ok, I'll get back to you next week about this.

I think what's best is that I copy the code which forms the driver and create a new project (so effectively a fork without the rest of the code) on codeplex. I'll use Hg, are you familiar with that? I'll then add you as a full committer so you can commit the code changes you're planning to that code base, if you want to of course Wink.

Would that fit with the way you work on this? If not, that's fine too, it will then just require more code-copying I think, but it might fit better in your overall project to keep it there, not sure.

I'm not sure how best to proceed as my driver is dependent on a few helper projects plus it has some extras such as the 'LINQPad DataEditor' plus the unit test have even more dependencies (two DAL projects) which by the time you add them you have the majority of my projects.

All of which makes me consider starting from scratch (with a lot of copy and pasting of course), anyway we should maybe take this offline, you can reach me via my codeplex profile if you don't have my email already.

As for using Mercurial - I've installed TortoiseHg to download code off codeplex projects but that's all I've ever used it for.
Otis (LLBLGen Pro Team)   Posted on: 01-Feb-2012 11:23:38.
TomDog wrote:
Otis wrote:
Ok, I'll get back to you next week about this.

I think what's best is that I copy the code which forms the driver and create a new project (so effectively a fork without the rest of the code) on codeplex. I'll use Hg, are you familiar with that? I'll then add you as a full committer so you can commit the code changes you're planning to that code base, if you want to of course Wink.

Would that fit with the way you work on this? If not, that's fine too, it will then just require more code-copying I think, but it might fit better in your overall project to keep it there, not sure.

I'm not sure how best to proceed as my driver is dependent on a few helper projects plus it has some extras such as the 'LINQPad DataEditor' plus the unit test have even more dependencies (two DAL projects) which by the time you add them you have the majority of my projects.

Ok. What I initially want is first the driver, so it can be shipped with LinqPad's installer. I don't know what the unittests do exactly, do they test what meta-data is delivered?

Quote:

All of which makes me consider starting from scratch (with a lot of copy and pasting of course), anyway we should maybe take this offline, you can reach me via my codeplex profile if you don't have my email already.

As for using Mercurial - I've installed TortoiseHg to download code off codeplex projects but that's all I've ever used it for.

From orm profiler, we've learned the best way to work with Hg in a distributed environment is to use a branch per developer and merge frequently to a trunk and pull from that trunk again, so you get eachothers changes. It has some getting used to, but other than that, it's pretty easy. If you are familiar with SVN, see it like this: you work in your own branch, when you have something which compiles and works, I'll merge your changes with the main trunk and you simply pull from that again to get my changes. So instead of simply commit and update, you have to switch the local copy to a different branch and update. Once you've seen it, it's easy.

We're currently busy with v3.5's beta and the docs overhaul, so I think we'll have to postpone this work for a couple of weeks. I'll see if I can get things set up quickly in the coming weeks so it can be wrapped up after v3.5 launches.

I don't mind using the forums. As it's open source, perhaps others want to chime in as well. Wink. I'll keep you posted once I have the repository created and some code uploaded. When we've something working as a driver, I'll mail Joe to see whether the driver can be included in the linqpad installer as well (or at least added to their website).


WayneBrantley (User)   Posted on: 01-Feb-2012 11:58:16.
I think it is great you are embracing linqpad - it is a great tool and TomDogs driver works well.
Would like to see my SQL on the sql tab instead of dumped into my results though.

I have some add-on templates I put in LLBLGen so my generated code has everything needed to work with his driver. Works great.
TomDog (User)   Posted on: 06-Feb-2012 10:59:30.
Otis wrote:
Ok. What I initially want is first the driver, so it can be shipped with LinqPad's installer. I don't know what the unittests do exactly, do they test what meta-data is delivered?
Yes for the Schema Explorer population, I test that the counts of the fields and the navigators are the same between the Schema Explorer nodes and the entities and that the tooltips have the info I want in them.

Otis wrote:
We're currently busy with v3.5's beta and the docs overhaul, so I think we'll have to postpone this work for a couple of weeks. I'll see if I can get things set up quickly in the coming weeks so it can be wrapped up after v3.5 launches.
That will work out with me as I should have released version 2.1 of my driver by then, pending the resolution of these two issues:
http://linqpad.uservoice.com/forums/18302-linqpad-feature-suggestions/suggestions/1893867-enable-linqpad-to-release-its-lock-on-a-referenced
http://forums.oreilly.com/topic/72365-nullreferenceexception-executing-sql-against-llbl-driver/
Which are the two remaining pain points for me after which the driver will be 'feature complete' AFAIC.
Though as Wayne Brantley alludes to I'd say the major pain point for a new user of the driver would be that you have to alter your code to get SQL output in the SQL translation tab.

Otis wrote:
When we've something working as a driver, I'll mail Joe to see whether the driver can be included in the linqpad installer as well (or at least added to their website).
He doesn't included 3rd party drivers in the installer but instead lists them here: http://www.linqpad.net/RichClient/DataContextDrivers.aspx


Otis (LLBLGen Pro Team)   Posted on: 27-Mar-2012 11:18:28.
Looking at the EF built-in driver inside linqpad, I don't see how the SQL is obtained. It looks like LinqPad intercepts SQL statements somehow as it doesn't do anything inside the EF driver, e.g. it doesn't override the InitializeContext method. Maybe it does it somewhere else, not sure.

Looking at the pdf on linqpad's site, I conclude it's not really possible to create a general driver for all llblgen pro versions, unless everything is reflection based. Instead a driver per version (e.g. driver for v3.5) is much easier, as the ormsupportclasses can then be referenced from the driver.

To get myself up to speed with how things work I'll first try to create a bare-bones driver which works and then things are addable to that which add more features like tooltips and all the other stuff you already wrote code for.

(edit) Ok, I have a good idea how things connect with each other. Tomorrow or thursday (likely thursday) I'll start with your latest code and cut out everything that's not directly related to the driver and start from there. When things work (read: I can execute a query Wink), I'll create a codeplex project, upload the code and will contact you so you can be added as a developer.

For the SQL dumping, I think it's best to add a tracelistener in code, to the ORMPersistenceExecution tracer, and filter out any message that's not a query being executed. This then won't require events being bound nor extra code being generated.
TomDog (User)   Posted on: 02-Apr-2012 13:24:19.
I've released version 2.1 of my LLBLGen LINQPad Data Context Driver for LLBL versions 3.1 and 3.5.

New features include:
  • When you switch the query language to SQL, LINQPad updates the Schema Explorer to show SQL column names rather than CLR property names
  • Connection dialog unloads assemblies when it has closed down so they are no longer locked - this allows them to be rebuilt while LINQPad is still open
  • Connection dialog includes a button to quickly add assemblies needed for the http://www.ormprofiler.com
  • Includes this LINQPad Custom Visualizer

This release is mainly to take advantage of new features in the Beta of LINQPad such as not locking assemblies and consequently it only works with the Beta.
This will probably be the final release of this driver AFAIC it is now feature complete and also the Solutions Design guys are looking at creating their own driver (see posts above).


TomDog (User)   Posted on: 03-Apr-2012 12:46:44.
Otis wrote:
For the SQL dumping, I think it's best to add a tracelistener in code, to the ORMPersistenceExecution tracer, and filter out any message that's not a query being executed. This then won't require events being bound nor extra code being generated.
Yes of course!, I'm a bit annoyed I didn't think of that myselfEmbarrassed
Even though it wouldn't give executable SQL it's great unobtrusive default behavior.
Otis (LLBLGen Pro Team)   Posted on: 03-Apr-2012 15:31:55.
heh Regular Smiley

Yes, it's not executable indeed. but that's a bit of a pain anyway.

I've started with the driver, and I think it's best if our driver is as simple as the EF driver in Linqpad, and we can add additional features (you added a lot!) later, or if people want them, they can use your code instead. E.g. adapter factories and the like... I don't see the necessity for that at the beginning.

I think tomorrow I'm done with the dialog and can move on to the real code. The main stuff will likely be borrowed from the WCF Data Services base class as it can handle both selfservicing and adapter code.


TomDog (User)   Posted on: 04-Apr-2012 12:14:45.
Otis wrote:
I've started with the driver, and I think it's best if our driver is as simple as the EF driver in Linqpad, and we can add additional features (you added a lot!) later, or if people want them, they can use your code instead. E.g. adapter factories and the like... I don't see the necessity for that at the beginning.
I expect I'm the only one using an adapter factory, which is due to a weird situation in our code base, and which hopefully we will not need soon - that was a huge pain to support.
Some of the other stuff in the dialog like default settings has been redundant since the 'Create similar connection' feature was added to LINQPad.
Otis (LLBLGen Pro Team)   Posted on: 04-Apr-2012 14:48:06.
Ok. Regular Smiley I already wondered what all the input controls were for, as it's mainly a query tool.

Anyway.... I immediately ran into a weird issue with linqpad: when my connection dialog pops up, it's removed after a second (I use winforms), like I clicked cancel after 1 second. In the debugger however, it works OK, it stays up. I open it with ShowDialog of course. The beta build doesn't do this, however I'd like to have my driver work with the RTM as well.

Did you have the same problem or have seen things like this? No exception is thrown... No need to investigate if you haven't seen this before, I contacted Joe about this, but in case you've seen it yourself as well...


Otis (LLBLGen Pro Team)   Posted on: 05-Apr-2012 15:33:07.
Ok good progress Regular Smiley I now have a driver with dialog and a working getschema. No (harsh) reflection Regular Smiley (it does use reflection, but to filter out properties, nothing fancy) Re-used a lot of code from the OData stuff. And while doing that ran into a subtle bug in that code so I fixed that as well in the OData library.

No fancy tooltips yet, just a list with entities, fields, pk fields and navigators.

I'll now move on to the real work, namely executing queries Regular Smiley

I think I have a working driver tomorrow so I'll then check in the stuff on codeplex so you can have a look at this driver. It's nothing fancy, just gets the job done (well, schema producing at the moment that is Wink).

Otis (LLBLGen Pro Team)   Posted on: 10-Apr-2012 16:01:27.
ok!

I've pushed the first repo online, I've added you as a developer to the project, you should have an email from codeplex. I'm using mercurial, so tortoisehg is required.

What works:
- adapter + selfservicing
- inheritance
- inclusion of linqsupportclasses, ormsupportclasses, queryspec namespaces
- custom member providers for entities. (so lazy loading isn't triggered on selfservicing)
- SQL emitting using a trace listener.

not yet working:
- queryspec
- ormprofiler inclusion
- inclusion of namespaces from entity assembly
- grid navigation isn't properly implemented yet, so you'll get all the properties in grid navigation.

So if you compile the code and load the driver, you'll be able to use it with linq, in both adapter and selfservicing.

What's not there yet is proper headers on the files and a readme with credits etc. But we'll get there Regular Smiley. Main point is that it works Regular Smiley


TomDog (User)   Posted on: 11-Apr-2012 10:36:31.
Otis wrote:
ok!

So if you compile the code and load the driver, you'll be able to use it with linq, in both adapter and selfservicing.

What's not there yet is proper headers on the files and a readme with credits etc. But we'll get there Regular Smiley. Main point is that it works Regular Smiley

Great!
So what's next?

I guess some house keeping first, we should probably get the HintPaths aligned, for instance you have
<HintPath>..\..\..\..\..\Program Files\LINQPad\Beta\LINQPad.exe</HintPath>
while I have <HintPath>C:\Program Files\LINQPad\LINQPad.exe</HintPath>
You: <HintPath>..\..\..\..\..\Program Files\TestDriven.NET 3\NUnit\2.5\framework\nunit.framework.dll</HintPath>
me: <HintPath>..\packages\NUnit.2.6.0.12054\lib\nunit.framework.dll</HintPath>

also I changed the PostBuildEvent
<PostBuildEvent>
Call DevDeploy4.bat
Call DevDeploy.bat
</PostBuildEvent>


Otis (LLBLGen Pro Team)   Posted on: 11-Apr-2012 11:28:29.
I'll add a folder with the externals, including linqpad.exe. That should make things easier. It's otherwise a pain indeed. Regular Smiley

I'll primary focus on the stuff that doesn't work yet as I described above. Should be done by today.

(edit)... I can't get these .bat files to work if I don't specify the complete path to them... the post build event always fails. *sigh*...

(edit) OK, added macro's. Now works (and portable Wink). I'll add workitems for things to do to the project so it'll be visible what has to be done, and I'll publish the project.



TomDog (User)   Posted on: 11-Apr-2012 12:23:24.
Otis wrote:

(edit)... I can't get these .bat files to work if I don't specify the complete path to them... the post build event always fails. *sigh*...

(edit) OK, added macro's. Now works (and portable Wink)..
I had CopyToOutputDirectory on the .bat files.

A note about InitializeContextSelfServicing
var selfServicingAssembly = DataContextDriver.LoadAssemblySafely(selfServicingAssemblyFilename);
is unnecessary as you can get the assembly from object context.
Code:
var baseType = context.GetType().BaseType;
var selfServicingAssembly = baseType.Assembly;
Otis (LLBLGen Pro Team)   Posted on: 11-Apr-2012 12:33:02.
TomDog wrote:
Otis wrote:

(edit)... I can't get these .bat files to work if I don't specify the complete path to them... the post build event always fails. *sigh*...

(edit) OK, added macro's. Now works (and portable Wink)..
I had CopyToOutputDirectory on the .bat files.


Ah. Ok I added a macro, should work now.

Please Pull changes from repository to have things lined up. Place the files described in the text file in the Externals folder to make references work.

Quote:

A note about InitializeContextSelfServicing
var selfServicingAssembly = DataContextDriver.LoadAssemblySafely(selfServicingAssemblyFilename);
is unnecessary as you can get the assembly from object context.
Code:
var baseType = context.GetType().BaseType;
var selfServicingAssembly = baseType.Assembly;

Good catch. Regular Smiley

Will change these.

For the people interested: the project is visible here: http://llblgenlinqpad.codeplex.com

(Edit) Jeremy, you shouldn't feel obligated to participate, if you don't have the time, no worries, it's almost done anyway. Regular Smiley If you want to help, all the better though Regular Smiley


TomDog (User)   Posted on: 12-Apr-2012 11:54:06.
Otis wrote:
Jeremy, you shouldn't feel obligated to participate, if you don't have the time, no worries, it's almost done anyway. Regular Smiley If you want to help, all the better though Regular Smiley
Thanks, alas I don't have much time to spend on it code wise, though I can do a little testing - you'll see the issues I've raised.

Also in FilesToPlaceHere.txt you say - LINQPad.exe (build v2/4.40 or higher) - it has to be v2 only - at least while the driver is .net 2.
Otis (LLBLGen Pro Team)   Posted on: 12-Apr-2012 12:12:49.
TomDog wrote:
Otis wrote:
Jeremy, you shouldn't feel obligated to participate, if you don't have the time, no worries, it's almost done anyway. Regular Smiley If you want to help, all the better though Regular Smiley
Thanks, alas I don't have much time to spend on it code wise, though I can do a little testing - you'll see the issues I've raised.

Good stuff, will try to fix them soon. Regular Smiley

Quote:

Also in FilesToPlaceHere.txt you say - LINQPad.exe (build v2/4.40 or higher) - it has to be v2 only - at least while the driver is .net 2.

of course. I've added an issue for this.

Thanks! Regular Smiley


Otis (LLBLGen Pro Team)   Posted on: 16-Apr-2012 16:33:19.
Released first RTM build:
http://llblgenlinqpad.codeplex.com/
WayneBrantley (User)   Posted on: 24-Apr-2012 19:13:06.
I currently have special templates that insert the hooks the old LinqPad driver needed and such. For the driver you have now, I can remove those hooks and extra code and simply use the driver provided?



Otis (LLBLGen Pro Team)   Posted on: 25-Apr-2012 10:02:24.
Yes. Otherwise the usage description would contain a description of the templates Wink. Though there's one caveat: the driver uses the trace output, so the queries aren't 1:1 copyable to a query tool.
WayneBrantley (User)   Posted on: 10-Jul-2012 23:31:03.
Ok, despite all your hard work, I could not get it to work.

I opened LinqPad version 4.42.01
I clicked 'add connection'
I clicked 'View more drivers...'
I found LLBLGen 3.5 official release and clicked to download official driver (version 3.5.12.416).

I then added a new connection, pointed it to my DAL and my .config file.

I then tried to expand the connection in the tree on the left and received 'Error: Object reference not set to an instance of an object.'.

I tried to execute a query and it DID work...so it appears the tree on the left is just not working.


I still have the original 3.0 version of the driver (unofficial one) and it does expand on the left.

Thoughts?




Otis (LLBLGen Pro Team)   Posted on: 11-Jul-2012 10:08:03.
no idea. It works here without problems. Also... without a stacktrace I can't help you. Wink
WayneBrantley (User)   Posted on: 11-Jul-2012 15:17:46.
Quote:
It works here without problems

Ha! A true developer. Regular Smiley

Well, there is no stack trace - as it just shows that error in linqpad beside the item. I tried it on several computers.

I will email you my DAL so you can see it or get a stack trace, etc...


Otis (LLBLGen Pro Team)   Posted on: 11-Jul-2012 16:16:06.
Reproduced. Very odd. Will check.

With our tests, everything works, so there's little I can do other than 'assume it works' Regular Smiley. Though we use the .net 3.5 build, and an older version so it might be something changed. We'll look into it.
Otis (LLBLGen Pro Team)   Posted on: 11-Jul-2012 16:25:45.
It dies on: ForcePlaceLoanEntity's property: MasterPolicy. The relation mapped by that field/property is apparently null / not found.

Do you have a hidden navigator?

it crashes on line 198, in SchemaBuilder. You can check this as well, using the sourcecode from codeplex, build a debug build of the driver, and use that driver instead.


TomDog (User)   Posted on: 16-Jun-2014 12:21:55.
FWIW I've released Version 3.0 of my LLBLGen LINQPad Data Context Driver for LLBL versions 4.0, 4.1 and 4.2.

New features include:
  • Ability to group the entities by schema and/or by table prefix.
  • Ability to import connections from earlier LLBL version connections.
  • The included LINQPad Custom Visualizers have been enhanced, in particular with the addition of the Entity Data Browser
Otis (LLBLGen Pro Team)   Posted on: 16-Jun-2014 15:05:23.
Nice! Thanks for the hard work on this Regular Smiley I posted it on twitter. I'll make sure a link to your driver is posted on our additional downloads page as well.