Thanks for the responses, the use of operator overloading and generics is very clever and I'll definately take a look at that. Castle is not really an option for us as we're not always in control of our object live cycle right now because of our use of xml serailization (but we could change that...). We are considering the null object pattern mainly becuase we have lots of data binding in the user interface and that provides us with a nice uniform way to bind. Thanks! Ka-Wai
>>> "Clinton Begin" <[EMAIL PROTECTED]> 01/22/07 9:59 PM >>> Some random thoughts... This is actually pretty good for what Ka-Wai is doing. However I just want to point out that EntityRef in DLINQ is not a good thing. It's only there because they refuse to do dynamic/runtime code generation to handle things like lazy loading. NHibernate doesn't need anything like that. I actually think it's pretty ugly overall and especially in the DLINQ case. But like I say, for Ka-Wai, that might be a good alternative to coding it in every setter. I'd give it a more specific and meaningful name than PolicyContainer and avoid overdesigning it. Just simply NotNullableRef or something like that. Cheers, Clinton On 1/22/07, Nguyen, Tom <[EMAIL PROTECTED]> wrote: > > > > > > > Correction: > > > > private PolicyContainer<string, EmptyStringIsNullPolicy> _myName > > = new PolicyContainer<string, EmptyStringIsNullPolicy>(); > > > Regards, > > Tom Nguyen > Sr. Developer > [EMAIL PROTECTED] > Rels Valuation > > ________________________________ > > > From: Nguyen, Tom > Sent: Monday, January 22, 2007 9:18 PM > To: '[email protected]' > Subject: RE: mapping 1 to 0 or 1 relationships to null objects > > > > > Hello Everyone, > > We've been playing with something called Policy-based Design > Pattern ( http://www.freakycpp.com/ ) in C++, that may help with what you > are trying to do. Because the limitation of Generic vs C++ templates, what > we are doing is kind of a Hybrid of this Pattern. Similar Patterns are > (Proxy * boxing, Composite, etc*) Similar to the new Nullable object type > and EntityRef in .NET 3.0/NHibernate. > > > > Example: > > PolicyContainer<EmptyStringIsNull> _myName = new > PolicyContainer<EmptyStringIsNull>(); > > // taken advantage of the new .NET 2.0 implicit operator overload > _myName = "Tom"; > > Assert.True(_myName.Value, "Tom"); > > _myName = ""; > > Assert.True(_myName.Value, null); > > See Attachments or view the implementation cs files from here: > http://www.noogen.org/share/ibatisnet/ > > Regards, > > Tom Nguyen > Sr. Developer > [EMAIL PROTECTED] > Rels Valuation > > > > > > ________________________________ > > > > > This e-mail message and any files transmitted herewith, are intended solely > for the use of the individual(s) addressed and may contain confidential, > proprietary or privileged information. If you are not the addressee > indicated in this message (or responsible for delivery of this message to > such person) you may not review, use, disclose or distribute this message or > any files transmitted herewith. If you receive this message in error, > please contact the sender by reply e-mail and delete this message and all > copies of it from your system. > > ________________________________ > > > > > > > > > > >

