Logo

NHibernate

The object-relational mapper for .NET

ProxyGenerators

This page is converted from the old nhforge.org Wiki. Published by: Bill Pierce on 09-23-2008

Introduction

NHibernate ProxyGenerators (NHPG)  is a simple utility that you can use to pre-generate lazy loading proxies for use with NHibernate.  Why would you want to pre-generate lazy loading proxies you ask?  The prime example is to make use of lazy loading functionality in a Medium Trust environment, like a shared hosting ASP.Net environment.  NHibernate will function in a Medium Trust environment but you were previously required to disable lazy loading for all of your entities.  The default behavior of NHibernate is to generate these proxies at runtime during your application's startup, an operation that requires elevated permissions not present under Medium Trust.  NHPG now allows you to generate these proxies in your development or build environment (which should have the required permissions) and deploy them along with the rest of your application's assemblies.

  • How can I start using NHPG right now?
    Learn how to Pre-Generate Lazy Loading Proxies
  • Is NHPG compatible with my NHibernate application?
    NHPG currently requires NHibernate 2.0.1 GA (2.0.1.4001).

    Please note: The version of Castle.Core distributed with NHibernate is not marked with Allow Partially Trusted Callers (APTC). This can cause issues when attempting to use it in a Medium Trust environment. NHPG includes a build of Castle.Core with APTC and this will hopefully be resolved with the Castle Project.
  • Does NHPG depend on Castle ActiveRecord?
    No. The pre-cursor to NHPG had a dependency on Castle ActiveRecord. This is no longer the case and NHPG will work without ActiveRecord assemblies.
  • Can NHPG generate proxies for my Castle ActiveRecord assemblies?
    Yes. Learn how to Pre-Generate Lazy Loading Proxies for ActiveRecord.

    Please note: The trunk Castle ActiveRecordis not marked with Allow Partially Trusted Callers (APTC) it is also built with NHibernate v2.0.0 Beta.NHPG includes a build of Castle ActiveRecord with APTC and NHibernate v2.0.1 GA. This will hopefully be resolved with the Castle Project.
  • I have NHibernate class mappings in multiple assemblies. Can I still use NHPG?
    Yes. Learn how to Pre-Generate Lazy Loading Proxies with multiple class mapping assemblies.
  • I have an infrequently asked question, how do I get an answer?
    Please submit your question to the NHibernate Users group.
  • Where do I report bugs and feature requests?
    Please submit your issues to the NHPG Jira.
© NHibernate Community 2016