Is this possible? Or must a use a combination of QBE & QBC? Below is my class:
public class Persona { public virtual int PersonaID { get; set; } public virtual string Name { get; set; } public virtual string Description { get; set; } public virtual int Level { get; set; } public virtual int Strength { get; set; } public virtual int Magic { get; set; } public virtual int Endurance { get; set; } public virtual int Agility { get; set; } public virtual int Luck { get; set; } }
What I'd like to do is perform a LIKE search against string properties and perform a range search search against the int properties. Currently, my code is as follows:
IList<Persona> personas = session.CreateCriteria(typeof(Persona)) .Add(Example.Create ( new Persona() { Name = name } ) .IgnoreCase() .EnableLike(MatchMode.Anywhere) .ExcludeProperty("ModifiedOn") .ExcludeZeroes()) .Add(Expression.Ge("Strength", 3)) .List<Persona>();
but I was wondering if there is a way to use only QBE? In doing so, I could eliminate the need to add additional logic to see if the user has provided a min/max value for Strength, Agility, etc and adding QBC's if values exist.
|