http://blogs.msdn.com/vbteam/archive/2007/03/27/partial-methods.aspx
These are methods that allow for much better code generation. This is something I have dreamed of for some time now.
And while I am on the subject of Partial and code generation I figured out something just a couple of days ago.
Ok, this is probably obvious to most everybody else but it was not for me. So I figure I would share and maybe one or two others might benifit.
I was always under the impression that when doing code generation that I had to pick either inheritance or partial classes. But actually you can combine them.
This is really important.usefule when the templates by default hide certain methods/fields but you find you really need to expose them.
'This is the generated class and I put it in a sub folder.
Inherits Csla.Core.BusinessBase
'I like to make all fields private when generating code.
Private lvSomeProtectedVar As String
End Class
Public Class Customer
Inherits CustomerBase
'But somtime I Need to get at or expose lvSomeProtectedVar but can't
'Also don't want to go and modify a tmeplate just to expose this one field this one time.
End
ClassPartial
Class CustomerBase 'So make a Partial Class but only when needed to expose the private fields however you need.
Public Property SomeProtectedVar() As String
Get
Return lvSomeProtectedVar
End Get
Protected Set(ByVal value As String)
lvSomeProtectedVar = value
End Set
End Property
End Class
Like I said I am probably the last one to realize this but still, really cool.
Actually I have not done much with partial classes and writing objects, Really just getting into more OO abstraction, so it is something I had not thought of or ran into yet so you are nto the only one.
Thanks for posting for that reason,
Mike
Copyright (c) Marimer LLC