Error dynamically adding relation

Posts   
 
    
worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 18-Feb-2011 05:05:29   

This is continued on from http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=19398

I've emailed a reproduction to support At llblgen.com.

Note that in dataaccessadapter.designer.cs, lines 89-90 was something weird I tried. I forgot to remove it afterwards before sending the repro, it doesn't affect the result either way.

So basically what my code tries to do is add a join onto a permissions table for certain entities (currently just 1 entity).

In a simple scenario where i'm writing linq to the effect of: select * from contentpageentity it works fine, the join is added, i get my contentpageentity with my added Permission column and everyone is happy.

In a somewhat more complicated scenario I add a join from ContentPage to ContentPageType plus add filter on ContentPageType.Name column. So this gets created by the linq provider as a DynamicRelation. My code then tries to add another relation joining ContentPage onto ContextPermissions and it fails. It does not generate a query.

{"Relation at index 1 doesn't contain an entity already added to the FROM clause. Bad alias?"}

So my goal is to resolve that bug.

worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 18-Feb-2011 05:13:49   

Also the test i included with the repro uses some of my specification/repository classes. This can be replaced with:


DataAccessAdapter adapter = new DataAccessAdapter();
            LinqMetaData meta = new LinqMetaData(adapter);

            var r = from c in meta.ContentPage
                    join cpt in meta.ContentPageType on c.ContentPageTypeId equals cpt.Id
                    where cpt.Name.Contains("Test")
                    select c;

            r.ToArray();

And you will get the same error.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 18-Feb-2011 11:03:38   

I replied by email. Most code you send was in binary form, so we couldn't use it. It's also a complex system so we then have to learn this system first what's going on, which is not what we are looking for in a repro.

however, as your repro shipped with RTM date builds of the runtime libs, and we did fix a bug in this area since, I'd recommend downloading the latest v3.0 build and check whether that fixes your issue

Frans Bouma | Lead developer LLBLGen Pro
worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 21-Feb-2011 06:45:35   

I've sent you a lighter repro. All code included. No system to learn. Current dlls.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 21-Feb-2011 11:31:45   

Replied via email, bug in your code (but it wasn't obvious. I've explained it in the email simple_smile ).

Frans Bouma | Lead developer LLBLGen Pro
worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 01-Mar-2011 06:31:17   

To anyone following this, this proved to be unachievable with LLBL as it is now. I hope to revisit it in the future when support for what I was trying to achieve is implemented.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 01-Mar-2011 08:55:04   

'unachievable' in this case means: adding elements to a query which is produced by the Linq provider. The problem is that the linq provider aliases elements automatically, and appending elements to the result is difficult as aliases aren't always known. Another problem was that adding a field from a different entity to the list of fields of a query could trigger logic which thinks the entity is an inheritance entity causing relations not always to match up (combined with the alias issue).

I.o.w.: once the framework supports entities mapped onto multiple targets, this is solved automatically.

Frans Bouma | Lead developer LLBLGen Pro