Hi all,

I am trying to move away from Castle AR (have been using it for about 5+ 
years) and learning about mapping by code in NH.

First the problem: Property mapped by ManyToOne appears as <property ...> 
in mapping xml.

Example is City (1) -> Account( many)

************
Here is the code snippet

in AccountMapper
 ManyToOne(x => x.City, m=>
                {
                       m.Class(typeof(City));
                       m.Cascade(Cascade.Persist);
                       m.Fetch(FetchKind.Select);
                       m.Update(true);
                       m.Insert(true);
                       m.OptimisticLock(false);
                       m.Lazy(LazyRelation.Proxy);
                       m.Access(Accessor.Property);
                       m.NotNullable(true);
                       m.ForeignKey("city_id");
                  }
                  );

In CityMapper
                Bag(x => x.Accounts, c =>
                {
                       c.Lazy(CollectionLazy.Lazy);
                       c.Fetch(CollectionFetchMode.Select);
                       c.Key(k => { k.Column("city_id"); });
                       c.Cascade(Cascade.All);
                       c.BatchSize(GSORM.Constants.BatchSize);
                       c.Type(typeof(DomainCollectionFactory<Account>));
                       c.Inverse(true);
                 }, r => r.OneToMany());

Partial mapping xml for Account class
  <class name="Account" lazy="false" table="tbl_account" 
dynamic-update="true" dynamic-insert="true" batch-size="128">
    <id name="Id" type="Guid">
      <generator class="guid" />
    </id>
    <property name="City" />

************
I have my custom collection type (which provides me some features I needed 
for child collections).

Notice that the property City is not mapped using "many-to-one" but as 
"property".

What am I missing there?

Thanks
Vij

-- 
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/-/FsLdSJ3Ad28J.
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.

Reply via email to