These classes have some similar methods but seem to work slightly different.
What’s the difference between them and when should I use each of them?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Detached criteria can be built up without reference to an
ISession. You can later take that criteria and apply it to anISessionto get an executableICriteria.Use
ICriteriawhen you have a session.Use
DetachedCriteriawhen you’re not sure against what session the query will be executed.Note that
DetachedCriteriadoes not implementICriteria— they are not interchangeable. You must always calldetachedCriteria.GetExecutableCriteria(session)to get anICriteriainstance.