Just using:
DetatchedCriteria criteria = DetatchedCriteria.For<Foo>();
criteria.Add(....);

2010/6/18 Mauricio Scheffer <[email protected]>

> Sorry, I don't understand what you mean by "directly". Here are some
> examples of Restrictions usage:
> http://ayende.com/Blog/archive/2009/05/19/nhibernate-queries-examples.aspx
>
> On Thu, Jun 17, 2010 at 7:06 PM, omer katz <[email protected]> wrote:
>
>> So why shouldn't I define a criteria directly?
>>
>> 2010/6/17 Mauricio Scheffer <[email protected]>
>>
>> ARRepository is part of the Rhino Tools project, try asking on
>>> http://groups.google.com/group/rhino-tools-dev
>>> Restrictions is just the NHibernate 2.x class for defining criteria
>>> (used to be Expression).
>>>
>>> --
>>> Mauricio
>>>
>>> On Jun 17, 5:52 am, omer katz <[email protected]> wrote:
>>> > I have this two functions:
>>> >
>>> >  public static List<Language> GetLanguages()
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > > {
>>> >
>>> > >   return new
>>> List<Language>(languageRepository.FindAll(Order.Asc("Name"
>>> > > )));
>>> >
>>> > > }
>>> >
>>> > > public static Language GetLanguageById(Guid id)
>>> >
>>> > > {
>>> >
>>> > >   DetachedCriteria criteria = DetachedCriteria.For<Language>();
>>> >
>>> > >   criteria.Add(Expression.Eq("Id",id));
>>> >
>>> > >   return languageRepository.FindOne(criteria);
>>> >
>>> > > }
>>> >
>>> > I need to upgrade it to the new version.
>>> >
>>> > FindAll now doesn't accept only an order object but needs an array of
>>> > critirias. Why?
>>> >
>>> > FindOne also complains that it can't accept a DetachedCritiria, why?
>>> >
>>> > What are restrictions and how they are different from Critirias?
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Castle Project Users" group.
>>> To post to this group, send email to
>>> [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<castle-project-users%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/castle-project-users?hl=en.
>>>
>>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Castle Project Users" group.
>> To post to this group, send email to
>> [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<castle-project-users%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/castle-project-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To post to this group, send email to [email protected]
> .
> To unsubscribe from this group, send email to
> [email protected]<castle-project-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en.

Reply via email to