Hello

Someone found that problem then before I got chance to fix it typical :o)
Basically inorder to Automap inheritence mappings it assumes that your base
object is object if not then it maps it as an inherited joined class.

I'll work on a fix and get it over to you.

Andy

On Mon, Dec 15, 2008 at 4:14 AM, Nate Kohari <nkoh...@gmail.com> wrote:

>
> Hey guys,
>
> First off, you rock. I've been using Fluent NHibernate for manual
> mappings for awhile now, but I decided to give the
> AutoPersistenceModel a shot for a new project.
>
> Unfortunately, I've run into a problem that's really confusing. I have
> an abstract class called Entity that acts as a layer supertype for my
> entities. It also implements IEntity, which is the simple contract
> that defines what entities can do.
>
> Here's the code I use to set up my AutoPersistenceModel:
>
> var conventions = new Conventions
> {
>        GetPrimaryKeyName = type => type.Name + "Id",
>        GetForeignKeyNameOfParent = type => type.Name + "Id",
>        GetForeignKeyName = property => property.Name + "Id",
>        GetTableName = type => Inflector.Pluralize(type.Name),
>        GetManyToManyTableName = (child, parent) => Inflector.Pluralize
> (child.Name) + "To" + Inflector.Pluralize(parent.Name)
> };
>
> var model = AutoPersistenceModel.MapEntitiesFromAssemblyOf<IEntity>()
>        .WithConvention(conventions)
>        .Where(type => typeof(IEntity).IsAssignableFrom(type) &&
> type.IsClass
> && !type.IsAbstract);
>
> However, my app was giving me errors, saying that "Entities" couldn't
> be found. When I dumped the NHibernate mappings to disk to see what
> was going on, I realized the AutoPersistenceModel was creating a
> single mapping for the Entity class, and making my actual entities
> joined-subtypes of the Entity:
>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-
> lazy="true" assembly="Project.Model"
> namespace="Project.Model.Framework">
>  <class name="Entity" table="Entities" xmlns="urn:nhibernate-
> mapping-2.2">
>    <id name="Id" column="IdId" type="Int32">
>      <generator class="identity" />
>    </id>
>    <joined-subclass name="Project.Model.Entities.User, Project.Model,
> Version=0.1.0.0, Culture=neutral, PublicKeyToken=null">
>    ...
>    </joined-subclass>
>   (repeated for each of my entities)
>  </class>
> </hibernate-mapping>
>
> Any ideas?
>
>
> Thanks,
> Nate
> >
>


-- 
=================
I-nnovate Software - Bespoke Software Development, uk wirral.
http://www.i-nnovate.net

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@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