This is a S#arp arch issue.
I have raised it on the S#arp arch list here:

http://groups.google.com/group/sharp-architecture/browse_thread/thread/1
1f4ef8b02ce621f?hl=en


-----Original Message-----
From: fluent-nhibernate@googlegroups.com
[mailto:fluent-nhibern...@googlegroups.com] On Behalf Of Filip Zawada
Sent: 19 May 2009 13:09
To: Fluent NHibernate
Subject: [fluent-nhib] Conventions with manual FNH maps


Does conventions work with manual FNH maps?

I use a convention that sets the length of every string property that
has the name "Description".
In hbms I see that it gets applied. I use model.WriteMappingsTo
(DBScriptsPath); to emit hbms.
The NH Configuration object doesn't have corresponding attribute. I
first saw it when trying to use
new NHibernate.Tool.hbm2ddl.SchemaExport(cfg).Execute(true, false,
false, true, null,
                new StreamWriter(DBScriptsPath + "DbSchema.sql")). The
generated schema has the FNH default string length (255). It works
however with automapping (when I comment out the definition of
ClassMap<MyClass>).

If it matters, in tests I use following for initialization:
model = new AutoPersistenceModelGenerator().Generate();
            model.CompileMappings();
            string[] mappingAssemblies =
RepositoryTestsHelper.GetMappingAssemblies();
            cfg = NHibernateSession.Init(new SimpleSessionStorage
(FactoryKey), mappingAssemblies,
                model, "../../../../app/AppName.Web/
NHibernate.config");

NHibernateSession is a class from SharpArch which does nothing
special:
Fluently.Configure(cfg)
                .Mappings(m => {
                    foreach (var mappingAssembly in mappingAssemblies)
{
                        var assembly = Assembly.LoadFrom
(MakeLoadReadyAssemblyName(mappingAssembly));

                        m.HbmMappings.AddFromAssembly(assembly);
                        m.FluentMappings.AddFromAssembly(assembly);
                    }

                    if (autoPersistenceModel != null) {
                        m.AutoMappings.Add(autoPersistenceModel);
                    }
                })
                .BuildSessionFactory();



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