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: 'user-cs@ibatis.apache.org' 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. ________________________________