Hi,

Nik Govorov wrote:
> In last year there is a tendency to use technologies of strongly typed
> querying such as LINQ and QueryOver, and it's cool.
> But, unfortunately, these technologies do not support the
> encapsulation of entity properties, in contrast to the classical HQL
> and CriteriAPI(with theirs "magic string" nature). 

I've run into this problem when using Linq queries and for a few cases
I've added a static property or method to the domain class that returns
an Expression<Func<Type,Result>> witch i can use in queries like this:

class Person
{
        public static
        Expression<Func<Person, bool>> HasChildrenExpression
        {
            get
            {
                return p => p.Children.Count() > 0;
            }
        }
}

and now i can say

db.Linq<Person>().Where( Person.HasChildrenExpression )


I know it's not perfect and it still requires you to modify the object
but personally i like it better than InternalsVisibleTo.

Hope it helps,
Eti

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to