|
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionPeople who use NHibernate know that in order to take advantage of its lazy-loading facility, all public members of the persisted classes must be marked as BackgroundThe solution presented in this article is most useful to people using NHibernate (also indirectly via Active Record). If you don't know what NHibernate is, I would recommend checking it out here. Using the AspectIn order to use the Aspect, you will first need to download and install PostSharp. The remaining part of the article assumes that PostSharp is installed with the MSBuild integration enabled. Download Unsealer, and copy the Unsealer.Weaver.dll and Unsealer.psplugin files into the Plugins directory under your PostSharp installation folder. Copy the Unsealer.dll into the folder where you keep the external libraries for your solution. Open Visual Studio, and add the following references to the project that contains your persistent classes:
At this point, Unsealer is enabled on the project. Now, you can either:
[assembly: Unseal(AttributeTargetTypes = "*")]
line to the AssemblyInfo.cs file. This will allow you to forget about the This is it - the keyword can be removed from the classes. NHibernate will continue to run as if nothing changed, and if you inspect the DLL with Reflector, you will see that all public members are virtual. NotesAlthough the name of the Aspect is Unsealer, it does not remove the
|
|||||||||||||||||||||||||||