how to map ilist<string> variable which is a member of multiple classes using automapping

glant's Avatar

glant

21 Aug, 2010 07:36 PM via web

suppose i have classes of structure similar to this.

public class baseclass
{

public virtual string Id;
public virtual ilist<string> mStrList;
public baseclass()
{
    mStrList = new list<string>();   
}

}

public class class1 : baseclass
{

}

public class class2 : baseclass
{

}

Saving the objects of type class1 and class2 will FAIL. The reason is when table for mStrList is created the class1_id and class2_id fields are defined as non-nullable but at any time when row is saved only one fk_id can be populated and this cause the save operation to fail. (TESTED in MySql).

I was wondering there was a way to do this is automapping using overrides or something. Currenltly working with hbm.xml mapping files setting property nullable as false

    Reply to this discussion

    Preview Comments are parsed with Markdown. Help with syntax

    Attached Files

      You can attach files up to 10MB

      What comes next? 'Monday Tuesday Wednesday ?????'