Very ¿Simple? question

17 views
Skip to first unread message

mouthbow

unread,
Oct 5, 2012, 5:38:33 AM10/5/12
to nhu...@googlegroups.com
Hi, I'm trying to make a set with special needs and I have read a lot of page without luck.

Lets suppose that I have a mapping of a Sql View

<class name="Namespace.ViewName, Assembly" table="ViewName">

<id name="MyColumnIdOfThisView" column="[MyColumnIdOfThisView]" type="System.Guid">
<generator class="assigned"/>
</id>
<property name="AForeignKey" column="[AForeignKey]" access="field.pascalcase-underscore" not-null="true" type="System.Guid"/>

</class>

And lets suppose that I have other mapping like this:


<class name="Namespace.MyClassName, MyAssembly" table="MyClassName" >

<id name="Id" column="MyClassIdColumnName" type="System.Guid"><generator class="guid"/></id>
<property name="AForeignKey" column="AForeignKey" access="field.pascalcase-underscore" not-null="false" type="System.Guid" insert="true" update="true"/>

</class>


Where AForeignKey from view and AForeignKey from class store the same values, so we can make a inner join but are named different. For example: CaseID, AssociatedID


What I want to do is a mapping of set using this foreign keys. Something like this (in the view)

<set name="MyClassNameList" cascade="none" inverse="true" lazy="true" access="field.pascalcase-underscore">
<Source key>
<column name="CaseID" />
</Source key>
<Target key>
<column name="AssociatedID"/>
</Target key>
<one-to-many class="MyNamespace.MyClassName, GIOFACT_DAL"/>
</set>

Is this possible? 
A lot of thanks in advance!

Best,

Ramon Smits

unread,
Oct 5, 2012, 8:45:36 AM10/5/12
to nhu...@googlegroups.com

Just to understand...

TableEntity {
    Guid Id;
    Guid ForeignId
}


ViewEntity {
   Guid Id;
   Guid ForeignId;
   ICollection<TableEntity> Childs;
}


If you want this result, then yes that is possible.


-- Ramon



--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/XwNxEIW7EugJ.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.

Reply all
Reply to author
Forward
0 new messages