Using Fluent NHibernate's AutoPersistenceModel but with eager loading in a single object -
I am using Fluent NHibernate to automatically map my organizations.
This code is being used for automatic mapping:
New autoprocessorsmodel () .EndityAssembendi (assembly.getAssamband (typef (unit))). Type (type = & gt; Type Nameshot.Resource ("domain") and type.bass type! = Null & amp; typeBasTap.Name. Start ("DomainInTT") & amp; amp; ; Type.BaseType.IsGenericType == true). Setup (s => IsBaseType = (type => type.Name.StartsWith ("DomainEntity") & Type.IsGenericType == true) ). ConventionDiscovery.Add (ConventionBuilder.Id.Always (x = & gt; x.GeneratedBy.Increment ())); It just works fine. But now I am curious loading in a single object of my domain. found it . But when I add the line to . Type the program & lt; Loading IEager & gt; (Map = & gt; map.No.Losol load ()) run the code and I get the following exception to run it:
- Loading of IEager Error
While trying to create a mapping document, note that I am using an interface ( IEager loading ) to mark objects Whom I want to load anxious
Can anyone help in doing this? Remember that I want to keep automatic mapping functionality.
Thank you
The problem is you are killing that ForTypesThatDeriveFrom & lt; T & gt; A little misleadingly named, and it really means ForMappingsOf & lt; T & gt; , so it's a ClassMap & lt; IEager loading & gt; which clearly does not exist.
I believe that you should be able to manage it with custom IClassConvention This is far from the top of my head, but should work:
Public category EagerLoading Conference: ICLASamp (Accept Public Child (ICSLSmap Target) {GetType ()). GetInterfaces (). This includes (IEagerLoading); } Apply Public Zero (ICSMSMap Target) {target.Not.LazyLoad (); }}
Comments
Post a Comment