У меня есть следующее связанное свойство в моем классе Employee
, где EmployeePhoneNumber
связано, как объявляют атрибуты, в БД.
[TableAttribute(Name = "dbo.EmoployeePhoneNumber")]
public class EmployeePhoneNumber
и
[TableAttribute(Name = "dbo.Employee")]
public class Employee
{
[ColumnAttribute(IsPrimaryKey = true, IsDbGenerated = true)]
public int ID { get; set; }
[Association(Name = "Employee_EmployeePhoneNumbers", ThisKey = "ID", OtherKey = "EmployeeID")]
public EntitySet<EmployeePhoneNumber> PhoneNumbers { get; set; }
}
Когда я пытаюсь получить доступ к GetTable<Employee>()
, я получаю сообщение об ошибке:
Недопустимое сопоставление ассоциации для члена Interview.Web.Models.Employee.PhoneNumbers.Interview.Web.Models.EmployeePhoneNumber не является сущностью.
Я новичок в LINQ to SQL, являясь EF-человеком, привыкшим к конструктору моделей, и я должен кодировать эти модели с помощьюрука.