To clarify a bit (based on recent findings) ...
I have several generic entity classes that look like (greatly simplified)...
public class Foo<T>
{
protected string m_id;
protected string m_name;
protected T m_value;
protected IList<T> m_values;
public Foo()
{
Random rand = new Random();
m_values = new List<T>();
for (int i = 0; i < 10; i++)
{
m_values.Add(default(T));
}
}
public Foo(string _name, T _value) : this()
{
m_name = _name;
m_value = _value;
}
public virtual IList<T> Values
{
get { return m_values; }
set { m_values = value; }
}
public virtual string Id
{
get { return m_id; }
set { m_id = value; }
}
public virtual string Name
{
get { return m_name; }
set { m_name = value; }
}
public virtual T Value
{
get { return m_value; }
set { m_value = value; }
}
}
and I am trying to create a correct mapping file. There seems to be conflicting opinions regarding the general support of generics in 1.2RC1 (which may be caused by the close ties to Hib). Either way, there are suggestions out there that specify adding either '1 or '1[System.Int32] to the class name definition in the hbm file.
Then to confirm, I found a unit test in the NHib src (NHibernate.Test.GenericTest.Overall) that seemed to further suggest that a class declaration of <class name="A`1[System.Int32]" table="A"> in the hbm file should do the trick (at least for cases when <T> = <int> -- baby steps :-) ...
That was until I saw this in the unit test ...
[Ignore( "Generic entities not supported" )]
So I am back to the beggining, wondering if there is support for generic classes or just for generic lists ?
Thanks in advance...
Jeff
|