Errr on Changing DBFieldName to get readable propertyName


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
BigGrin Got it. I'm crossing my fingers!
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
How "future"? I've run into another instance were this would be really, really handy (inserting the user friendly field name into broken rule messages).

Depending on the complications, this may be in the 1.6.5 build....emphasis on "maybe." Smile

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
This is already on an enhancement list for a future release.




How "future"? I've run into another instance were this would be really, really handy (inserting the user friendly field name into broken rule messages).
Ertan Deniz
Ertan Deniz
StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)
Group: Forum Members
Posts: 163, Visits: 493
New feature is simply implement by getting friendly name for the field. Then generate according to this.

There must be no need to write anything.

My situation works well. I've have pasted standart property code with changed name into custom code, not selected the option 'Create descriptor' and written code that overrides GetCustomBindablePropertyDescriptors for the property.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I think that you are wanting a feature in the BO Mapper that will allow you to override the name of the field without having to create a custom property for each item...I think Smile  This is already on an enhancement list for a future release.  Past that, if you want to send me a sample to reproduce what you are talking about then that would be great.  I am having a hard time following what you are getting at here.  Thanks.
Ertan Deniz
Ertan Deniz
StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)
Group: Forum Members
Posts: 163, Visits: 493
I've used Custom Code option. Copy the only property related code from (designer.vb) and paste it into Custom code section.

In Custom code section, I've changed property name to a more readable form, Then build partial class. I've also added an override for the GetCustomBindablePropertyDescriptors() function. But I've got known error. This was my process.

I want to use the property (with new name) generated by Mapper. I don't want to define new custom properties for each field. This is the my case.

I've seen that If Only property descriptor was pasted into custom code region, field descriptor class remained the same with old property names after generation.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
with functions GetValue and SetValue (designer.vb). Because, I've changed cust_FirstName to FirstName by Custom Code.

It sounds as though you have answered your own question here.  A property descriptor is created by the BO Mapper for each field.  If you do not want to use the property name assigned by the schema of the table and create a custom property, then either create a separate property or use the custom code option in the BO Mapper.  You can then manually add a ReflectionPropertyDescriptor by overriding the GetCustomBindablePropertyDescriptors method of the BO.  There are many posts related to this:

http://forum.strataframe.net/FindPost13027.aspx

http://forum.strataframe.net/FindPost3584.aspx

There is also documentation in this regard.  But if you just go and start changing the generated field name without using the "custom code" option in the mapper, then you are going to have downstream effects like this.

Ertan Deniz
Ertan Deniz
StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)
Group: Forum Members
Posts: 163, Visits: 493
When Create Descriptor option is selected in ObjectMapper, I've got syntax error (member not found) with functions GetValue and SetValue (designer.vb). Because, I've changed cust_FirstName to FirstName by Custom Code.

Public Overrides Function GetValue(ByVal component As Object) As Object

Return CType(component, CustomerBase).cust_FirstName

End Function

Public Overrides Sub SetValue(ByVal component As Object, ByVal Value As Object)

CType(component, CustomerBase).cust_FirstName = CType(Value, System.String)

End Sub

Ertan Deniz
Ertan Deniz
StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)StrataFrame User (177 reputation)
Group: Forum Members
Posts: 163, Visits: 493
I've followed the process below ;

Using Object Mapper , Select the field and press Customize,

Check Use Custom Code and Create Descriptor,

Paste the code (Change only cust_firstname to FirstName) below in the custom code section;

I've got the error below.

"An error occurred while refreshing the data from field 'CustomerBase.FirstName' to property 'Text' on control 'TextEdit1.'  Are you missing FieldPropertyDescriptor for a custom property?"

 But this is not custom property. What is missing ?

----------------

<Browsable(False), _

BusinessFieldDisplayInEditor(), _

Description("cust_FirstName"), _

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _

Public Property [FirstName]() As System.String

Get

Return CType(Me.CurrentRow.Item("cust_FirstName"), System.String)

End Get

Set(ByVal value As System.String)

Me.CurrentRow.Item("cust_FirstName") = value

End Set

I've

 

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search