i have a legacy database (which is still used by another legacy application) where the group is denormalized and duplicated into the child rows
table parent
(
id
)
table child
(
id
parent_id
group_id
group_name
group_Flag
group_type
name
)
and i would like to map them to
class Parent
{
public long Id { get; private set; }
public ICollection<Group> Groups { get; private set; }
}
class Group
{
public long Id { get; set; }
public string Name { get; set; }
public GroupType Type { get; set; }
public bool Flag { get; set; }
public ICollection<Child> Childs { get; private set; }
}
class Child
{
public long Id { get; private set; }
public string Name { get; set; }
}
- Is this possible?
- How to do that in any of NHibernate's mapping methods (xml, MbC, Fluent, ...)
Update: Some additional info
- the schema can't be changed because of the legacy application
- additional views in the database are an option
- leaking in the class model is possible