I am creating an application, this is being developed with WPF, the functionality of that app is to create a database in SQL Server through the code, since I made their respective properties in the Model and ModelView it is also worth mentioning that they were already made the bindings in sight.
I have a DataGrid in which I will show the entered records, for that I had to instantiate a Type List of the class.
Public Property ListNeighbor As List(Of Neighbor)
Get
If _ListNeighbor.Count = 0 Then
_ListNeighbor = (From N In DB.Neighbors Select N).ToList 'En esta parte se produce el error
End If
Return _ListNeighbor
End Get
Set(value As List(Of Neighbor))
_ListNeighbor = value
NotificarCambio("ListNeighbor")
End Set
End Property
When I execute the code it tells me the error InvalidOperationException this error occurs when the list refreshes the records and when I look at the detail of the error it tells me this:
The ForeignKeyAttribute on property 'RemissionID' on type 'EmetraApp2017090.JhonyLopez.EmetraApp2017090.Model.Remission' is not valid. The navigation property 'SanctionTypes' was not found on the dependent type 'EmetraApp2017090.JhonyLopez.EmetraApp2017090.Model.Remission'. The Name value should be a valid navigation property name.