Hello,
I'm in the ENTmenuItemBO Class and I'm getting this error: (BTW this is written in
vb.net)
Unable to cast object of type 'V2.PaidTimeOff.DAL.ENTmenuItem' to type 'V2.PaidTimeOff.DAL.Framework.IENTBaseEntity'
I will admit interfaces are my weak spot, so maybe I'm just doing something wrong.
The code that trigger the error is here:
Code:
For Each menuItem In menuItems
menuItemBO = New ENTMenuItemBO
menuItemBO.MapEntityToProperties(menuItem)
...
At this point I have a new ENTMenuItem Class (looks like a record, from the table ENTMenuItem) I pass this object to MapEntityToProperties which takes an
IENTBaseEntity interface object. Which I'm not passing it, hence the casting error.
Here's the Sub for MapEntityToProperties:
Code:
Public Sub MapEntityToProperties(ByVal entity As IENTBaseEntity)
_CreateDate = entity.CreateDate
_CreateENTUserAccountId = entity.CreateENTUserAccountId
_ModifyDate = entity.ModifyDate
_ModifyENTUserAccountId = entity.ModifyENTUserAccountId
_Version = entity.Version
MapEntityToCustomProperties(entity)
End Sub
Here's the Interface object:
Code:
Public Interface IENTBaseEntity
Property CreateDate() As Date
Property CreateENTUserAccountId() As Integer
Property ModifyDate() As Date
Property ModifyENTUserAccountId() As Integer
Property Version() As Binary
End Interface
Thanks,
-realkewl