Как я могу сделать запросы к базе данных из метода, который определен внутри класса сущности?Как я могу получить доступ к базе данных?
Например, мне нужно получить "Заголовок" из другой таблицы, присоединяющейся к этой таблице:
Public Class CodeItem
Public Property Id As Int32
Public Property SecondLevel As SecondLevel
Public Property ItemCode As Int32
Public Property Owner As User
Public Property Description As String
Public Overrides Function ToString() As String
' I need to retrive this title from another table joining this table in the database
Return Me.SecondLevel.FirstLevel.Title
End Function
End Class
Я использую Entity Framework 6.