Reza Safa
پنج شنبه 12 فروردین 1400, 16:25 عصر
سلام خدمت همه دوستان
من قبل از اینکه با .net core کار کنم مشکلی در تعریف مدل ها و ارتباط یک به چند نداشتم
اما در .net core همون مدل با رفرنس ها هم می سازم یک آیتم خدوکار می سازه
public partial class ProductAbility
{
[Key]
public int ProductAbilityID { get; set; }
[Display(Name = "قابلیت")]
public string Ability { get; set; }
[DataType(DataType.MultilineText)]
[Display(Name = "محتوا")]
public String Body { get; set; }
[DataType(DataType.Date)]
[Display(Name = "تاریخ")]
public DateTime ReleaseDate { get; set; }
public ICollection<Products> listProductAbility { get; set; }
}
public partial class ProductTypes
{
[Key]
public int ProductTypeID { get; set; }
[Display(Name = "نوع محصول")]
public string Title { get; set; }
[DataType(DataType.Date)]
[Display(Name = "تاریخ")]
public DateTime ReleaseDate { get; set; }
public ICollection<Products> listProductTypes { get; set; }
}
public partial class Products
{
[Key]
public int ProductID { get; set; }
[Display(Name = "محصول")]
public string Title { get; set; }
public int ProductTypeID { get; set; }
public ProductTypes ProductTypes { get; set; }
public int ProductAbilityID { get; set; }
public ProductAbility ProductAbility { get; set; }
}
بعد با دستور add-migration ser1 میگریشن می سازم
یا از ProductAbilityID و یا ProductTypeID
یکی به صورت
ProductAbilityroductAbilityID
یا
ProductTypesProductTypeID
می سازه
کمک کنید
من قبل از اینکه با .net core کار کنم مشکلی در تعریف مدل ها و ارتباط یک به چند نداشتم
اما در .net core همون مدل با رفرنس ها هم می سازم یک آیتم خدوکار می سازه
public partial class ProductAbility
{
[Key]
public int ProductAbilityID { get; set; }
[Display(Name = "قابلیت")]
public string Ability { get; set; }
[DataType(DataType.MultilineText)]
[Display(Name = "محتوا")]
public String Body { get; set; }
[DataType(DataType.Date)]
[Display(Name = "تاریخ")]
public DateTime ReleaseDate { get; set; }
public ICollection<Products> listProductAbility { get; set; }
}
public partial class ProductTypes
{
[Key]
public int ProductTypeID { get; set; }
[Display(Name = "نوع محصول")]
public string Title { get; set; }
[DataType(DataType.Date)]
[Display(Name = "تاریخ")]
public DateTime ReleaseDate { get; set; }
public ICollection<Products> listProductTypes { get; set; }
}
public partial class Products
{
[Key]
public int ProductID { get; set; }
[Display(Name = "محصول")]
public string Title { get; set; }
public int ProductTypeID { get; set; }
public ProductTypes ProductTypes { get; set; }
public int ProductAbilityID { get; set; }
public ProductAbility ProductAbility { get; set; }
}
بعد با دستور add-migration ser1 میگریشن می سازم
یا از ProductAbilityID و یا ProductTypeID
یکی به صورت
ProductAbilityroductAbilityID
یا
ProductTypesProductTypeID
می سازه
کمک کنید