ReturnsNewIfNotFound

Posts   
 
    
mshe
User
Posts: 167
Joined: 02-Feb-2006
# Posted on: 10-Apr-2009 07:23:10   

Hello Everyone,

How does ReturnsNewIfNotFound work?

I have an entity which has related fields mapped - all the fields have "RetunNewIfNotFound" set to true (Default Value).

However, some fields return nothing, others return an "new object".

How does LLBLGen determine when it returns a nothing vs. a new object?

I'm confused at the behaviour of ReturnsNewIfNotFound.

I'm running LLBLGen v2.6, Self-Servicing, October 6th, 2008 release.

mshe
User
Posts: 167
Joined: 02-Feb-2006
# Posted on: 10-Apr-2009 07:46:47   

Hello,

It seems when I specify a prefetch path, nothing is returned for entities that are not found.

However, I have a single case where it's still returning a new element.

I'm a bit confused at the behaviour for ReturnNewIfNotFound.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 10-Apr-2009 09:34:27   

Let's take a northwind example. For the OrderEntity, it has a related CustomerEntity, and a related OrderDetails collection.

If both are prefetched and no records were found for both in the database that relates to this Order then the following should be true:

1- order.Customer = new CustomerEntity(); 2- order.OrderDetails = new OrderDetailsCollection(); Also order.OrderDetails.Count = 0;

Would you please explain by example your findings?