Changeset e0cdea2 for FarmatikoData/FarmatikoDataContext.cs
- Timestamp:
- 02/08/21 16:39:25 (4 years ago)
- Branches:
- master
- Children:
- 8eb1e21, dae4cde
- Parents:
- 0a694bb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoData/FarmatikoDataContext.cs
r0a694bb re0cdea2 42 42 .ValueGeneratedOnAdd(); 43 43 44 /*modelBuilder.Entity<Medicine>() 45 .Property(x => x.Id) 46 .HasIdentityOptions(startValue: 1); 44 modelBuilder.Entity<PharmacyHeadMedicine>() 45 .Property(p => p.Id) 46 .ValueGeneratedOnAdd(); 47 48 modelBuilder.Entity<Medicine>() 49 .Property(p => p.Id) 50 .ValueGeneratedOnAdd(); 47 51 48 52 modelBuilder.Entity<Pharmacy>() 49 .Property( x => x.Id)50 . HasIdentityOptions(startValue: 1);53 .Property(p => p.Id) 54 .ValueGeneratedOnAdd(); 51 55 52 56 modelBuilder.Entity<PharmacyHead>() 53 .Property(x => x.Id) 54 .HasIdentityOptions(startValue: 1); 55 56 modelBuilder.Entity<PharmacyHeadMedicine>() 57 .Property(x => x.Id) 58 .HasIdentityOptions(startValue: 1); 59 60 modelBuilder.Entity<RequestPharmacyHead>() 61 .Property(x => x.Id) 62 .HasIdentityOptions(startValue: 1);*/ 63 64 /*modelBuilder.Entity<User>() 65 .Property(x => x.Id) 66 .HasIdentityOptions(startValue: 1); 67 68 modelBuilder.Entity<PharmacyHeadMedicine>() 69 .HasKey(phm => new { phm.PheadId, phm.MedicineId }); 70 71 modelBuilder.Entity<PharmacyHead>() 72 .HasMany<Pharmacy>(p => p.Pharmacy) 73 .WithOne(p => p.PharmacyHead) 74 .HasForeignKey(); 57 .HasMany<Pharmacy>(p => p.Pharmacies) 58 .WithOne(p => p.PharmacyHead); 75 59 76 60 modelBuilder.Entity<Pharmacy>() 77 61 .HasOne<PharmacyHead>(p => p.PharmacyHead) 78 .WithMany(p => p.Pharmacy); 79 */ 62 .WithMany(p => p.Pharmacies) 63 .HasForeignKey(x => x.PheadId); 64 65 modelBuilder.Entity<PharmacyHeadMedicine>() 66 .HasKey(bc => new { bc.PheadId, bc.MedicineId}); 67 68 modelBuilder.Entity<PharmacyHeadMedicine>() 69 .HasOne(bc => bc.Head) 70 .WithMany(b => b.Medicines) 71 .HasForeignKey(bc => bc.PheadId); 72 73 modelBuilder.Entity<PharmacyHeadMedicine>() 74 .HasOne(bc => bc.Medicine) 75 .WithMany(c => c.Medicines) 76 .HasForeignKey(bc => bc.MedicineId); 77 80 78 81 79 base.OnModelCreating(modelBuilder);
Note:
See TracChangeset
for help on using the changeset viewer.