How to Fetch(fill), fields on related fields without Prefetch path

Posts   
 
    
KS
User
Posts: 55
Joined: 08-Aug-2006
# Posted on: 16-Nov-2006 19:46:59   

Posted on: 03-nov-2006 15:05:08. Edit | Quote
<Environment Info> Adpater pattern LLBL Designer version 2.0.0.0 LLBLGen Pro .NET 2.0 ORM Support Classes 2.0.0.60904 .Net 2.0 VS.NET 2005 ODP.NET 10.2 </Environment Info>

I was just wondering, whether there's any other way to fill "fields on related fields" for an entity without setting Prefetch path for corresponding related entity.

Also seems like saving entity with "fields on related fields" is not saving related fields. Is there a work around I can make it work. I dont even mind a hack simple_smile

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 17-Nov-2006 07:58:36   

I was just wondering, whether there's any other way to fill "fields on related fields" for an entity without setting Prefetch path for corresponding related entity.

Nope. Fields on related Fields are used in conjungtion with PrefetchPaths.

Also seems like saving entity with "fields on related fields" is not saving related fields. Is there a work around I can make it work. I dont even mind a hack

A hack would be to handle the OnSaveEvent and perform the save of thise fields yourself.

Note: Fields On Related Fields should be used in a read-only manner. It's far easier, if you modify the fields of the coresponding related entity and Save the entire Graph at once.

Order order = new Order(20);
PrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.OrderEntity);
prefetchPath.Add(OrderEntity.PrefetchPathCustomer);

adapter.FetchEntity(order, null, prefetchPath);

order.SomeField = "xx";
order.Customer.AnotherField = "zz"; 
/* while you may have order.CustomerAnotherField mapped on Customer.AnotherField, you should use the origial field for modifying data */

adapter.SaveEntity(order, false, true); // the third param is for the recursive save.

That would be the easiest solution possible.

KS
User
Posts: 55
Joined: 08-Aug-2006
# Posted on: 17-Nov-2006 19:47:51   

Thanks Walaa. Actually I am aware of all these, however I was just looking for a easier approach, anyways its fine.

Actaully I read in one of the forum, Frans talking about Composite Entity CRUD operations in 2.1 V (if i am m not mistaken), any progress on that front.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 17-Nov-2006 19:58:14   

The term composite entity CRUD operations is new to me, but I think you mean entities created in the designer which aggregate other entities? As that's indeed the plan. simple_smile

Frans Bouma | Lead developer LLBLGen Pro
KS
User
Posts: 55
Joined: 08-Aug-2006
# Posted on: 20-Nov-2006 16:15:15   

Otis wrote:

The term composite entity CRUD operations is new to me, but I think you mean entities created in the designer which aggregate other entities? As that's indeed the plan. simple_smile

Yeah you right, I am very much talking about Aggregate entities created in Designer.