у меня есть класс буксировки, когда устанавливается новое отношение один к одному
отображать эту ошибку
Значение атрибута ForeignKeyAttribute для свойства 'V_ID' для типа 'adminSection.Models.The_Sponsor' не равно действительный. Свойство навигации «Посетитель» не найдено в зависимом типе «adminSection.Models.The_Sponsor». Значение Name должно быть допустимым именем свойства навигации.
, и это мой класс. Класс The_Sponsor:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
namespace adminSection.Models
{
[Table("The_Sponsor")]
public partial class The_Sponsor
{
//[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
//[ForeignKey("Visitor")]
[Key]
public int Sponsor_Id { get; set; }
[Required(ErrorMessage = "you ust provide full name")]
[Display(Name = "Full Name")]
public string Sponsor_FullName { get; set; }
[Required(ErrorMessage = "you must provied phone number")]
[Display(Name = "Phone Number")]
[DataType(DataType.PhoneNumber)]
public string Sponsor_Phone { get; set; }
[Required(ErrorMessage = "You must provide Email Address")]
[Display(Name = "Email Address")]
[DataType(DataType.EmailAddress)]
public string Sponsor_Email { get; set; }
[Required(ErrorMessage = "You must provide Password")]
[Display(Name = "Password")]
[DataType(DataType.Password)]
public string Sponsor_Password { get; set; }
[Required(ErrorMessage = "you must provide Location")]
[Display(Name = "You must provide Location")]
public string Sponsor_Location { get; set; }
[Required(ErrorMessage = "You provide image path")]
[Display(Name = "image path")]
public string Sponsor_Image_Path { get; set; }
public string User_Type{ get; set; }
[ForeignKey("Visitor")]
public int V_ID { get; set; }
public virtual Visitor visitor { get; set; }
public virtual Minsitry min { get; set; }
public int Min_id { get; set; }
}
}
и этот класс посетителей:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
namespace adminSection.Models
{
[Table("tbl_Visitor")]
public partial class Visitor
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public int Visitro_ID { get; set; }
/// <summary>
/// ID Att Section
/// Section success
/// </summary>
[Required(ErrorMessage ="you must provide your full name")]
[Display(Name ="Full Name")]
public string Visitor_FullName { get; set; }
/// <summary>
/// Full Name Att Section
/// Section success
/// </summary>
///
[Required(ErrorMessage ="You must provide your Email")]
[Display(Name ="Email Address")]
[DataType(DataType.EmailAddress)]
public string Visitor_Email { get; set; }
/// <summary>
/// Email Address Att Section
/// section success
/// </summary>
///
[Required(ErrorMessage ="you must provide password")]
[Display(Name ="Password")]
[DataType(DataType.Password)]
public string Visitor_Password { get; set; }
/// <summary>
/// Password Att Section
/// section success
/// </summary>
///
[Required(ErrorMessage ="you must provide phone number")]
[Display(Name ="Phone Number")]
[DataType(DataType.PhoneNumber)]
public int Visitor_Phone { get; set; }
/// <summary>
/// Phone Number Att Section
/// Section success
/// </summary>
[Required(ErrorMessage ="you must upload your Image")]
[Display(Name ="upload Image")]
public string Visitor_Image_Path { get; set; }
/// <summary>
/// Image Path Att Section
/// Section success
/// </summary>
public string User_Type { get; set; }
/// <summary>
/// User type Section
/// Section success
/// </summary>
///
public virtual ICollection<volunteer> volunterr { get; set; }
/// <summary>
/// Visior with volunteer has relation one to many
/// section success
/// sectioin success
/// </summary>
///
public int Sponsor_ID { get; set; }
public virtual The_Sponsor sponsor { get; set; }
}
}