Hello,
you can do something like this with Conformist mapping (using
ClassMapping<T> ):
public class ProcedureMap : ClassMapping<Procedure>
{
public ProcedureMap()
{
Bag(x => x.FormTemplates
, map =>
{
/* other settings */
map.Where("IsDeleted = 0");
}
, action => action.ManyToMany());
}
}
Regads
michele
Il 03/01/2012 16:00, Vitaly ha scritto:
> Hello
> Help me, please) I've tried to define many-to-many relation with
> 'where' clause using MappingByCode from NH3.2 but I don't know how can
> I do it.
>
> for example: with FluentNHibernate I can use ChildWhere() method. For
> example:
>
> public class ProcedureMap : ClassMap<Procedure>
> {
> public ProcedureMap()
> {
> this.HasManyToMany(a => a.FormTemplates).ChildWhere("IsDeleted =
> 0").AsSet();
> }
> }
>
> This code will generate next HBM:
>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
> <class xmlns="urn:nhibernate-mapping-2.2" name="Procedure"
> table="Procedure">
> <set name="FormTemplates" table="ProceduresToFormTemplates">
> <key foreign-key="FK_Procedures_FormTemplates">
> <column name="ProcedureId" />
> </key>
> <many-to-many class="FormTemplate" where="IsDeleted = 0">
> <column name="FormTemplateId" />
> </many-to-many>
> </set>
> </class>
> </hibernate-mapping>
>
> How can I get same mapping using MappingByCode from NH3.2?
>
--
http://michelelepri.blogspot.com/
--
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.