mapper.CompileMappingFor() is not generating mapping

49 views
Skip to first unread message

Quicoli

unread,
May 27, 2011, 4:03:49 PM5/27/11
to ConfORM
Hi friends,

I'm using last version, and my mapping routine is like this:

var orm = new ObjectRelationalMapper();
var patternsAppliers = new SafePropertyAccessorPack();

patternsAppliers.Merge(new IdNamingApplier());
patternsAppliers.Merge(new
CoolPatternsAppliersHolder(orm));
patternsAppliers.Merge(new
OneToManyKeyColumnNamingApplier(orm));
patternsAppliers.Merge(new
ManyToOneColumnNamingApplier());

var mapper = new Mapper(orm, patternsAppliers);

IEnumerable<Type> baseEntities =
typeof (Categoria).Assembly.GetTypes().Where(t =>
(t.Namespace == typeof (Categoria).Namespace));

orm.Patterns.Lists.Remove(orm.Patterns.Lists.Single(p => p.GetType()
== typeof(ListCollectionPattern)));

orm.Patterns.PoidStrategies.Add(new HighLowPoidPattern(new
{ max_lo = 100 }));
orm.Cascade<Documento,
Indexacao>(Cascade.All.Include(Cascade.DeleteOrphans));

//this is returning a not null object, but this object is
empty, no mappings within it.
HbmMapping mappingDocument =
mapper.CompileMappingFor(baseEntities);

nhConfig.AddDeserializedMapping(mappingDocument,
"Classes");

if (salvarXml)
{
var arquivos =
mapper.CompileMappingForEach(baseEntities);
arquivos.WriteAllXmlMapping();
}

So, as CompileMappingForEach is not returning any mapping, no database
is updated :(

I cant figure out what is wrong here, because in another projetct,
doing same way, is ok.

Someone can point me out to right way?

thanks

Paulo Quicoli

unread,
May 27, 2011, 4:22:03 PM5/27/11
to ConfORM
Friends,

I've found out! 

this is missing: 
orm.TablePerClass(baseEntities);

But I thought that was a default setting...

anyway..

thanks!

2011/5/27 Quicoli <pauloq...@gmail.com>



--
Paulo Quicoli
Editor Técnico: .NET Magazine, ClubeDelphi Magazine; Editor: WebMobile Magazine
www.devmedia.com.br
www.nhibernatebrasil.net
http://pauloquicoli.spaces.live.com
twitter:@pauloquicoli

Fabio Maulo

unread,
May 28, 2011, 8:47:58 AM5/28/11
to codec...@googlegroups.com
Paulo,
In ConfORM there isn't a default yo define the strategy for a hierarchy.
--
Fabio Maulo

Reply all
Reply to author
Forward
0 new messages