Have you tried ConfORM by Fabio Muolo

http://code.google.com/p/codeconform/

<http://code.google.com/p/codeconform/>John Davidson

On Tue, Apr 12, 2011 at 5:14 PM, mynkow <[email protected]> wrote:

> Hi,
>
> I am trying to map classes by convention. The first try was just to create
> any mapping but I failed with this: *Cannot extend unmapped class:
> System.Object, mscorlib, Version=4.0.0.0* All samples I find use
> ObjectRelationalMap class which I guess is ExplicitlyDeclaredModel
>
> What I am doing wrong? Is it possible to map classes by convention without
> writing a map for each class? How?
>
> public void Configure(string nhConfigPath)
>         {
>             var cfg = new NHibernate.Cfg.Configuration();
>
>             if (File.Exists(nhConfigPath))
>                 cfg.Configure(nhConfigPath);
>
>             var hbm = GetMapping();
>             cfg.AddDeserializedMapping(hbm, "BW.Querying");
>             cfg.BuildSessionFactory();
>         }
>
>         private HbmMapping GetMapping()
>         {
>             var asd = new ExplicitlyDeclaredModel();
>             var types = Assembly
>                 .GetAssembly(typeof(OrganizationQuery))
>                 .GetTypes()
>                 .Where(t => t.Namespace.EndsWith("Query"));
>
>             foreach (var type in types)
>                 asd.AddAsTablePerClassEntity(type);
>
>             var mapper = new ModelMapper(new SimpleModelInspector(), asd);
>             return mapper.CompileMappingFor(types);
>
>             //return mapper.CompileMappingForAllExplicitAddedEntities();
>         }
>
>
> Best regards
>
>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to