August 2005 - Posts

I posted this article on a simple way to improve performance in ASP .net applications using Paladin.

Please feel free to comment or give some further ideas on the topic.

http://community.sgdotnet.org/blogs/hannes/articles/19159.aspx

I just made the leap from Paladin RC1 to RC3.

The biggest change in code for me is the usage of FilterList's, but I agree with the change.

I use filters everywhere, but most often as a singular equals comparison. For this reason I created this class to save some typing.  Just note that logical AND is used between filters for this class.

public class FilterListEqual : FilterList
{
   
public FilterListEqual(string fieldname, object equalvalue)
      : base(new Filter(fieldname, Comparison.Equals, equalvalue)) {}

   public Filter Add(string fieldname, object equalvalue)
   {
      if (this.Count == 0)
      {
         return base.Add(fieldname, Comparison.Equals, equalvalue);
      }
      else
      {
         return base.Add(Logical.And, fieldname, Comparison.Equals, equalvalue);
      }
   }
}

Yep, that's it. The usage for a single equals comparison would then be:

BusinessComponent BC = new BusinessComponent;
BC.Populate(BudgetList, new FilterListEqual(epcdb.Budget.FieldNames.name, "Budget 2005"));

The overloaded Add method can be used to add more filters, or you could create more overloaded constructors.