xasp wrote:
Hello,
Why is it impossible ? (note: you cannot mark your constructor nor private methods as virtual, but it should be possible for all the rest).
It is normal that NHibernate complains about properties and methods that aren't mapped. For all lazy-loaded entities, a proxy is created that overrides all properties and methods (hence the obligation of using virtual). Even those that aren't mapped (or at least the checking mechanism isn't differentiating between the two).
Hey:
that may be the solution for the given excption (which i myself just recieved), and i went to investigate because i wanted to understand the cause...
It still doesn't make it clear:
1st Why would they want properties to be virtual? So that they may create some stub that inherits from a perfectly usable class? If they want to stuff data into a Mapped class, than the class should be perfectly useble, therefore not requiring any virtual declaration.
Normally using virtual implies => someone will want to override.
2nd So if it's supposed to be virutal,then why do the tutorials not declare the properties as virtual as well?
here is a link:
http://www.hibernate.org/362.html#A9
Somewhere in that page will be a grey text box with a class definition, and no virtual methods or properties!
(by the way: if they do overide the class with some sort of stub: shouldn't classe be declared as virtual? Or you don't want to do that so that you can create your own instances in save them in the data base?)
Thanks in advance.