Hi Luis
Ahh, that makes sense now my fault on the understanding. In that case your
only option is to manually map the Version for each class.
If you have time though and we're always willing to except a patch for the
problem, you would need to ammend the AutoMapVersion class.

Cheers

Andy

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

>
> Hello again.
>
>
> One quick thing, it seems at the moment, the property that timestamps must
> be called version or timestamp, otherwise you'll have to manually map it.
>
> I tried using Timestamp but then NH tries to use datetime. That's why I'm
> using a custom user type and it seems like it's working (at least the
> PersistenceSpecification isn't throwing any errors.
>
> So, what I need is to add this from my manual mapping class:
>
>
> Version(d => d.Versao)
>                .TheColumnNameIs("Versao")
>                .SetAttributes(
>                            new Attributes
>                                      {
>                                          {"type",
> "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
>                                          {"unsaved-value", "null"},
>                                          {"generated", "always"}
>                                      }
>                );
>
> So that it is applied to all the types that derive from EntidadeBase class.
> I tried this:
>
> var modeloPersistencia =
> 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);
>                                         convention.IsBaseType = type =>
> type
> == typeof (EntidadeBase);
>                                    });
>            modeloPersistencia.ForTypesThatDeriveFrom<EntidadeBase>(
>                eb =>
>                    eb.Version(d => d.Versao)
>                          .TheColumnNameIs("Versao")
>                          .SetAttributes(
>                          new Attributes
>                              {
>                                  {"type",
> "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
>                                  {"unsaved-value", "null"},
>                                  {"generated", "always"}
>                              }
>                          ));
>
> But by doing this it insists on generating a class definition for
> Entidadebase....
>
> Thanks.
>
> Luis
>
>
>
> >
>


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