Why would you use Expression<Func> rather than Func?

When you want to treat lambda expressions as expression trees and look inside them instead of executing them. For example, LINQ to SQL gets the expression and converts it to the equivalent SQL statement and submits it to server (rather than executing the lambda). Conceptually, Expression<Func<T>> is completely different from Func<T>. Func<T> denotes a delegate … Continue reading Why would you use Expression<Func> rather than Func?

Advertisements

Abstract class VS interface

What is an Abstract Class? An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot … Continue reading Abstract class VS interface

What’s the difference/advantages between ICriteria and ICriterion in nHibernate?

An ICriteria is used to represent a query. You can add ICriterions to this ICriteria to express filters. For instance: ICriteria crit = session.CreateCriteria (typeof(Person)); crit.Add (NHibernate.Criterion.Expression.Eq("Name", "somename")); Or, as the documentation states: ICriterion: An object oriented representation of a query criterion that may be used as a constraint in an ICriteria query ICriteria: a … Continue reading What’s the difference/advantages between ICriteria and ICriterion in nHibernate?

Compare 2 objects via Billy McCafferty

If two objects have IDs, and have the same IDs, then they may be considered equal without examining them further.  (I'm assuming ID to be an identity field, or equivalent, in the DB.) If two objects have IDs, but have different IDs, than they may be considered not equal without examining them further.  E.g., If customer A has an ID … Continue reading Compare 2 objects via Billy McCafferty