At a project I'm working on we're trying some things with Query By
Example.

Let's say we have Cats. A cat has properties like Birthdate, Color,
Sex, Name. If I want to get all black cats it's easy:

Cat cat = new Cat();
cat.Color = Color.Black;
List results = session.CreateCriteria(typeof(Cat))
    .Add( Example.Create(cat) )
    .List();

But the next step is to get all cats which are born between 01/01/2001
and 01/01/2004. Now I can't easily say:

cat.Birthdate = 01/01/2001;

How can I set a 'between' value? What is the best practice for this;
should I send a second and third parameter to my repository which has
start- and enddate?

And what if I cannot set a property directly but only through a
method? Like if i set the PassedAwayDate, my object automatically
fills the Remarks property with some text. But I don't want to get all
cats with that remark, I want to get all cats that are passed away.
How do you guys handle situations where some properties are set that
you don't want to include in the search?

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