-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Linq To NHibernate foreign key question
PostPosted: Mon Jul 21, 2008 12:14 pm 
Newbie

Joined: Tue Apr 22, 2008 7:17 am
Posts: 14
Hi,
I'm not sure if this is the right place to ask or not, but I have a question regarding the Linq To NHibernate project.

I have a query along the lines of:

Code:
var query = from question in _sessionManager.OpenSession().Linq<Question>()
                        where question.Domain.DomainName == domain.DomainName
                        select question.Subdomain;


Essentially, I have a question class with foreign key references to the Domain and Subdomain classes. I want a list of subdomains, but I need to get them as links thru questions that have links to a given domain. It's fairly straightforward, but I keep getting an error telling me that I can't cast from type Question to type Subdomain.

I fired up a Linq to SQL project pointing at the same schema, and it works fine there, so I'm wondering if this is an unimplemented part of the Linq provider, or if there is an alternative syntax that I should employ?

As a side note, if I return an anonymous type composed of properties of the subdomain, it works fine, so it can figure out all the underlying SQL relationships, but for some reason won't return me the entity itself.

Thanks very much,
Matt


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.