Quantcast
Channel: CSLA .NET
Viewing all articles
Browse latest Browse all 764

How do you use RegisterProperty with Inheritance??

$
0
0

I have a base class called MyBase which inherits from Csla.BusinessBase(Of MyBase) like so

Protected Class MyBase(Of T As BusinessBase(Of T))
     Inherits BusinessBase(Of T) 

End Class

I then have another class that inherits from MyBase, called MyParent, like so

Public Class MyParent(Of T As MyBase(Of T))
     Inherits MyBase(Of T)

End Class

Now 2 questions really...
1.  Is this the correct way to implement inheritance, using the Of T command, like Csla?
2.  I thought inheritance was supposed to be done like this because I read a while ago that inheriting objects should declare proeprties using the RegisterProperty constructor that accepts a Type paramter, like so

Private Shared IdProperty As PropertyInfo(Of Integer) = RegisterProperty(GetType(MyBase(Of T)), New PropertyInfo(Of Integer)("Id"))

Is this still the case?  Do you need the specify the type parameter on any object that uses inheritance?  If not, then i wonder if my objects could be simplified to something like

 Protected Class MyBase(Of T As BusinessBase(Of T))

     Inherits BusinessBase(Of T) 

End Class

Public Class MyParent

     Inherits MyBase(Of MyParent)

End Class

So as stated before, what is the correct way to implement inheritance in csla? And which is the correct/preferred way to define Properties in objects with inheritance?

Thanks in advance


Viewing all articles
Browse latest Browse all 764

Trending Articles