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
-~----------~----~----~----~------~----~------~--~---