RegisterProperty

RegisterProperty

Old forum URL: forums.lhotka.net/forums/t/12040.aspx


NemisisJedi posted on Wednesday, June 26, 2013

Got a problem with values coming from somewhere else, and i am unsure why this would happen, but i wondered if it has anything to do with the RegisterProperty function?

We have recently changed all our code to inherit from a BaseObject, and this BaseObject inherits from BusinessBase(Of T).

If doing this, it is ok to use the basic RegisterProperty like

Private Shared NameProperty As PropertyInfo(Of String) = RegisterProperty(New PropertyInfo(Of String)("Name"))

Or do you have to pass in the type as well like...

Private Shared NameProperty As PropertyInfo(Of String) = RegisterProperty(GetType(MyObject), New PropertyInfo(Of String)("Name"))

JonnyBee replied on Wednesday, June 26, 2013

Hi,

Your BaseObject must be a generic base class, ie BaseObject(Of T) that inherits from BusinessBase(Of T)

Only the lowest level call can be non-generic for inheritance. 

NemisisJedi replied on Wednesday, June 26, 2013

Yes my base object is defined as

Public Class EditableBase(Of T As BusinessBase(Of T))

    Inherits BusinessBase(Of T)

 

End Class

 

So what about the RegisterProperty calls?  Do i need to pass the type if i inherit from this object or is it ok without it?

JonnyBee replied on Wednesday, June 26, 2013

Hi,

Maybe we should rewind to which version of CSLA do you use? 

NemisisJedi replied on Wednesday, June 26, 2013

Sorry, i am using 4.3.1

JonnyBee replied on Wednesday, June 26, 2013

Then you do not need to supply the object type.

NemisisJedi replied on Friday, June 28, 2013

And what about if i am inheriting from the following BaseObject?  I'm guessing there isnt a problem doing the same with ReadOnlyBase?

<Serializable()> _

Public MustInherit Class NonEditableBase(Of T As NonEditableBase(Of T))

    Inherits ReadOnlyBase(Of T)

 

End Class

 

My problem is that i have a webapp, and that send a message to a messagequeue with details of something that the user is doing along with a GUID for that user.  I then pickup these messages using a windows service. Problem is that the details do not match the users GUID.  its like someone else has done somethign at the same time and somehow the messages are mixed..... That is why i wondered if something like this was possible because of the RegisterProperty method and then using GetProperty/SetProperty?

JonnyBee replied on Saturday, June 29, 2013

I do not think this has anything to do with RegisterPropery. 

Which serializer do you use? 

Can you provide us a code sample? 

Copyright (c) Marimer LLC