test code snippet

protected virtual ICriterion WhereInactiveDateIsNull
{
get
{
return Restrictions.IsNull("InactiveDate");
}
}

protected virtual IList<Entity> GetAllItems(params ICriterion[] criterion)
{
ICriteria getCriteria = Session.CreateCriteria(typeof(Entity));

if (criterion != null)
{
foreach (var criteria in criterion)
{
getCriteria.Add(criteria);
}
}

return getCriteria.List<Entity>();
}

public virtual IList<Entity> GetAll()
{
return GetAllItems();
}

public virtual IList<Entity> GetActiveItems()
{
return GetAllItems(WhereInactiveDateIsNull);
}

public virtual IList<Entity> GetItemsLikeName(string name, string columnToCompareBy)
{
ICriterion whereColumnValueStartsWithNameIgnoringCase
= Restrictions.Like(columnToCompareBy, name, MatchMode.Start).IgnoreCase();

return GetAllItems
(
WhereInactiveDateIsNull,
whereColumnValueStartsWithNameIgnoringCase
);
}

Related Articles:

    Post Footer automatically generated by Add Post Footer Plugin for wordpress.

    About Sean Biefeld

    Hello all, my name is Sean Biefeld. I graduated from Baylor University with a BBA in Management Information Systems. I am currently working for McLane Advanced Technologies . The opinions expressed by me, however accurate they may be, are not necessarily those of my employer. I have been a developing software professionally since 2004. My primary development focus is on HTML, CSS, JavaScript and C#. I dabble in a little PHP and Ruby. This blog is a forum for me to post my experiences, ideas, rants, and thoughts as I traverse the mountain of life.
    This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.