An untraditional aspect of the PostSharp activist Michal Dabrowski:

People who use NHibernate know that in order to take advantage of its lazy-loading facility, all public members of the persisted classes must be marked as virtual. Compared to all the benefits the lazy-loading brings, this seems to be a very insignificant price. However, for some people, including me, this extra virtual keyword is still some annoyance. It is very easy to forget about it when writing a new code, it makes Resharper complain sometimes ("virtual member call in constructor" warning) and it is ugly (subjective one, I know). In this article I would like to show how to solve these issues with a simple aspect, that makes members virtual even if the keyword is not used in the source code.

Read the complete article on Code Project.

Comments are closed