Rest of the mapping goes like this
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.AutoMap.Alterations;
using FluentNHibernate.AutoMap;
using NHibernate.Mapping;
namespace Data.NHibernateMaps
{
public class ExamMaps : IAutoMappingOverride<A>
{
public void Override(AutoMap<A> mapping)
{
mapping.WithTable("A");
mapping.Id(x => x.Id, "AID")
.WithUnsavedValue(0)
.GeneratedBy.Identity();
mapping.HasMany<C>(x => x.C)
.Inverse()
.KeyColumnNames.Add("AID")
.AsList();
mapping.WithTable("ExamCATDetail", x => {
x.Map(m => m.MinNoItem);
x.Map(m => m.MaxNoItem);
});
}
}
}
On Aug 20, 12:53 pm, James Gregory <[email protected]> wrote:
> Lets see the rest of your mapping.
>
>
>
> On Thu, Aug 20, 2009 at 8:51 AM, Sachin <[email protected]> wrote:
>
> > I had created few properties in my class which I am trying to get
> > populated by some other table in my database.
> > I wrote following in my mappings
> > mapping.WithTable("B", x => {
> > x.Map(m => m.MinNoItem);
> > x.Map(m => m.MaxNoItem);
> > });
>
> > And i got following error
> > Duplicate property mapping of MinNoItem found in A
>
> > Any suggestions
>
> > On Aug 20, 11:02 am, Sachin <[email protected]> wrote:
> > > Hi James
> > > yea you are right that isnt FNH.
> > > I am using 1.0.0 version thats why I am not getting Join method, so I
> > > was just checking if NH Join method can help me.
>
> > > From the Brendan's solution I figured it out.
> > > Please correct me
>
> > > mapping.WithTable("A", x => x.Map(m => m.AID));
>
> > > Thanks!
>
> > > On Aug 19, 5:03 pm, James Gregory <[email protected]> wrote:
>
> > > > What on earth is that? That isn't Fluent NHibernate.
>
> > > > On Wed, Aug 19, 2009 at 1:02 PM, Sachin <[email protected]>
> > wrote:
>
> > > > > Join j = new Join();
> > > > > Property prop=new Property();
> > > > > NHibernate.Mapping.Table tb=new Table("A");
> > > > > prop.Name = "Name";
> > > > > j.Table = tb;
> > > > > j.AddProperty(prop);
>
> > > > > I am using S#arp architecture and I am defining the mappings in
> > > > > override method of
> > > > > FluentNHibernate.AutoMap.Alterations.IAutoMappingOverride<>
>
> > > > > I can not find any Join method in the API, I am using 1.0.0
>
> > > > > after reading your last post I guess answer to my question is
> > > > > WithTable as I am using 1.0.* version
>
> > > > > On Aug 19, 4:50 pm, James Gregory <[email protected]> wrote:
> > > > > > WithTable is what it was called prior to 1.0, it's now just called
> > Join;
> > > > > > same signature, different name.
>
> > > > > > On Wed, Aug 19, 2009 at 12:48 PM, Brendan Erwin <
> > [email protected]
> > > > > >wrote:
>
> > > > > > > Hmm. I was going to say "WithTable". What's the difference?
>
> > > > > > > Sent from my iPhone
>
> > > > > > > On Aug 19, 2009, at 6:28 AM, James Gregory <
> > [email protected]>
> > > > > > > wrote:
>
> > > > > > > Using the Join method?
> > > > > > > Join("Address", m =>
> > > > > > > {
> > > > > > > m.Map(x => x.Address);
> > > > > > > });
>
> > > > > > > On Wed, Aug 19, 2009 at 10:53 AM, Sachin < <
> > [email protected]>
> > > > > > > [email protected]> wrote:
>
> > > > > > >> Hi
> > > > > > >> How can I implement new feature introduced in NH 2.1 where in I
> > can
> > > > > > >> map columns of different tables into one entity, using FNH.
> > > > > > >> using NH mapping files I can specify it using
>
> > > > > > >> <join table="ADDRESS">
> > > > > > >> <key column="ADDRESS_ID"/>
> > > > > > >> <property name="address"/>
> > > > > > >> <property name="zip"/>
> > > > > > >> <property name="country"/>
> > > > > > >> </join>
>
> > > > > > >> Any suggestions.
>
> > > > > > >> Thanks- Hide quoted text -
>
> > > > > > - Show quoted text -- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---