Let me ask this in a different way. Is there any way to set the value of the PropertyInfo.FriendlyName other than in the PropertyInfo constructor? At the point in time my BO is instantiated (on the web server), I do not have the value that I wish to load into the FriendlyName. I need my BO to travel across the DataPortal to obtain this value.
I tried moving the call to RegisterProperty from the PropertyInfo field declaration into DataPortal_Create, but that resulted in an Exception (DataPortal.Create failed on the server). I then tried adding a 2nd call to RegisterProperty - I left the original call in the field declaration and added the 2nd call in DataPortal_Create. I was hoping this 2nd call would in effect "Re-register" the property with the new FriendlyName data that I obtaind from the DB. The 2nd call seemed to succeed, but the underlying items in the FiledManager._propertyList did not change.
Forgive me if this seems simplistic. I know I must be missing something very basic. How can change the value in FriendlyName after the property has been registered? Thanks.
It is an advanced scenario, but it is possible to register the propertyinfo objects outside your business object. If done right, they could be registered before the creation of your first business object instance.
This would need to be done on both client and app server.
Notice that RegisterProperty() allows you to specify the type of business object that contains the specified property. You could create a totally different class that makes the RegisterProperty() calls, and not make them at all in the actual business class.
As long as you ensure that this other "definition class" was used before any business objects are created, you'd be able to use metadata in your RegisterProperty() calls.
In 3.5 and higher the friendly name is provided when the
property is registered:
Private Shared NameProperty As PropertyInfo(Of String) = _
RegisterProperty(New PropertyInfo(Of String)(“Name”,
My.Resources.NamePropertyText))
Rocky
Copyright (c) Marimer LLC