All,

Apologies on repeating the same request twice. I thought the first request
didnt work so Im sincerely sorry in posting twice on the same topic.

Fabio, to answer the questions you asked:

do you have invalid instance in the DB ?




On Sat, Oct 25, 2008 at 11:14 AM, Fabio Maulo <[EMAIL PROTECTED]> wrote:

> Repeated request. Our friend bstack is something impatient.
>
> 2008/10/22 bstack <[EMAIL PROTECTED]>
>
>
>> All,
>>
>> We are using immutable types in our domain, that we want to map
>> directly to to database. The type takes the following format:
>>
>> public class X
>> {
>>      private readonly int m_Prop1;
>>      private readonly int m_Prop2;
>>
>>      private X() { }
>>
>>      public X(int p1, int p2)
>>      {
>>          //Perform validation guard check against arguments
>>
>>          this.m_Prop1 = p1;
>>          this.m_Prop2 = p2;
>>      }
>>
>>      public int Prop1 { get { return this.m_Prop1; } }
>>      public int Prop2 { get { return this.m_Prop2; } }
>> }
>>
>> The problem we have is that the private constructor is what NHibernate
>> instantiates (not the public constructor where guard checks are
>> performed), hence we can end up "getting" an instance of X from the
>> database that is invalid.
>>
>> Is there any way to get NHibernate to call the constructor that
>> performs the guard checks?
>>
>>
>>
>
>
> --
> Fabio Maulo
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to