What if I want to map reference and pass any type of conditions?

My CompanyDataChanges has starting_date and ending_date,
I want my company to map the last CompanyDataChanges as

WHERE CURRENT_DATE BETWEEN tab_company_data_changes.starting_date AND
COALESCE(tab_company_data_changes.ending_date, CURRENT_DATE)

How could I pass this condition to Fluent NHibernate for mapping?

On 17 Mag, 07:18, Paul Batum <paul.ba...@gmail.com> wrote:
> It looks like your relationship is a one to many, i.e. a company has many
> data changes. I've guessed this based on the fact that CompanyDataChanges
> has a company_id foreign key.
>
> So to map this relationship you should use HasMany:
>
>   HasMany(x => x.CompanyDataChanges)
>      .KeyColumn("company_id");
>
> I am afraid I don't follow all of your problem but maybe this will get you
> closer to a solution.
>
> On Thu, May 13, 2010 at 6:19 PM, Matteo Campo Dall'Orto <
>
>
>
> matteo.campodallo...@gmail.com> wrote:
> > Hi guys,
> > I'm a newbie of Fluent NHibernate, so be patience, please :-)
>
> > I've 2 tabs
>
> > COMPANY
> > company_id                              <-----
> > contract_name
>
> > COMPANY DATA CHANGES
> > company_datachange_id
> > company_id                              <-----
> > corporate_name
> > start_date
> > end_date
> > deleted
>
> > Company has a foreign key company_id ti COMPANY DATA CHANGES.
>
> > I need to build CompanyMapping that has this references and conditions
> > with COMPANY DATA CHANGES:
>
> > company_id,
> > CURRENT_DATE BETWEEN tab_company_data_changes.starting_date AND
> > COALESCE(tab_company_data_changes.ending_date, CURRENT_DATE),
> > deleted = false
>
> > This is my mapping:
>
> > public TCompanyMapping()
> > {
> >   Table("tab_companies");
>
> >   Id(x => x.Id, "company_id");
> >   ContractName(x => x.ContractName, "contract_name");
> >   References(x => x.CompanyDataChanges)
> >      .Not.Nullable()
> >      .Column("company_id");
> > }
>
> > Is there someone who wants to help me?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Fluent NHibernate" group.
> > To post to this group, send email to fluent-nhibern...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/fluent-nhibernate?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Fluent NHibernate" group.
> To post to this group, send email to fluent-nhibern...@googlegroups.com.
> To unsubscribe from this group, send email to 
> fluent-nhibernate+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/fluent-nhibernate?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibern...@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to