i have an object "Item" (EFW generated) with a string property description. what is the best approach to set its maximum length to 30.
Code:
<EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
<DataMemberAttribute()>
Public Property Description() As Global.System.String
Get
Return _Description
End Get
Set
OnDescriptionChanging(value)
ReportPropertyChanging("Description")
_Description = StructuralObject.SetValidValue(value, false)
ReportPropertyChanged("Description")
OnDescriptionChanged()
End Set
End Property
here is what i tried, all i need is to trim the value down to 30 charterers
Code:
Partial Public Class Item
'<StringLength(30)>
'Public Property Description() As Global.System.String
Protected Overrides Sub OnPropertyChanged([property] As String)
'MyBase.OnPropertyChanged([property])
If [property] = "Description" And Me.Description.Trim.Length > 30 Then ' ************
oCom.MSG(Me.Description)
Me.Description = Me.Description.Substring(0, 30)
End If
End Sub
End Class