+1 for strings ... it also enables using reflection based usage on the API.

From: Fabio Maulo 
Sent: Thursday, April 28, 2011 12:20 PM
To: [email protected] 
Subject: [nhibernate-development] Mapping by-code protected/private members
To explicit map private field I done this
ca.Property(ForClass<MyClass>.Field("something"), map => map.Length(150)); 

To explicit map private/protected properties I should do something like this
ca.Property(ForClass<MyClass>.Property("Something"), map => map.Length(150));

The matter is that at the end, if we don't want an "invasion" to the users 
domain-model (and I would always avoid it), we end with a string representing 
the private/protected member-name.
Using the ConventionModelMapper there is "no problem" if the user can accept to 
write the mapping catching that member in the BeforeMapProperty event (or 
similar for others relations).

I would introduce a short-cut
ca.Property("Something", map => map.Length(150));

Thoughts ?

-- 
Fabio Maulo

Reply via email to