1
votes

I have a mapping assembly called MyApp.Mapping.dll which maps lots of entities and I also have the following mapping:

public class UserMap : ClassMap<User>
//(...)
HasManyToMany(p => p.Roles).Not.LazyLoad()
//(...)

The Roles association is mapped as not lazyload for whatever reason.

For a ver specific reason I want to Lazy map this association and for what I have researched, it is not possible to fetch a eager mapped association as Lazy in a Criteria.

So the question is:

Can I create another mapping class in another assembly that overrides UserMap mapping so that I can reuse MyApp.Mappings.dll for other entities?

1

1 Answers

0
votes

you can build up the configuration object and then

var roles = config
    .GetClassMapping(typeof(User))
    .GetProperty("Roles");

roles.IsLazy = false;

config.BuildSessionFactory();

Hope that helps