views:

29

answers:

0

I have the following entities.

class Parent
{
  public virtual int ID {get; set;}
  public virtual string Key {get; set;}
  public virtual string Type {get; set;}
  public virtual string Value {get; set;}
  public virtual IList<Child> Children {get; set;}
}

class Child
{
  public virtual int ID {get; set;}
  public virtual string ParentKey {get; set;}
  public virtual string ParentType {get; set;}
  public virtual string ParentValue {get; set;}
}

I have to map one-to-many between Parent and Child such that each Parent should contain a list of child where Child.ParentKey = Parent.Key and Child.ParentType = Parent.Type.

How can this be achieved in NHibernate without changing the database schema?