Because this has bitten me in the ass more than once.
When using ActiveRecord to query the database the following error occurs:
Failed: Castle.ActiveRecord.Framework.ActiveRecordException : Could not perform SlicedFindAll for ShoppingCart
----> NHibernate.QueryException : could not resolve property: UserId of: MyDomain.Core.ShoppingCart
Problem: The Property values in the criteria are case sensitive.
Where the query looks like this:
public ShoppingCart LoadCurrentBasket(string userId, Guid customerId)
{
DetachedCriteria criteria = DetachedCriteria.For<ShoppingCart>();
criteria.Add(Expression.Eq("UserId", userId));
criteria.Add(Expression.Eq("CustomerId", customerId));
return ActiveRecordMediator<ShoppingCart>.FindFirst(criteria);
}
And the class looks like this:
[ActiveRecord(Table = "Basket")]
public class ShoppingCart
{
private IList<ShoppingCartItem> _LineItems = new List<ShoppingCartItem>();
[PrimaryKey(PrimaryKeyType.Guid)]
public Guid BasketID { get; set; }
[Property("CustomerId")]
public Guid CustomerID { get; set;}
[Property("UserID")]
public string UserID { get; set;}
///
///
///
}