Zhimolostnova A.V. Hard lab work 3 #10
@ -109,7 +109,7 @@ namespace SoftwareInstallationView
|
||||
DataGridView.Rows.Clear();
|
||||
foreach (var elem in _listStores)
|
||||
{
|
||||
DataGridView.Rows.Add(new object[] { elem.Key, elem.Value.Item1.PackageName, elem.Value.Item2 });
|
||||
DataGridView.Rows.Add(new object[] { elem.Value.Item1.PackageName, elem.Value.Item1.Price, elem.Value.Item2 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,163 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SofrwareInstallationContracts.BindingModels;
|
||||
using SofrwareInstallationContracts.SearchModels;
|
||||
using SofrwareInstallationContracts.StoragesContracts;
|
||||
using SofrwareInstallationContracts.ViewModels;
|
||||
using SoftwareInstallationDataBaseImplement.Models;
|
||||
using SoftwareInstallationDataModels.Models;
|
||||
|
||||
namespace SoftwareInstallationDataBaseImplement.Implements
|
||||
{
|
||||
public class StoreStorage : IStoreStorage
|
||||
{
|
||||
public StoreViewModel? Delete(StoreBindingModel model)
|
||||
{
|
||||
using var context = new SoftwareInstallationDataBase();
|
||||
|
||||
var element = context.Stores
|
||||
.Include(x => x.Packages)
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
|
||||
if (element != null)
|
||||
{
|
||||
context.Stores.Remove(element);
|
||||
context.SaveChanges();
|
||||
|
||||
return element.GetViewModel;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public StoreViewModel? GetElement(StoreSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.StoreName) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using var context = new SoftwareInstallationDataBase();
|
||||
|
||||
return context.Stores
|
||||
.Include(x => x.Packages)
|
||||
.ThenInclude(x => x.Package)
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.StoreName) && x.StoreName == model.StoreName) || (model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<StoreViewModel> GetFilteredList(StoreSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.StoreName))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
using var context = new SoftwareInstallationDataBase();
|
||||
|
||||
return context.Stores
|
||||
.Include(x => x.Packages)
|
||||
.ThenInclude(x => x.Package)
|
||||
.Where(x => x.StoreName.Contains(model.StoreName))
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<StoreViewModel> GetFullList()
|
||||
{
|
||||
using var context = new SoftwareInstallationDataBase();
|
||||
return context.Stores
|
||||
.Include(x => x.Packages)
|
||||
.ThenInclude(x => x.Package)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public StoreViewModel? Insert(StoreBindingModel model)
|
||||
{
|
||||
using var context = new SoftwareInstallationDataBase();
|
||||
var newStore = Store.Create(context, model);
|
||||
if (newStore == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Stores.Add(newStore);
|
||||
context.SaveChanges();
|
||||
return newStore.GetViewModel;
|
||||
}
|
||||
|
||||
public bool SellPackage(IPackageModel model, int quantity)
|
||||
{
|
||||
using var context = new SoftwareInstallationDataBase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
foreach (var store in context.Stores
|
||||
.Include(x => x.Packages)
|
||||
.ThenInclude(x => x.Package)
|
||||
.ToList()
|
||||
.Where(x => x.StorePackages.ContainsKey(model.Id)))
|
||||
{
|
||||
int countInCurrentStore = store.StorePackages[model.Id].Item2;
|
||||
if (countInCurrentStore <= quantity)
|
||||
{
|
||||
var elem = context.StorePackages
|
||||
.Where(x => x.PackageId == model.Id)
|
||||
.FirstOrDefault(x => x.StoreId == store.Id);
|
||||
context.StorePackages.Remove(elem);
|
||||
store.StorePackages.Remove(model.Id);
|
||||
quantity -= countInCurrentStore;
|
||||
}
|
||||
else
|
||||
{
|
||||
store.StorePackages[model.Id] = (store.StorePackages[model.Id].Item1, countInCurrentStore - quantity);
|
||||
quantity = 0;
|
||||
store.UpdatePackage(context, new()
|
||||
{
|
||||
Id = store.Id,
|
||||
StorePackages = store.StorePackages,
|
||||
});
|
||||
}
|
||||
if (quantity == 0)
|
||||
{
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
transaction.Rollback();
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public StoreViewModel? Update(StoreBindingModel model)
|
||||
{
|
||||
using var context = new SoftwareInstallationDataBase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var store = context.Stores.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (store == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
store.Update(model);
|
||||
context.SaveChanges();
|
||||
store.UpdatePackage(context, model);
|
||||
transaction.Commit();
|
||||
return store.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -12,8 +12,8 @@ using SoftwareInstallationDataBaseImplement;
|
||||
namespace SoftwareInstallationDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(SoftwareInstallationDataBase))]
|
||||
[Migration("20230226140803_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
[Migration("20230407111626_InitCreate")]
|
||||
partial class InitCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -128,6 +128,59 @@ namespace SoftwareInstallationDataBaseImplement.Migrations
|
||||
b.ToTable("PackageComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Store", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("OpeningDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("PackageMaxCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("StoreAdress")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("StoreName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Stores");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.StorePackage", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PackageId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StoreId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PackageId");
|
||||
|
||||
b.HasIndex("StoreId");
|
||||
|
||||
b.ToTable("StorePackages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("SoftwareInstallationDataBaseImplement.Models.Package", "Package")
|
||||
@ -158,6 +211,25 @@ namespace SoftwareInstallationDataBaseImplement.Migrations
|
||||
b.Navigation("Package");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.StorePackage", b =>
|
||||
{
|
||||
b.HasOne("SoftwareInstallationDataBaseImplement.Models.Package", "Package")
|
||||
.WithMany()
|
||||
.HasForeignKey("PackageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SoftwareInstallationDataBaseImplement.Models.Store", "Store")
|
||||
.WithMany("Packages")
|
||||
.HasForeignKey("StoreId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Package");
|
||||
|
||||
b.Navigation("Store");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("PackageComponents");
|
||||
@ -169,6 +241,11 @@ namespace SoftwareInstallationDataBaseImplement.Migrations
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Store", b =>
|
||||
{
|
||||
b.Navigation("Packages");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
namespace SoftwareInstallationDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
public partial class InitCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
@ -39,6 +39,22 @@ namespace SoftwareInstallationDataBaseImplement.Migrations
|
||||
table.PrimaryKey("PK_Packages", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Stores",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
StoreName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
StoreAdress = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
OpeningDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
PackageMaxCount = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Stores", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Orders",
|
||||
columns: table => new
|
||||
@ -91,6 +107,33 @@ namespace SoftwareInstallationDataBaseImplement.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "StorePackages",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PackageId = table.Column<int>(type: "int", nullable: false),
|
||||
StoreId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_StorePackages", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_StorePackages_Packages_PackageId",
|
||||
column: x => x.PackageId,
|
||||
principalTable: "Packages",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_StorePackages_Stores_StoreId",
|
||||
column: x => x.StoreId,
|
||||
principalTable: "Stores",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_PackageId",
|
||||
table: "Orders",
|
||||
@ -105,6 +148,16 @@ namespace SoftwareInstallationDataBaseImplement.Migrations
|
||||
name: "IX_PackageComponents_PackageId",
|
||||
table: "PackageComponents",
|
||||
column: "PackageId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StorePackages_PackageId",
|
||||
table: "StorePackages",
|
||||
column: "PackageId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StorePackages_StoreId",
|
||||
table: "StorePackages",
|
||||
column: "StoreId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -116,11 +169,17 @@ namespace SoftwareInstallationDataBaseImplement.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "PackageComponents");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "StorePackages");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Components");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Packages");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Stores");
|
||||
}
|
||||
}
|
||||
}
|
@ -125,6 +125,59 @@ namespace SoftwareInstallationDataBaseImplement.Migrations
|
||||
b.ToTable("PackageComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Store", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("OpeningDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("PackageMaxCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("StoreAdress")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("StoreName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Stores");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.StorePackage", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PackageId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StoreId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PackageId");
|
||||
|
||||
b.HasIndex("StoreId");
|
||||
|
||||
b.ToTable("StorePackages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("SoftwareInstallationDataBaseImplement.Models.Package", "Package")
|
||||
@ -155,6 +208,25 @@ namespace SoftwareInstallationDataBaseImplement.Migrations
|
||||
b.Navigation("Package");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.StorePackage", b =>
|
||||
{
|
||||
b.HasOne("SoftwareInstallationDataBaseImplement.Models.Package", "Package")
|
||||
.WithMany()
|
||||
|
||||
.HasForeignKey("PackageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SoftwareInstallationDataBaseImplement.Models.Store", "Store")
|
||||
.WithMany("Packages")
|
||||
.HasForeignKey("StoreId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Package");
|
||||
|
||||
b.Navigation("Store");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("PackageComponents");
|
||||
@ -166,6 +238,11 @@ namespace SoftwareInstallationDataBaseImplement.Migrations
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Store", b =>
|
||||
{
|
||||
b.Navigation("Packages");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,106 @@
|
||||
using SofrwareInstallationContracts.BindingModels;
|
||||
using SofrwareInstallationContracts.ViewModels;
|
||||
using SoftwareInstallationDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Net;
|
||||
|
||||
namespace SoftwareInstallationDataBaseImplement.Models
|
||||
{
|
||||
public class Store : IStoreModel
|
||||
{
|
||||
[Required]
|
||||
public string StoreName { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string StoreAdress { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public DateTime OpeningDate { get; private set; }
|
||||
[Required]
|
||||
public int PackageMaxCount { get; private set; }
|
||||
|
||||
public int Id { get; private set; }
|
||||
|
||||
|
||||
private Dictionary<int, (IPackageModel, int)> _storePackages = null;
|
||||
[NotMapped]
|
||||
public Dictionary<int, (IPackageModel, int)> StorePackages
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_storePackages == null)
|
||||
{
|
||||
_storePackages = Packages
|
||||
.ToDictionary(recPC => recPC.PackageId, recPC => (recPC.Package as IPackageModel, recPC.Count));
|
||||
}
|
||||
return _storePackages;
|
||||
}
|
||||
}
|
||||
|
||||
[ForeignKey("StoreId")]
|
||||
public virtual List<StorePackage> Packages { get; set; } = new();
|
||||
|
||||
public static Store Create(SoftwareInstallationDataBase context, StoreBindingModel model)
|
||||
{
|
||||
return new Store()
|
||||
{
|
||||
Id = model.Id,
|
||||
StoreName = model.StoreName,
|
||||
StoreAdress = model.StoreAdress,
|
||||
OpeningDate = model.OpeningDate,
|
||||
PackageMaxCount = model.PackageMaxCount,
|
||||
Packages = model.StorePackages.Select(x => new StorePackage
|
||||
{
|
||||
Package = context.Packages.First(y => y.Id == x.Key),
|
||||
Count = x.Value.Item2
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(StoreBindingModel model)
|
||||
{
|
||||
StoreName = model.StoreName;
|
||||
StoreAdress = model.StoreAdress;
|
||||
OpeningDate = model.OpeningDate;
|
||||
PackageMaxCount = model.PackageMaxCount;
|
||||
}
|
||||
|
||||
public StoreViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
StoreName = StoreName,
|
||||
StoreAdress = StoreAdress,
|
||||
OpeningDate = OpeningDate,
|
||||
PackageMaxCount = PackageMaxCount,
|
||||
StorePackages = StorePackages
|
||||
};
|
||||
|
||||
public void UpdatePackage(SoftwareInstallationDataBase context, StoreBindingModel model)
|
||||
{
|
||||
var storePackages = context.StorePackages.Where(rec => rec.StoreId == model.Id).ToList();
|
||||
if (storePackages != null && storePackages.Count > 0)
|
||||
{ // удалили те, которых нет в модели
|
||||
context.StorePackages.RemoveRange(storePackages.Where(rec => !model.StorePackages.ContainsKey(rec.PackageId)));
|
||||
context.SaveChanges();
|
||||
// обновили количество у существующих записей
|
||||
foreach (var updatePackage in storePackages)
|
||||
{
|
||||
updatePackage.Count = model.StorePackages[updatePackage.PackageId].Item2;
|
||||
model.StorePackages.Remove(updatePackage.PackageId);
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
var store = context.Stores.First(x => x.Id == Id);
|
||||
foreach (var sp in model.StorePackages)
|
||||
{
|
||||
context.StorePackages.Add(new StorePackage
|
||||
{
|
||||
Store = store,
|
||||
Package = context.Packages.First(x => x.Id == sp.Key),
|
||||
Count = sp.Value.Item2
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_storePackages= null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SoftwareInstallationDataBaseImplement.Models
|
||||
{
|
||||
public class StorePackage
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int PackageId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int StoreId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
|
||||
public virtual Store Store { get; set; } = new();
|
||||
|
||||
public virtual Package Package { get; set; } = new();
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@ namespace SoftwareInstallationDataBaseImplement
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-VG5USAH\SQLEXPRESS;Initial Catalog=SoftwareInstallationDataBaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-VG5USAH\SQLEXPRESS;Initial Catalog=SoftwareInstallationDataBaseHardFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
@ -17,6 +17,7 @@ namespace SoftwareInstallationDataBaseImplement
|
||||
public virtual DbSet<Package> Packages { set; get; }
|
||||
public virtual DbSet<PackageComponent> PackageComponents { set; get; }
|
||||
public virtual DbSet<Order> Orders { set; get; }
|
||||
public virtual DbSet<Client> Clients { set; get; }
|
||||
public virtual DbSet<Store> Stores { set; get; }
|
||||
public virtual DbSet<StorePackage> StorePackages { set; get; }
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user
Связь настроена не до конца