I am not sure whether this has been mentioned before, but I did search
both the newsgroup as well as the google.code.com issues, and I did
not find it.

I think it would make more sense to do column names for components top
down instead of bottom up (like the ones used for classes)

Let's take the following (stupid, but representative) example

public class City {
   int Id {get;set;}
  string Zip {get;set;}
  string Name {get;set;}
}

public class Address {
  public virtual string Street {get;set;}
  public virtual string Nr {get;set;}
  public virtual City City {get;set;}
}

public class Coordinate {
  public virtual Address Home {get;set;}
  public virtual Address Work {get;set;}
}

public class Contact {
  public virtual string Name {get;set;}
  public virtual Coordinates Coordinates {get;set;}
}

Let's say that we define "Contact" and "City" as regular classes and
"Address" and "Coordinate" as components
I would say that select the components' column names top-down would be
more intuitive then the way it is now (i.e. having only the current
PropertyInfo available).
A simple fix could be to include the Parent Propertyinfo for each
propertyinfo in the column name mapping.

So we could have the following column name convention for
properties :
var p = prop.ParentPropety;
var n = prop.Name;
while (p != null && p.ParentProperty.IsComponent)
{
    n = p.Name + n;
    p = p.ParentProperty;
}
This would need to be called separately for each class where the
component would be included.

This would result in the following column names for the Contact class:
- Name
- CoordinateHomeStreet
- CoordinateHomeNr
- CoordinateHomeCityId
- CoordinateWorkStreet
- CoordinateWorkNr
- CoordinateWorkCityId

Which would be what most of the people would need IMHO.

Please let me know what you think about this idea.

Kind regards,

Tom Janssens

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibern...@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to