Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Having trouble creating a custom entity class(object)

jesskuzlojesskuzlo Posts: 1Member
How would I create my custom Role class based on that autogenerated class? I have read a few articles on the net but I am still lost. Can someone please show me how to do this, and what I must import(using visual basic). I want to add some validation to the string property where Role1 cannot be more than 50 characters.
Autogenerated class

'''
''' No Metadata Documentation available.
'''



Public Partial Class Role
Inherits EntityObject
#Region "Factory Method"

'''
''' Create a new Role object.
'''
''' Initial value of the RoleID property.
''' Initial value of the Role1 property.
Public Shared Function CreateRole(roleID As Global.System.Int32, role1 As Global.System.String) As Role
Dim role as Role = New Role
role.RoleID = roleID
role.Role1 = role1
Return role
End Function

#End Region
#Region "Primitive Properties"

'''
''' No Metadata Documentation available.
'''


Public Property RoleID() As Global.System.Int32
Get
Return _RoleID
End Get
Set
If (_RoleID <> Value) Then
OnRoleIDChanging(value)
ReportPropertyChanging("RoleID")
_RoleID = StructuralObject.SetValidValue(value)
ReportPropertyChanged("RoleID")
OnRoleIDChanged()
End If
End Set
End Property

Private _RoleID As Global.System.Int32
Private Partial Sub OnRoleIDChanging(value As Global.System.Int32)
End Sub

Private Partial Sub OnRoleIDChanged()
End Sub

'''
''' No Metadata Documentation available.
'''


Public Property Role1() As Global.System.String
Get
Return _Role1
End Get
Set
OnRole1Changing(value)
ReportPropertyChanging("Role1")
_Role1 = StructuralObject.SetValidValue(value, false)
ReportPropertyChanged("Role1")
OnRole1Changed()
End Set
End Property

Private _Role1 As Global.System.String
Private Partial Sub OnRole1Changing(value As Global.System.String)
End Sub

Private Partial Sub OnRole1Changed()
End Sub

#End Region
#Region "Navigation Properties"

'''
''' No Metadata Documentation available.
'''




Public Property Users() As EntityCollection(Of User)
Get
Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of User)("CulminITIMSModel.FK_Users_Roles", "Users")
End Get
Set
If (Not value Is Nothing)
CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of User)("CulminITIMSModel.FK_Users_Roles", "Users", value)
End If
End Set
End Property

#End Region
End Class
Sign In or Register to comment.