Thanks Andrew!

 

Btw, one more question: Is there any way to specify the same definition for
all my version columns? (ex.: all my version columns have the same name and
I have a custom user type that should be used because on the db the version
column is of type timestamp)

 

 

Thanks.

---

Luis Abreu

 

From: fluent-nhibernate@googlegroups.com
[mailto:fluent-nhibern...@googlegroups.com] On Behalf Of Andrew Stewart
Sent: quinta-feira, 8 de Janeiro de 2009 14:00
To: fluent-nhibernate@googlegroups.com
Subject: [fluent-nhib] Re: question on auto mapping

 

Hi Luis 

 

you need to inform automapper that your base type is EntidadeBase rather
than object, something similar 

to below should do the job.

 

         var autoMapper = AutoPersistenceModel

                    .MapEntitiesFromAssemblyOf<ExampleClass>()

                    .Where(t => t.Namespace ==
"FluentNHibernate.AutoMap.TestFixtures.SuperTypes")

                    .WithConvention(c =>

                                        {

                                            c.IsBaseType = b => b ==
typeof(EntidadeBase);

                                        });

 

Cheers

 

Andy

 

On Thu, Jan 8, 2009 at 12:27 PM, Luis Abreu <lab...@gmail.com> wrote:


Hello guys.

I've got a stupid question regarding the auto mapping functionality. I have
the following:

 private static PersistenceModel ObtemAutoConfiguracao()
       {
           return
AutoPersistenceModel.MapEntitiesFromAssemblyOf<Disciplina>()
               .Where(
                           type => type == typeof(Disciplina)
               ) //comecar com disciplina
               .WithConvention(convention =>
                                   {
                                       convention.DefaultLazyLoad = false;
                                       convention.FindIdentity = field =>
field.Name == "Id";
                                       convention.GetTableName = type =>
String.Concat(type.Name, "s");
                                       convention.GetVersionColumnName =
type => "Versao";
                                       convention.GetPrimaryKeyNameFromType
= type => String.Concat("Id", type.Name);
                                   });
       }

Now, I'm just trying to run a simple test to check the mapping of a single
class (Disciplina). I was under the impression that the lambda I've passed
to the where method should be more than enough for testing only the
Disciplina class. My problem is that Disciplina inherits from EntidadeBase
(which defined the Id and Version properties shared by all the entities) and
the autopersistence model insists in generating an insert into EntidadeBases
table when I use the Persistence Specification to test the mappings.

Can anyone tell me why this happens and how to solve this? Can't I use
inheritance in my classes and auto mapping? Thanks.


---
Luis Abreu









-- 
=================
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