What do you mean by ignoring primary Id?

also you don';t need to use Transformers, do you?

Tuna Toksöz
Eternal sunshine of the open source mind.

http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike




On Wed, May 27, 2009 at 10:40 AM, Action Jackson <[email protected]> wrote:

>
> I have a question regarding queries by criteria.  I have the following
> entity:
>
> public class MyEntity
> {
>   public virtual SubType Type { get; private set; }
>   public virtual Difficulty DifficultyLevel { get; private set; }
>   public virtual Category Category { get; private set; }
>   public virtual int Id { get; private set; }
> }
>
> When I run the following query:
>
> public IEnumerable<MyEntity> Search(SearchCriteria criteria)
> {
>   return _baseRepository.Session
>     .CreateCriteria(typeof (MyEntity))
>     .Add(Restrictions.Eq("SubType", criteria.SubType))
>     .Add(Restrictions.Eq("DifficultyLevel", criteria.Difficulty))
>     .SetResultTransformer(Transformers.AliasToBean(typeof(MyEntity)))
>     .List<MyEntity>();
> }
>
> SELECT
> this_.Id as Id39_0_,
> this_.SubTypeID as SubType2_39_0_,
> this_.DifficultyLevelID as Difficul3_39_0_,
> this_.CategoryID as Category4_39_0_
> FROM tbMyEntities
> this_
> WHERE this_.SubTypeID = @p0 and this_.DifficultyLevelID = @p1
>
> @p0 is 0 and @p1 is the correct value that I set.  However, I was
> under the impression that queries by criteria ignored the primary ID.
> Why is it not ignoring? Thanks for any help.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to