با سلام من یک جدول دارم که کلی جدول بهش وصل میشه
یکی اطلاعات عکس هامو نگه میداره که جداول زیر بهش وصل میشن
جدول برند - استایل - تایپ و... هر کدوم تنها یک یا صفر ریلیشن میزنن به جدول عکس
این آخیرن تلاش من بوده:
public class Images {
[Key]
[HiddenInput(DisplayValue = false)]
public int ImagesId { get; set; }
[Display(Name ="Name")]
[Required]
public string ImageName { get; set; }
[Display(Name ="Url")]
[Required]
public string ImageUrl { get; set; }
[Display(Name ="Alt")]
public string ImageAlt { get; set; }
[Display(Name ="Title")]
public string ImageTitle { get; set; }
[AllowHtml]
[StringLength(1000)]
public string Meta { get; set; }
[AllowHtml]
[StringLength(1000)]
public string Schema { get; set; }
public virtual ICollection<Product> Products { get; set; }
public virtual ICollection<Brand> Brand { get; set; }
}
public class Brand {
[Key]
[HiddenInput(DisplayValue = false)]
public int BrandId { get; set; }
[Required]
public string Name { get; set; }
[Required]
public string Description { get; set; }
[AllowHtml]
[StringLength(1000)]
public string Meta { get; set; }
[AllowHtml]
[StringLength(1000)]
public string Schema { get; set; }
public ICollection<Product> Products { get; set; }
public int ImagesId { get; set; }
public virtual Images Images { get; set; }
}
و اینکه میخوام foreignkey رو هم توی خود جولم نگه دارم که بتونم بکشمش بیرون