Teknoloji Haberleri
DH
forum
mini
Uygulama ile
aç
Uygulama ile Aç
Giriş
Kayıt
DH Anasayfa
İndirim Kodu
Ara
Popüler
Foruma Git
Hakkımızda
Destek
Mobil Sürüm
Standart Site Görünümü
Bu Konuda
Tüm Forumlar
Web Tasarım - Programlama
Yazılım Geliştirme
Asp / Asp.NET
Bu Konuda
Bağlan:
Facebook
Google+
Twitter
Aşağı Git
Tüm Forumlar
Web Tasarım - Programlama
Yazılım Geliştirme
Asp / Asp.NET
Migrations ile db'yi update etmeye çalıştığımda aşağıdaki hatayı alıyorum.
Bu konudaki kullanıcılar: 1 misafir
1
Cevap
224
Tıklama
0
Öne Çıkarma
1. sayfa
Migrations ile db'yi update etmeye çalıştığımda aşağıdaki hatayı alıyorum.
Cevap Yaz
Konuya Özel
Linkli Mesajlar
Seçkin Yorumlar
A
ahmtselcuk
Cevapla
Özel Mesaj
Şikayet
Mesaja Link
Takip Et
5 yıl
Er
Konu Sahibi
{ public class Category { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid Id { get; set; } [Required] [DisplayName("Category")] public string Name { get; set; } public virtual IList<SubCategory> SubCategory { get; set; } } } public class SubCategory { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid Id { get; set; } [Required] [DisplayName("Subcategory")] public string Name { get; set; } [DisplayName("Category")] public Guid CategoryId { get; set; } [ForeignKey("CategoryId")] public virtual Category Category { get; set; } public virtual IList<Product> Products { get; set; } } public class Product { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int ProductId{ get; set; } public string ProductNumber { get; set; } public string Name{ get; set; } public string Description { get; set; } public double Price { get; set; } public int Stock{ get; set; } public bool IsApproved { get; set; } public bool IsHome { get; set; } public DateTime CreatedDate{ get; set; } public List<ProductImage> ProductImages { get; set; } [DisplayName("Subcategory")] public Guid SubCategoryId { get; set; } [ForeignKey("SubCategoryId")] public virtual SubCategory SubCategories { get; set; } }}DBContext : public DbSet<Product> Products { get; set; } public DbSet<ProductFavorite> ProductFavorites{ get; set; } public DbSet<ProductImage> ProductImages { get; set; } public DbSet<Category> Categories { get; set; } public DbSet<SubCategory> SubCategories { get; set; } public DbSet<Member> Members { get; set; } public DbSet<User> Users { get; set; } public DbSet<Blog> Blogs { get; set; }Migrations ile dbyi update etmeye çalıştığımda aşağıdaki hatayı alıyorum.Yardımcı olur musunuz ?Foreign key 'FK_Products_Categories_CategoryId' references invalid table 'Categories'.Could not create constraint. See previous errors.
M
mahoni_38
Cevapla
Özel Mesaj
Şikayet
Mesaja Link
Takip Et
5 yıl
Yarbay
işte hata söylüyor. Categories diye bir tablo bulamamış. Ayrıca kategoriyi tek tablo ile yapabilirsin. Ayrıca guid kullanımı kullanacağın database ve index bağlı olarak sorun oluşturur. bigint kullanmak daha iyi olabilir.
https://stackoverflow.com/a/11938495
Cevap Yaz
1. sayfa
Tüm Forumlar
Web Tasarım - Programlama
Yazılım Geliştirme
Asp / Asp.NET
Migrations ile db'yi update etmeye çalıştığımda aşağıdaki hatayı alıyorum.
DH Mobil uygulaması ile devam edin.
Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin.
App Store'dan
İndirin
Google Play'den
İndirin
Gizle ve güncelleme çıkana kadar tekrar gösterme.
Hizmet kalitesi için çerezleri kullanabiliriz, DH'yi kullanırken depoladığımız çerezlerle ilgili
veri politikamıza
gözatın.
https://stackoverflow.com/a/11938495