Alright, I'm stumped. I have everything working fine with normal FNH,
but once I tried to spike automapping I ran into an issue. In my
project I have a base class for all of my entities like so:

public abstract class BaseEntity
{
        public virtual int? Id { get; set; }
        public virtual DateTime? DateCreated { get; set; }
        public virtual DateTime? DateLastModified { get; set; }
        public virtual DateTime? DateDeleted { get; set; }
}

So an example of one of my entities would be:

public class Foo : BaseEntity
{
        public virtual string Name { get; set; }
}

Finally, my autopersit setup looks like so:

var persistanceModel = AutoPersistenceModel
    .MapEntitiesFromAssemblyOf<Foo>()
    .Where( t=> t.Namespace == "MyNamespace" && t.Name !=
"BaseEntity" )
    .ForTypesThatDeriveFrom<BaseEntity>( t=>
                                         {
                                                t.Id( e => e.Id, "Id" );
                                                t.Map( e=> e.DateCreated );
                                                t.Map( e=>
e.DateLastModified );
                                                t.Map( e=> e.DateDeleted );
                                         } );

The problem I've encountered is that when NH goes to generate its
query, it comes up with something like so:

SELECT
        this_.BaseEntityId as Id0_0_,
        this_1_.DateLastModified as DateLast2_0_0_,
        this_1_.DateDeleted as DateDele3_0_0_,
        this_1_.DateCreated as DateCrea4_0_0_,
        this_.Name as Name0_0_
FROM
        Foo this_
        inner join [BaseEntity] this_1_
                on this_.BaseEntityId=this_1_.Id

This will not work as my table structure is simply:

Foo
 - Id
 - Name
 - DateCreated
 - DateLastModified
 - DateDeleted

Like I said, I have everything working with ClassMap, it is only when
I try to use AutoPersistence that the issue arises... so two
questions:
1) How do I configure things so that BaseEntity is not assumed to be
another table?
2) How do I configure things so that the Id property maps to the "Id"
column, rather than (the non-existent) "BaseEntityId" column?

Thanks!
--~--~---------~--~----~------------~-------~--~----~
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