subrep
목록을 선택하는 쿼리가 있습니다. 쿼리는 다음과 같습니다 https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/database-first-development/enhancing-data-validation엔터티 형식이 현재 컨텍스트에 대한 모델의 일부가 아닙니다. - DBFirst
그리고 MetaDataType
를 사용하는 다른 부분 공용 클래스를 추가 : 문자열에 MaxLength
등의 검증을 포함하지
Public Async Function ReturnSubRepsAsync(user As BaseUser) As Task(Of IList(Of SubRep)) Implements IGeneralAccountManagementRepository.ReturnSubRepsAsync
'The entity type SubRep is not part of the model for the current context.
Using webDataDBContext As New WebDataEntities()
'So here it just has an SQL query which it will execute when requested
Dim subReps = webDataDBContext.Subreps.Where(Function(x) x.CID = user.CID)
If (String.IsNullOrEmpty(user.Password) = False) Then
'Add another where onto the SQL query
subReps = subReps.Where(Function(x) x.HASH_PASSWORD = user.PasswordHash)
End If
If (String.IsNullOrEmpty(user.Username) = False) Then
'Add another where onto the SQL query
subReps = subReps.Where(Function(x) x.username = user.Username)
End If
'Execute the query
Return Await subReps.ToListAsync()
End Using
End Function
인해 엔티티 프레임 워크 데이터베이스, 나는이 튜토리얼을 따라하기로 결정 유효성 확인을 구현합니다. 이제는 디버깅하는 동안 열이있는 문제라고 생각하여 클래스가 작동하는지 테스트하기 위해 별도의 부분 클래스 안에있는 모든 코드를 주석 처리하기로 결정했습니다. 따라서 부분 클래스의 빈 껍질이 남지 않았습니다. 그것은 차이를 만들지 않았고, 그것은 여전히 내 쿼리의 첫 번째 오류입니다.
내 엔티티 프레임 워크 생성 된 클래스는 다음과 같습니다
Partial Public Class Subrep
Public Property id As Integer
Public Property CID As String
Public Property username As String
Public Property LastName As String
Public Property FirstName As String
Public Property MIddleInitial As String
Public Property Address As String
Public Property Address2 As String
Public Property City As String
Public Property State As String
Public Property Zip As String
Public Property HomePhone As String
Public Property EmailAddress As String
Public Property InActive As String
Public Property CellPhone As String
Public Property StartDate As String
Public Property AuditName As String
Public Property Background As String
Public Property FDCPA As String
Public Property Choicepoint As String
Public Property Badge As String
Public Property ConfAgree As String
Public Property NCCI_OK As String
Public Property InactiveRepNo As String
Public Property Approved As String
Public Property DateApproved As String
Public Property Denied As String
Public Property DateDenied As String
Public Property DeniedNotes As String
Public Property DOB As String
Public Property SSN As String
Public Property MegansLaw As String
Public Property MASTER As String
Public Property VACATION As String
Public Property FC_DEFAULT_FEE As Nullable(Of Decimal)
Public Property LM_DEFAULT_FEE As Nullable(Of Decimal)
Public Property MAS90 As String
Public Property SOS As String
Public Property HASH_PASSWORD As String
Public Property changepass As String
Public Property NOTIFICATION_OFF As String
Public Property Capacity As String
Public Property internalqc As String
Public Property New_Rep As String
Public Property Stand_By As String
Public Property Vacation_Start_date As Nullable(Of Date)
Public Property Vacation_End_date As Nullable(Of Date)
Public Property sub_coreIP As String
Public Property rating As String
Public Property date_last_updated As Nullable(Of Date)
End Class
및 검증에 사용하도록되어 내 별도의 부분 수업은 다음과 같습니다 : 그래서 비어 내가 비록
Partial Public Class SubRep
End Class
제목에 나열된 오류를 얻으십시오. 여러 엔터티와 완벽하게 잘 작동하도록이 작업을 수행했습니다.