Relationships Field on mapped field

Posts   
 
    
JeffM
User
Posts: 29
Joined: 30-Dec-2006
# Posted on: 19-Jan-2007 21:41:17   

http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3361

I have a table Request which has a RepID field. I have a table EmployeesOMD which has a UserID field and FullName field.

I have a dropdown list which has FullName as text value and UserID as PickedValue. I have a gui which adds the request data to teh request table properly. And edits properly and show the repid if I ask for it that way. What I want to show is the fullName.

I have built the relation in the designer and the field on mapped field.

The select statement which runs when I debug doesn't include the EmployeesOMD.FullName

As the above thread suggest I build the relation then I add the field on mapped fields. I have done that but the select statemnet that is generated is incorrect.

I can bind to the fullname field with out errors but there is no data. As it is not part of the select statement which is run. I can also fetch the employeeOMD entity myself in my behind code page but I shouldn't have to do that????

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 20-Jan-2007 17:33:16   

I miss essential information: how are request and employeesOMD related? In which entity did you add WHICH field mapped onto WHICH related field? Do you also fetch the related entity using a prefetch path? (as the field mapped onto related field isn't part of the entity, it's a way to access a related field in A while the related field is actually part of a related entity B.

Frans Bouma | Lead developer LLBLGen Pro
JeffM
User
Posts: 29
Joined: 30-Dec-2006
# Posted on: 20-Jan-2007 18:02:29   

OK the relation is that we have employees and employees can create many requests for services.

So in the request entity I have a field repID and I created the relation n:1 to employeeOMD and mapped the field fullname to the request entity.

So in my code behind the page I see that I can do the following. dim _requestEntity as Entity2 dim _EmployeeEntity as Entity2 = _requestEntity.employeeOMD which I assume gives me the related employee but it is empty as it has not been fetched.

I also can do the following using same commands above. _requestEntity.fullname = "whatever"

So I have access to the correct things in order to do bindings in my forms.

The selecting of the related data field apparently is not automatic as it looks to be in the thread I referenced.

So I do need to do a prefetch. Can you give me an example or point me to one?

JeffM
User
Posts: 29
Joined: 30-Dec-2006
# Posted on: 20-Jan-2007 23:40:11   

did you get my last message?

Chester
Support Team
Posts: 223
Joined: 15-Jul-2005
# Posted on: 21-Jan-2007 00:46:44   

Look in the documentation on "Generated code - Prefetch Paths".

JeffM
User
Posts: 29
Joined: 30-Dec-2006
# Posted on: 21-Jan-2007 01:18:18   

in the help pages it says to use the following line of code. Dim prefetchPath As IPrefetchPath2 = New PrefetchPath2(CType(EntityType.OrderEntity, Integer))

I keep finding more and more things I need in my import statements in order to have access to all my objects am I missing something can you give me all my import statements i need is this in documentation somewhere? I am using adapter type and my namespae is MSI.SS.Adapter

Thanks Jeff

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 21-Jan-2007 10:30:37   

The easiest way is to install the vs.net 2005 snippets we've included in the llblgen pro package. they're located in the Templates folder. With these, you can inside the code editor pick one of the snippets and emit the imports you need.

You need: Imports $RootNamespace$.DatabaseSpecific Imports $RootNamespace$.EntityClasses Imports $RootNamespace$.FactoryClasses Imports $RootNamespace$.HelperClasses Imports $RootNamespace$.RelationClasses Imports $RootNamespace$.TypedListClasses Imports $RootNamespace$.TypedViewClasses Imports $RootNamespace$

Imports SD.LLBLGen.Pro.ORMSupportClasses

where $RootNamespace$ is your rootnamespace, i.e. MSI.SS.Adapter

If you don't have typedlists, remove the imports. But that's about it simple_smile

Frans Bouma | Lead developer LLBLGen Pro