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
|
I have used LINQPad to LS to test a LINQ statement: This produces the SQL:
SELECT t3.WarehouseName AS [t3.WarehouseName], t2.LocationDescription AS [t2.LocationDescription], t1.Quantity AS [t1.Quantity], t1.LastAudited AS [t1.LastAudited] Which works correctly. If I then put the same LINQ into my application and connect it to a uow with the following code: var locs = from s in uow.Stocks
It produces the following SQL:
SELECT t2.Id,t2.LocationCode,t2.LocationDescription,t2.WarehouseId FROM StockWarehouseLocation t2 INNER JOIN StockWarehouse t3 ON t2.WarehouseId = t3.Id WHERE EXISTS (SELECT t1.* FROM StockLocation t1 INNER JOIN StockLocation t1 ON t0.Id = t1.StockId WHERE t1.LocationId = t2.Id AND t1.StockId = 0); Which throws the following error: The correlation name 't1' is specified multiple times in a FROM clause. I would expect the two to produce similar SQL, or am I doing something completely wrong?
|
|
|
Hi Mark, Are you using a recent nightly build when running this? The query being generated looks a little bit odd given the LINQ query you have there. If you are using a recent nightly, would you be able to attach a small repro sample and we can have a look at this.
Jeremy |
|
|
Hi Jeremy, I was using a Nightly Build from about one month ago. I have now downloaded last nights build, and the LINQ to SQL conversion now seems to work correctly. I would add, that, whilst I am very happy with the prompt support I receive, I am a little wary of using nightly builds. As you own warnings indicate, they are not tested to the same degree as the main releases. This makes me afraid that each time I use a Nightly Build, I am introducing some unknown problems into my applications. Can I suggest that along with the nightly builds, is a small, simple text document, that grows each night, that shows the changes since the last full release. I can then access the risk to my apps. Also, is it possible that once per month, or once per quarter for example, there is a new full release, that has undergone the full QC works. I would be more confident using this as a regular upgrade path. This really would save me a lot of work in doing a complete retesting every time I need a Nightly Build. Many thanks Mark |
|
|
Hi Mark, Thanks for the feedback and glad to hear the issue is resolved. A changelog relating to the nightly builds is something which are very keen to start including so we definitely are hearing you on that one! The more regular quarterly releases are an interesting idea and something for us to discuss at our planning meeting next week - again thanks for the feedback on this.
Jeremy |
|
|
Hi Jeremy, It seems this is going to haunt me. About one hour ago this problem reappeared. I have not changed anything on the related database tables, one the model, I just selected Update from Source, to pickup some changes on other non related tables. At which time it correctly identified the changes I had made. The app builds correctly, but when I run the program, I get exactly the same error as originally posted. I have downloaded last nights build, and tried that, but still the same. This is really confusing. Any ideas? |
|
|
Can you check that there are no older versions of LightSpeed floating around which may have been referenced and therefore re-introduced the behavior - easiest way is to just check the version number of the Mindscape.LightSpeed.dll which is in the bin directory of the executing program.
Jeremy |
|
|
Hi Jeremy, I have checked as you suggested, I also used the VS2008 "Clean Solution" option to remove any old versions. However, none were found. I have attached a zip file that contains four files, a picture of the model, a text document explainnig the eager loading settings, a copy of the LINQ being used, and an output from the Logger when this LINQ is executed. Maybe you can see something I have missed? The particular SQL that throws the error,is one of the eager loads, i.e. SELECT t3.Id, t3.GlAdjustments, t3.GlStock, t3.WarehouseName
|
|
|
Hi Mark, I have been having a look at this today for you. The good news is that Ive managed to distill a fairly precise repro of the problem, unfortunately this wont be a small fix but I will keep you updated once we have made some progress on resolving this. The problem occurs when you join in a relationship multiple times from different routes (e.g. A->B->C where A->C, if you join A->B and then B->C and then A->C, C will get joined twice in this particular case due to the way in which we have to parse for missing joins in criteria statements and the like as part of post processing). As a possible workaround, if your associations are traversing to an entity collection, and you are joining on the association's foreign key anyway, you could use the syntax from x in obj.Collection instead of explicitely joining it and this will likely work around the bug.
Jeremy
|
|
|
Hi Mark, I have put in an update today which should resolve this issue for you and it will be in the next nightly build (20100511). If you are able to review this at the next opportunity and let us know if it covers the behavior you were seeing that would be much appreciated.
Thanks! Jeremy |
|
|
Hi Jeremy, I will lookout for the nightly build tomorrow, and give it a try. Thanks for your help. Regards Mark |
|