Login Skip Navigation LinksWilsonORMapper > Forums Search
Demo Version Demo Version
Download and try for yourself a fully working demo version, including sample apps and documentation.  The only limitation is that the demo version only works inside the debugger.

PayPal Subscribe
Get It All for $50 USD:
WebPortal, ORMapper,
Source Code, All Updates
PayPal

User Login User Login
Log In
 
 
Reset Password

Wilson ORMapper Forums Wilson ORMapper Forums : OPath Queries : Checking Many-to-One Relation For Missing Relation

Date Post
3/13/2007 7:56:53 PM

During evaluation of the demo, I am testing how to check if a relation exists.

I have an entity (Transaction) and an entity (SubjectMatterExpert).  Transactions are assigned to SubjectMatterExperts with a Many-to-One relation.  Everything is working fine with loading and persisting.

What I want to do is use the OPathQuery.GetList<Transaction> to retrieve a list of Transactions that are not assigned to a SubjectMatterExpert (i.e. SubjectMatterExpertId is null).  I do not want to expose the internal member (_subjectMatterExpertId) to the consumers of my objects.

I feel like I'm missing the obvious, but after searching the forums, I haven't come up with a solution.  If OpathQuery won't do it, please tell me what will.

Tracy

 

3/15/2007 6:00:02 AM

The EXISTS keyword can be used to test for records in a related table... but it's not in the demo version of WORM.  I need to get with Paul and get a new release published that has support for this.

However, since you are going from many-to-one you probably don't need to use EXISTS and can instead just test the FK column for null.  Something like the following might work:

OPathQuery<Transaction>("IsNull(SubjectMatterExpertId)")

Hope this helps,
Jeff Lanning