Click here to Skip to main content
15,890,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have class model like this

Public Class MenuSidebar
    Public Property ID() As Integer
    Public Property MenuCode() As String
    Public Property MenuDescription() As String
    Public Property Method() As String
    Public Property Controller() As String
    Public Property MenuInduk() As Integer
    Public Property CreatedTime() As Date
    Public Property CreatedBy() As String
    Public Property LastModifiedTime() As Date
    Public Property LastModifiedBy() As String
End Class


What I have tried:

what i must to do ?
i dont know how to define the key for that class model.
in my database, the key in my table is in ID.
what i must to do..
Please help me
Posted
Updated 22-Sep-16 5:03am
Comments
Maciej Los 22-Sep-16 10:40am    
Sorry, but your question is not clear. Have you defined key on database level or not? How did you create class - using Code First?

I think what you are asking is that you need to specify the Key attribute on your ID property as EF is looking for it to be named Id instead of ID

VB.NET
Public Class MenuSidebar
    <key>
    Public Property ID() As Integer
    Public Property MenuCode() As String
    Public Property MenuDescription() As String
    Public Property Method() As String
    Public Property Controller() As String
    Public Property MenuInduk() As Integer
    Public Property CreatedTime() As Date
    Public Property CreatedBy() As String
    Public Property LastModifiedTime() As Date
    Public Property LastModifiedBy() As String
End Class</key>
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900