If you use Virtual and instead of AutoProperties you use a backing field and
do this.field = field in the constructor you don't have this problem, you
are not updating the Virtual property but the field.

I will say that this is exactly how it works in Java by Default so it feels
at least natural to work the same way as it works for Hibernate.

Gustavo.

On Thu, Feb 12, 2009 at 9:11 PM, Graham Bunce <[email protected]>wrote:

>
> Hi,
>
> Just trying to get some general feedback. When implementing NHibernate
> aware classes is the general advice to use Interfaces or Virtual?
>
> From other posts, I know Fabio likes Interfaces ;-) but to code EVERY
> class with an interface seems a bit like "architecture gone mad",
> especially if that class is never used outside its layer. I could use
> virtual, but there are potential problems with that as well when
> inheritance is used (base constructors calling other methods etc.).
>
> I've done both in my trials and I seem to have to make more design
> compromises with virtual (I can't seem to have private empty
> constructors, they have to be protected).
>
> I'm using 2.0.1GA for a project due in March (so I can't go with
> 2.1.0) but, as I'll upgrade as soon as 2.1.0 goes to GA, which way
> seems to be the preferred method and will be better supported in
> future... interfaces?
> >
>

--~--~---------~--~----~------------~-------~--~----~
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