Maybe, maybe not...I still have a problem with it and evenutally the
entity-name attribute may solve it, or maybe there is (how often)
another simpler solution.
Let's assume i have a mapping like this:
<class name="UseCasePresentationTree"
proxy="Core.UseCasePresenter.Definition.IUseCasePresentationTree,
Core.UseCasePresenter"
table="C_UCP_TREE">
<id name="ID" column="C_UCP_TREE_ID" type="Int32" unsaved-value="0">
<generator class="assigned"></generator>
</id>
<set name="Nodes" cascade="all" generic="true" lazy="false" fetch="join"
inverse="false">
<key column="C_UCP_TREE_ID"/>
<one-to-many class="UseCasePresentationTreeNode"/>
</set>
</class>
<class name="UseCasePresentationTreeNode"
proxy="Core.UseCasePresenter.Definition.IUseCasePresentationTreeNode,
Core.UseCasePresenter"
table="C_UCP_TREE_NODE">
<id name="ID" column="C_UCP_TREE_NODE_ID" type="Int32"
unsaved-value="0">
<generator class="assigned"></generator>
</id>
</class>
and the interfaces are defined like this:
public interface IUseCasePresentationTree
{
IList<IUseCasePresentationTreeNode> Nodes { get;set; }
}
If I implement the IUseCasePresentationTree class as
...
protected IList<IUseCasePresentationTreeNode> = new
List<IUseCasePresentationTreeNode>();
...
public IList<IUseCasePresentationTreeNode> Nodes
{
get { return m_Nodes; }
protected set { m_pNodes = value; }
}
then NH throws an Invalid Cast exception. Maybe i do something wrong, but if
i change my mapping and do something like this
...
<set name="ImplNodes" cascade="all" generic="true" lazy="false" fetch="join"
inverse="false">
<key column="C_UCP_TREE_ID"/>
<one-to-many class="UseCasePresentationTreeNode"/>
</set>
protected IList<UseCasePresentationTreeNode> = new
List<UseCasePresentationTreeNode>();
...
public IList<UseCasePresentationTreeNode> ImplNodes
{
get { return m_Nodes; }
protected set { m_pNodes = value; }
}
public IList<IUseCasePresentationTreeNode> Nodes
{
get
{
return m_Nodes.Cast<IUseCasePresentationNode>().ToList();
}
}
it works as expected. So for me it looks like NH does n't see the connection
between the Interface and the Implementation
if it is used in associations. Is the use of the new entity-name attribute a
solution for this or am i completly wrong?
2009/6/14 Fabio Maulo <[email protected]>
> 2009/6/13 Volker Röppischer <[email protected]>
>
>> Thanks, this is very interessting stuff :-) When is the 2.1.0 release
>> official available?
>
>
> For your needs ?
> It was released.
>
> --
> Fabio Maulo
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---