This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Has anyone used LINQPad (http://www.linqpad.net) with LightSpeed? I'm trying to run ad-hoc LINQ queries against the LightSpeed 2.2 LINQ provider and have had some success with this tool. The Dump() function (presumably an extension method injected by LINQPad?) is supposed to output all the details of a specific object. What actually happens is that LINQPad spends at least 5 minutes attempting to execute the statements and returns no results when I cancel the process after waiting for that long. I guess that the Dump method is querying all LightSpeed objects which are in turn causing extra requests to be made to the database. If it does this recursively then I suppose that with all the clever back-references that LightSpeed provides, this dumping process will never end. |
|
|
I suspect you're right that Dump() is probably trying to navigate associations, resulting in an infinite loop as it shuttles back and forth between two entities. You might be able to verify this by adding a Logger to your LightSpeedContext (assuming that LINQPad can display console or trace output; or that there's some sort of "write" method that you could call from a custom logger). Regarding implementing ICustomMemberProvider, I think what he's saying is that you need to *declare* an interface with this name (in the LINQPad namespace) and signature, then implement it on your entities. I.e. you're not actually implementing an interface defined by LINQPad (which *would* require a reference to LINQPad) but one which Just Happens to have the same name and methods, which LINQPad will call by reflection. You shouldn't get compile errors once you've declared your own "copy" of the interface type. I'm not sure we'd want to implement the LINQPad interface on the Entity base class because (a) it adds methods which are very specific to a single tool and (b) we can't always predict how you'll want to dump your objects -- e.g. maybe you want to traverse to-one associations when dumping, but not to-many; or vice versa; or maybe you don't want to dump associations at all. If you do want to centralise the implementation you can always create your own EntityBase class, implement it on that, and then derive your concrete entities from your EntityBase. We'd be keen to hear if you get this stuff working: LINQPad is a nice little tool and it would be great to know how to get it and LightSpeed working together! |
|
|
Hi I'm Joe, author of LINQPad. The problem is most likely that Dump() is expanding lazily loaded properties and this causes excessive hits to the database. An infinite loop won't actually happen if LightSpeed preserves object identity because LINQPad detects cyclical references. The solution right now, as you indicated, is to implement ICustomMemberProvider. However in the next update there will be an option to write drivers for third-party ORMs such as LightSpeed. Such a driver will let you take over the ICustomMemberProvider without having to implement it in the types themselves. It will also let you see the object schema in the TreeView on the left and writes queries simply like this: from o in SpeciesNames I'm in contact with Mindscape at the moment to work out whether we can provide a driver for LightSpeed. Best regards Joe |
|
|
Just discovered that LinqPad has a new beta that might (I so hope) be able to use a LightSpeed model for its entity model. http://www.linqpad.net/Beta.aspx What is the progress on this front? Thanks Kenneth James |
|
|
I've implemented a LightSpeed driver for an earlier LinqPad beta, but have not yet got round to rebuilding and testing with the new beta. Haven't built an installer or otherwise figured out how to make it available to customers, though if people are keen, then as a crude first step we could just post the LPX file with copying instructions. Let us know. |
|
|
Thanks for the response. I am not a techie guru so I am not the one to fiddle with betas. What I would like is to be able to:
This isn't much of a use-case, but this is the kind of situation that I would like. So I will be waiting until a plug-and-play situation is available. Thanks Kenneth James |
|
|
Hi Ivan The extensibility model hasn't changed in the newer LINQPad beta (which is about to be a RC) - so your existing .lpx file should work perfectly. If you like, send me the .lpx file and I'll add it to LINQPad's gallery, so downloading & consuming it is a one-click experience for users. Joe |
|
|
Ivan, I'll give that .lpx file a try if you want to post it here... or just download it from the LinqPad gallery if you choose to go down that route. Will it work with LS2.2? Thanks, Chris |
|
|
I would LOVE to test out the LPX file, too! Thanks. |
|
|
Hi guys, We now have a beta version of the LINQPad driver. For the time being I'll post this here (see attached file) and will move it to the LINQPad Gallery (and our Downloads section) once it's been shaken out a bit. To install it, download it and choose Add Connection > View More Drivers > Browse. You will then be able to select LightSpeed in the lower half of the dialog and click Next to browse to a DLL containing a LightSpeed strong-typed unit of work. You will also need to provide some of the LightSpeedContext settings such as connection string and database type. Please let us know about any errors, problems or suggestions. We don't have great error trapping or logging at the moment so please tell us if there are areas that need polishing! Chris, we have not tested this with LightSpeed 2.2, but I don't see any reason for it not to work. Give it a try and let us know. One issue we would like feedback on: I've seen an issue where if you perform a LightSpeed query then click on the LINQPad "IL" button, it crashes LINQPad. Joe (the author of LINQPad) hasn't been able to reproduce this so I'm hoping it's an issue with my machine. But if you guys could try it out and let me know whether it works for you, I'd really appreciate it. (Save your work first!) Thanks! |
|
|
Thanks Ivan (and Joe) this looks good. I managed to get connected to my LightSpeed 2.2 model data pretty quickly (and then I experimented with the "Infer from model" option which was even faster). I couldn't replicate the "IL" button crash (LINQPad 2.00.4). Maybe only certain queries or certain models cause it? We need to connect to different databases (e.g. development and production) but I can't see any way to change the name of the connection/database - at the moment there are just lots of identical entries on the left hand connection explorer and in the drop down "Database" box at the top of the query window. Is it possible to add an option to assign a name that is not just the UnitOfWork class name? Is there any way to alter other LightSpeedContext settings? We need Utc TimeStamps and identityMethod in particular although I imagine that full control over all settings might be handy for some people from time to time. A minor bug I found: Putting in a connection string that extends beyond the default text box size causes the right edge of the form to become hidden. Do you know whether the LINQPad autocomplete feature will work with my LightSpeed model? I'll be able to convince my manager to pay for the upgrade if we can take advantage of that feature but I can't see any way to try it out first. Finally, I'm not sure if this is a LightSpeed driver or LINQPad feature request but it would be useful if association IDs listed in the results table could be hyperlinked with a shortcut to view the Entity referred to by that ID (a new tab would be my personal preference)... but I realise this might be asking a lot! Thanks, Chris |
|
|
To answer you questions about LINQPad, autocompletion should work fine with LightSpeed models. It is possible to inject hyperlinks into the output which generate further queries - by instantiating the LINQPad.Hyperlinq class. If you've got a lot of associations, though, it creates some clutter in the output which is why I've not yet done this for standard LINQPad queries. Joe |
|
|
Hello Chris, Here's an updated driver which allows you to rename connections, and to specify the identity method and timestamp strategy. The right-hand edge of the form seems to behave itself a bit better now too. I haven't tested insert and update functionality very extensively (embarrassingly, I didn't know LINQPad could do this until you mentioned it!) so do let me know if you hit any problems or if you need any other save-related settings to be configurable. |
|
|
Wow. Fantastic job, yet again. Based on this, I just registered LINQPad. At every turn, I continue to feel my decision to go with Lightspeed was the right one! I haven't seen the crashes you talked about in 2 days of using it. As a matter of fact, it's taken everything I've thrown at it like a champ. I'll see about testing it some vs. using it to get work done to see if I can help out and uncover anything. :) |
|
|
I've been using this at least a couple of times a day for a few weeks now with a variety of read / write tasks against our development and production databases and I've have had no serious problems. The only issue is that I have occasionally found that queries returning a large quantity of data will cause LINQPad to throw out of memory exceptions. I haven't spotted any easily reproducible query that triggers this problem and I haven't used the final LINQPad 2.10 release yet so I'm neither too worried about it nor able to pin down the cause of the problem to LINQPad, LightSpeed or my query writing skills. I will let you know if I find anything more serious or repeatable. Our organisation has also purchased a few LINQPad licenses and found that the auto-complete works well for our LightSpeed 2.2 Entity model. Thanks, Chris |
|
|
Hi Guys, Nice work on the LINQPad driver. It is working fine, I can even use the UnitOfWork functions (BeginTransaction, Add and SaveChanges , and they work), I currently have only one feature request. Would it be possible to add a setting to specify my Lucene index? This would make it a lot more usable for me since I dont have to rebuild my indexes after an update or insert script. LINQPad "IL" button does not crash LINQPad here by the way. Thanks, Rolf |
|
|
Hi Rolf, We've updated the LINQPad driver to allow configuration of the Lucene search index. This update is available now. To get it, go again into the Choose a Driver dialog and re-download the LightSpeed driver. Please let us know if you run into any problems. |
|
|
Do we need a new version of the LPX compiled with .NET 4.0? I ported up to .NET 4.0 for the assembly that contains my model, and now I get this error after I select the Model Assembly and press Ok in the Add Connection dialog: Error obtaining available unit of work classes: Could not load file or assembly 'file:///C:\dev\LeagueTrack\bin\LeagueTrack.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. I wonder if this is just the way things are in a plugin environment. |
|
|
That sounds more like you're using the 3.5 build of LINQPad with a 4.0 build of your assembly. If your assembly is built with 4.0, you'll need to use the 4.0 build of LINQPad. I believe that should load LightSpeed and the LightSpeed LPX just fine, because they're built on an older version of the framework (haven't tested though). If you're seeing this error with the 4.0 build of LINQPad, let us know and we'll look into it. |
|