views:

16

answers:

0

Hi,

I made a commen on this question: http://stackoverflow.com/questions/2761255/extending-fluent-nhibernate-mappings-in-another-assembly

The person who asked that question got misunderstood and I want to know if its possible to do what he asks.

Simply put:

Running application with an entity

 public class Product
 {
   public virtual string Title { get; set;}
 }

Later on I want to customize my Product class and add some properties and some relations

public class CusProduct : Product
{
  public virtual string CustomField { get;set;}
  public virtual IList<Project> Projects {get;set}
}

Is it possible with nhibernate to add this mapping after the application has been running for a while? And what I mean by that is, can I add this extended mapping, and retrieve an exsiting Product and set the new custom properties? From my tests it cannot be done because the existing product is a Product and NOT a CusProduct thus the extended mappings cannot be set, so simply put is there any other way to add fileds to an existing class?

Is there any one-to-one mapping I should use instead to accomplish this?

related questions