Ignore public/internal fields for NHibernate proxy

前端 未结 5 1190
鱼传尺愫
鱼传尺愫 2021-02-12 19:20

I have some entity types that I would like to lazy load. However, they have some internal (assembly) fields they expose, but are not used outside that class. These fields are co

5条回答
  •  旧巷少年郎
    2021-02-12 19:49

    I reassembled NHibernate (easier than getting the source and rebuilding) and removed the code that errors on internal/public fields. LazyLoading appears to work just fine without that check. (Although, I'm new to NHibernate and so there are probably scenarios I don't know about.)

    Edit: Ah, there is a property, "use_proxy_validator" that will disable all validation checks. Good enough.

    Fluently.Configure()
        .ExposeConfiguration(fun cfg -> 
            cfg.Properties.Add("use_proxy_validator", "false"))...
    

提交回复
热议问题