In the entity Data Model I have the following complex type
<EdmComplexTypeAttribute(NamespaceName:="MEMORABLEModel", Name:="EDMspGetContact_Result")>
<DataContractAttribute(IsReference:=True)>
<Serializable()>
Partial Public Class EDMspGetContact_Result
Inherits ComplexObject
#Region "Factory Method"
.... etc
I am writing an MVC 4.0 app in VB.Net
I want to add validation to the complex type definition in another project in my solution
I have tried to define a partial class in my MVC project but even though it compiles I know it is wrong somehow because the scaffold template won't generate all the properties
I have moved from traditional coding to object oriented coding in the last 6 months and I really struggle with overcoming problems like this. Appreciate a steer on where I am going wrong. I have tried adding a namespace.
<MetadataType(GetType(EDMspGetContact_ResultMD))> _
<ScaffoldTable(True)> _
Partial Public Class EDMspGetContact_Result
' Note this class has nothing in it. It's just here to add the class-level attribute.
End Class
Public Class EDMspGetContact_ResultMD
' ' Name the field the same as EF named the property - "FirstName" for example.
' ' Also, the type needs to match. Basically just redeclare it.
' ' Note that this is a field. I think it can be a property too, but fields definitely should work.
<Required()> _
<Display(name:="Last Name")> _
Public LastName As String
End Class