Try our conversational search powered by Generative AI!

Query for custom entities

Vote:
 

I´m having a custom entity, CustomClub, that derives from Club. I want to create a query that gets all CustomClubs that has a certain Category, what is the preffered way of doing that?

Hoping for a solution that doesn´t require writing SQL/HQL queries to the community database as in Joels blogpost.

#32884
Sep 22, 2009 16:44
Vote:
 

Hey Niklas,

You can set up queries for your custom entities by adding NHibernate mappings and custom queries. I've been planning to write a blog post about that for quite some time but haven't gotten around to it :( You can use Reflector and take a look at the built in modules though.

#32901
Sep 23, 2009 10:18
Vote:
 
Thanks! Got it partly to work. Looking forward to that blogpost :)
#32925
Sep 24, 2009 13:38
Vote:
 

Just read this post again and realized that I solved the problem. The answer was to set the EntityTypeOverride attribute on my derived class. After that, just go ahead and use the ClubQuery or any class derived from that.

 

Ex:

[EntityTypeOverride(typeof(Club))]
CustomClub : Club

...

#38423
Apr 09, 2010 11:25
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.