Print Page | Close Window

Where clause in entity

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=233
Printed Date: 13-Mar-2025 at 5:54am


Topic: Where clause in entity
Posted By: Customer
Subject: Where clause in entity
Date Posted: 12-Jul-2007 at 5:07pm

I have an issue/clarification with regards to where clause definition in the entity.

  • Say I have two entities Order (parent) and OrderDetail (child). OrderDetail has a where clause “status = ‘Active’”.
  • When I do Order.OrderDetails, I get a managed list with a predicate applied.
  • Now If set the “status” property for one of the OrderDetail entity from the managed list to “InActive”, I expect the entity to be removed from the managed list as it doesn’t satisfy the entity where clause. But it doesn’t seem to be.



Replies:
Posted By: IdeaBlade
Date Posted: 12-Jul-2007 at 5:09pm

You are correct about the behavior of the "Where" clause. 

The "Where" clause was intended for distinguishing among records with a FIXED discriminator column. It will not work for any column whose value can change ... nor was it supposed to.

The "Where" clause  was designed to separate State codes from Shipping codes when both such codes resided in the same table. A State code never becomes a Shipping code (nor vice versa). 

However, any object can be active or inactive and switch between the two.

Perhaps our documentation is unclear on that point - I'm forwarding this to our docs guy. 

You can teach your managed list to remove an inactive object. That is standard ManagedList coding; please check with support if you need to know more.

There are other more challenging issues associated with "logical delete" operations such as are likely to be associated with your "inactive" flag. I don't want to anticipate those now :-) but I have some guidelines when you are ready.

 




Print Page | Close Window