ура бд
This commit is contained in:
parent
7a9aea4a30
commit
07bff0dbf8
@ -1,5 +1,4 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using TransportLogisticContracts.BindingModels;
|
||||
using TransportLogisticContracts.BindingModels;
|
||||
using TransportLogisticContracts.BusinessLogicsContracts;
|
||||
using TransportLogisticContracts.SearchModels;
|
||||
using TransportLogisticContracts.StorageContracts;
|
||||
@ -9,25 +8,20 @@ namespace TransportLogisticBusinessLogic
|
||||
{
|
||||
public class CustomerLogic : ICustomerLogic
|
||||
{
|
||||
public readonly ILogger _logger;
|
||||
public readonly ICustomerStorage _CustomerStorage;
|
||||
|
||||
public CustomerLogic(ILogger<CustomerLogic> logger, ICustomerStorage CustomerStorage)
|
||||
public CustomerLogic(ICustomerStorage CustomerStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_CustomerStorage = CustomerStorage;
|
||||
}
|
||||
|
||||
public List<CustomerViewModel>? ReadList(CustomerSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Name:{Name}.Id:{ Id}", model?.Name, model?.Id);
|
||||
var list = model == null ? _CustomerStorage.GetFullList() : _CustomerStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -37,14 +31,11 @@ namespace TransportLogisticBusinessLogic
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Name:{Name}.Id:{ Id}", model.Name, model.Id);
|
||||
var element = _CustomerStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
@ -53,7 +44,6 @@ namespace TransportLogisticBusinessLogic
|
||||
CheckModel(model);
|
||||
if (_CustomerStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -62,10 +52,8 @@ namespace TransportLogisticBusinessLogic
|
||||
public bool Delete(CustomerBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_CustomerStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -76,7 +64,6 @@ namespace TransportLogisticBusinessLogic
|
||||
CheckModel(model);
|
||||
if (_CustomerStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -97,7 +84,6 @@ namespace TransportLogisticBusinessLogic
|
||||
throw new ArgumentNullException("Нет имени заказчика",
|
||||
nameof(model.Name));
|
||||
}
|
||||
_logger.LogInformation("Customer. Name:{Name}. Id: { Id}", model.Name, model.Id);
|
||||
var element = _CustomerStorage.GetElement(new CustomerSearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using TransportLogisticContracts.BindingModels;
|
||||
using TransportLogisticContracts.BindingModels;
|
||||
using TransportLogisticContracts.BusinessLogicsContracts;
|
||||
using TransportLogisticContracts.SearchModels;
|
||||
using TransportLogisticContracts.StorageContracts;
|
||||
@ -9,25 +8,20 @@ namespace TransportLogisticBusinessLogic
|
||||
{
|
||||
public class GoodLogic : IGoodLogic
|
||||
{
|
||||
public readonly ILogger _logger;
|
||||
public readonly IGoodStorage _GoodStorage;
|
||||
|
||||
public GoodLogic(ILogger<GoodLogic> logger, IGoodStorage GoodStorage)
|
||||
public GoodLogic(IGoodStorage GoodStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_GoodStorage = GoodStorage;
|
||||
}
|
||||
|
||||
public List<GoodViewModel>? ReadList(GoodSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Name:{Name}.Id:{ Id}", model?.Name, model?.Id);
|
||||
var list = model == null ? _GoodStorage.GetFullList() : _GoodStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -37,14 +31,11 @@ namespace TransportLogisticBusinessLogic
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Name:{Name}.Id:{ Id}", model.Name, model.Id);
|
||||
var element = _GoodStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
@ -53,7 +44,6 @@ namespace TransportLogisticBusinessLogic
|
||||
CheckModel(model);
|
||||
if (_GoodStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -62,10 +52,8 @@ namespace TransportLogisticBusinessLogic
|
||||
public bool Delete(GoodBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_GoodStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -76,7 +64,6 @@ namespace TransportLogisticBusinessLogic
|
||||
CheckModel(model);
|
||||
if (_GoodStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -97,7 +84,6 @@ namespace TransportLogisticBusinessLogic
|
||||
throw new ArgumentNullException("Нет имени заказчика",
|
||||
nameof(model.Name));
|
||||
}
|
||||
_logger.LogInformation("Good. Name:{Name}. Id: { Id}", model.Name, model.Id);
|
||||
var element = _GoodStorage.GetElement(new GoodSearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using TransportLogisticContracts.BindingModels;
|
||||
using TransportLogisticContracts.BindingModels;
|
||||
using TransportLogisticContracts.BusinessLogicsContracts;
|
||||
using TransportLogisticContracts.SearchModels;
|
||||
using TransportLogisticContracts.StorageContracts;
|
||||
@ -10,26 +9,21 @@ namespace TransportLogisticBusinessLogic
|
||||
{
|
||||
public class OrderLogic : IOrderLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
|
||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
||||
public OrderLogic(IOrderStorage orderStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_orderStorage = orderStorage;
|
||||
}
|
||||
|
||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
|
||||
var list = model == null ? _orderStorage.GetFullList() :
|
||||
_orderStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -54,7 +48,6 @@ namespace TransportLogisticBusinessLogic
|
||||
model.Status = OrderStatus.Принят;
|
||||
if (_orderStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -66,12 +59,10 @@ namespace TransportLogisticBusinessLogic
|
||||
var element = _orderStorage.GetElement(new OrderSearchModel { Id = model.Id });
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("Read operation failed");
|
||||
return false;
|
||||
}
|
||||
if (element.Status != status - 1)
|
||||
{
|
||||
_logger.LogWarning("Status change operation failed");
|
||||
throw new InvalidOperationException("Текущий статус заказа не может быть переведен в выбранный");
|
||||
}
|
||||
model.Status = status;
|
||||
@ -103,8 +94,6 @@ namespace TransportLogisticBusinessLogic
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Order. Id: { Id}", model.Id);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using TransportLogisticContracts.BindingModels;
|
||||
using TransportLogisticContracts.BindingModels;
|
||||
using TransportLogisticContracts.BusinessLogicsContracts;
|
||||
using TransportLogisticContracts.SearchModels;
|
||||
using TransportLogisticContracts.StorageContracts;
|
||||
@ -9,25 +8,20 @@ namespace TransportLogisticBusinessLogic
|
||||
{
|
||||
public class StorageLogic : IStorageLogic
|
||||
{
|
||||
public readonly ILogger _logger;
|
||||
public readonly IStorageStorage _StorageStorage;
|
||||
|
||||
public StorageLogic(ILogger<StorageLogic> logger, IStorageStorage StorageStorage)
|
||||
public StorageLogic(IStorageStorage StorageStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_StorageStorage = StorageStorage;
|
||||
}
|
||||
|
||||
public List<StorageViewModel>? ReadList(StorageSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Name:{Name}.Id:{ Id}", model?.Name, model?.Id);
|
||||
var list = model == null ? _StorageStorage.GetFullList() : _StorageStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -37,14 +31,11 @@ namespace TransportLogisticBusinessLogic
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Name:{Name}.Id:{ Id}", model.Name, model.Id);
|
||||
var element = _StorageStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
@ -53,7 +44,6 @@ namespace TransportLogisticBusinessLogic
|
||||
CheckModel(model);
|
||||
if (_StorageStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -62,10 +52,8 @@ namespace TransportLogisticBusinessLogic
|
||||
public bool Delete(StorageBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_StorageStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -76,7 +64,6 @@ namespace TransportLogisticBusinessLogic
|
||||
CheckModel(model);
|
||||
if (_StorageStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -97,7 +84,6 @@ namespace TransportLogisticBusinessLogic
|
||||
throw new ArgumentNullException("Нет имени пункта",
|
||||
nameof(model.Name));
|
||||
}
|
||||
_logger.LogInformation("Storage. Name:{Name}. Id: { Id}", model.Name, model.Id);
|
||||
var element = _StorageStorage.GetElement(new StorageSearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using TransportLogisticContracts.BindingModels;
|
||||
using TransportLogisticContracts.BindingModels;
|
||||
using TransportLogisticContracts.BusinessLogicsContracts;
|
||||
using TransportLogisticContracts.SearchModels;
|
||||
using TransportLogisticContracts.StorageContracts;
|
||||
@ -9,25 +8,20 @@ namespace TransportLogisticBusinessLogic
|
||||
{
|
||||
public class TransportLogic : ITransportLogic
|
||||
{
|
||||
public readonly ILogger _logger;
|
||||
public readonly ITransportStorage _TransportStorage;
|
||||
|
||||
public TransportLogic(ILogger<TransportLogic> logger, ITransportStorage TransportStorage)
|
||||
public TransportLogic(ITransportStorage TransportStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_TransportStorage = TransportStorage;
|
||||
}
|
||||
|
||||
public List<TransportViewModel>? ReadList(TransportSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Type:{Type}.Id:{ Id}", model?.Type, model?.Id);
|
||||
var list = model == null ? _TransportStorage.GetFullList() : _TransportStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -37,14 +31,11 @@ namespace TransportLogisticBusinessLogic
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Type:{Type}.Id:{ Id}", model.Type, model.Id);
|
||||
var element = _TransportStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
@ -53,7 +44,6 @@ namespace TransportLogisticBusinessLogic
|
||||
CheckModel(model);
|
||||
if (_TransportStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -62,10 +52,8 @@ namespace TransportLogisticBusinessLogic
|
||||
public bool Delete(TransportBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_TransportStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -76,7 +64,6 @@ namespace TransportLogisticBusinessLogic
|
||||
CheckModel(model);
|
||||
if (_TransportStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -97,7 +84,6 @@ namespace TransportLogisticBusinessLogic
|
||||
throw new ArgumentNullException("Нет типа транспорта",
|
||||
nameof(model.Type));
|
||||
}
|
||||
_logger.LogInformation("Transport. Type:{Type}. Id: { Id}", model.Type, model.Id);
|
||||
var element = _TransportStorage.GetElement(new TransportSearchModel
|
||||
{
|
||||
Type = model.Type
|
||||
|
@ -7,15 +7,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.17" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.17" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TransportLogisticContracts\TransportLogisticContracts.csproj" />
|
||||
<ProjectReference Include="..\TransportLogisticDataModels\TransportLogisticDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
@ -6,12 +6,6 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.17" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.17" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TransportLogisticDataModels\TransportLogisticDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
@ -6,10 +6,4 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.17" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.17" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
294
TransportLogistic/TransportLogisticDatabaseImplement/Migrations/20240514142102_InitialCreate.Designer.cs
generated
Normal file
294
TransportLogistic/TransportLogisticDatabaseImplement/Migrations/20240514142102_InitialCreate.Designer.cs
generated
Normal file
@ -0,0 +1,294 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using TransportLogisticDatabaseImplement;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TransportLogisticDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(TransportLogisticDatabase))]
|
||||
[Migration("20240514142102_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.17")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Customer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Lastname")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Customers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Good", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Size")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Weight")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Goods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CustomerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateDelivered")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("FinishStorageId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StartStorageId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StorageId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CustomerId");
|
||||
|
||||
b.HasIndex("StorageId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.OrderGood", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("GoodId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("GoodsCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OrderId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GoodId");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.ToTable("OrderGoods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.OrderTransport", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OrderId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransportId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransportsCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.HasIndex("TransportId");
|
||||
|
||||
b.ToTable("OrderTransports");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Storage", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Storages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Transport", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("LoadCapacity")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Transports");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Customer", "Customer")
|
||||
.WithMany("Order")
|
||||
.HasForeignKey("CustomerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Storage", "Storage")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("StorageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Customer");
|
||||
|
||||
b.Navigation("Storage");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.OrderGood", b =>
|
||||
{
|
||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Good", "Good")
|
||||
.WithMany("OrderGoods")
|
||||
.HasForeignKey("GoodId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("Goods")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Good");
|
||||
|
||||
b.Navigation("Order");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.OrderTransport", b =>
|
||||
{
|
||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("Transports")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Transport", "Transport")
|
||||
.WithMany("OrderTransports")
|
||||
.HasForeignKey("TransportId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Order");
|
||||
|
||||
b.Navigation("Transport");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Customer", b =>
|
||||
{
|
||||
b.Navigation("Order");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Good", b =>
|
||||
{
|
||||
b.Navigation("OrderGoods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Navigation("Goods");
|
||||
|
||||
b.Navigation("Transports");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Storage", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Transport", b =>
|
||||
{
|
||||
b.Navigation("OrderTransports");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,213 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TransportLogisticDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Customers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Lastname = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Customers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Goods",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Weight = table.Column<double>(type: "float", nullable: false),
|
||||
Size = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Goods", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Storages",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Address = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Storages", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Transports",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Type = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
LoadCapacity = table.Column<double>(type: "float", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Transports", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Orders",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DateDelivered = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
StartStorageId = table.Column<int>(type: "int", nullable: false),
|
||||
FinishStorageId = table.Column<int>(type: "int", nullable: false),
|
||||
CustomerId = table.Column<int>(type: "int", nullable: false),
|
||||
StorageId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Orders", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Orders_Customers_CustomerId",
|
||||
column: x => x.CustomerId,
|
||||
principalTable: "Customers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Orders_Storages_StorageId",
|
||||
column: x => x.StorageId,
|
||||
principalTable: "Storages",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "OrderGoods",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
OrderId = table.Column<int>(type: "int", nullable: false),
|
||||
GoodId = table.Column<int>(type: "int", nullable: false),
|
||||
GoodsCount = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_OrderGoods", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_OrderGoods_Goods_GoodId",
|
||||
column: x => x.GoodId,
|
||||
principalTable: "Goods",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_OrderGoods_Orders_OrderId",
|
||||
column: x => x.OrderId,
|
||||
principalTable: "Orders",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "OrderTransports",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
OrderId = table.Column<int>(type: "int", nullable: false),
|
||||
TransportId = table.Column<int>(type: "int", nullable: false),
|
||||
TransportsCount = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_OrderTransports", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_OrderTransports_Orders_OrderId",
|
||||
column: x => x.OrderId,
|
||||
principalTable: "Orders",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_OrderTransports_Transports_TransportId",
|
||||
column: x => x.TransportId,
|
||||
principalTable: "Transports",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OrderGoods_GoodId",
|
||||
table: "OrderGoods",
|
||||
column: "GoodId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OrderGoods_OrderId",
|
||||
table: "OrderGoods",
|
||||
column: "OrderId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_CustomerId",
|
||||
table: "Orders",
|
||||
column: "CustomerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_StorageId",
|
||||
table: "Orders",
|
||||
column: "StorageId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OrderTransports_OrderId",
|
||||
table: "OrderTransports",
|
||||
column: "OrderId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OrderTransports_TransportId",
|
||||
table: "OrderTransports",
|
||||
column: "TransportId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "OrderGoods");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "OrderTransports");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Goods");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Orders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Transports");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Customers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Storages");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,291 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using TransportLogisticDatabaseImplement;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TransportLogisticDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(TransportLogisticDatabase))]
|
||||
partial class TransportLogisticDatabaseModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.17")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Customer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Lastname")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Customers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Good", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Size")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Weight")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Goods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CustomerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateDelivered")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("FinishStorageId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StartStorageId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StorageId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CustomerId");
|
||||
|
||||
b.HasIndex("StorageId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.OrderGood", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("GoodId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("GoodsCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OrderId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GoodId");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.ToTable("OrderGoods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.OrderTransport", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OrderId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransportId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransportsCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.HasIndex("TransportId");
|
||||
|
||||
b.ToTable("OrderTransports");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Storage", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Storages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Transport", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("LoadCapacity")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Transports");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Customer", "Customer")
|
||||
.WithMany("Order")
|
||||
.HasForeignKey("CustomerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Storage", "Storage")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("StorageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Customer");
|
||||
|
||||
b.Navigation("Storage");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.OrderGood", b =>
|
||||
{
|
||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Good", "Good")
|
||||
.WithMany("OrderGoods")
|
||||
.HasForeignKey("GoodId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("Goods")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Good");
|
||||
|
||||
b.Navigation("Order");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.OrderTransport", b =>
|
||||
{
|
||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("Transports")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Transport", "Transport")
|
||||
.WithMany("OrderTransports")
|
||||
.HasForeignKey("TransportId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Order");
|
||||
|
||||
b.Navigation("Transport");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Customer", b =>
|
||||
{
|
||||
b.Navigation("Order");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Good", b =>
|
||||
{
|
||||
b.Navigation("OrderGoods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Navigation("Goods");
|
||||
|
||||
b.Navigation("Transports");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Storage", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Transport", b =>
|
||||
{
|
||||
b.Navigation("OrderTransports");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -61,8 +61,6 @@ namespace TransportLogisticDatabaseImplement.Models
|
||||
}
|
||||
[ForeignKey("OrderId")]
|
||||
public virtual List<OrderGood> Goods { get; set; } = new();
|
||||
public virtual Transport Transport{ get; set; }
|
||||
public virtual Good Good { get; set; }
|
||||
public virtual Customer Customer { get; set; }
|
||||
public virtual Storage Storage { get; set; }
|
||||
|
||||
|
@ -13,11 +13,11 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TransportLogisticContracts\TransportLogisticContracts.csproj" />
|
||||
<ProjectReference Include="..\TransportLogisticDataModels\TransportLogisticDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -8,11 +8,18 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.17">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TransportLogisticBusinessLogic\TransportLogisticBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\TransportLogisticContracts\TransportLogisticContracts.csproj" />
|
||||
<ProjectReference Include="..\TransportLogisticDatabaseImplement\TransportLogisticDatabaseImplement.csproj" />
|
||||
<ProjectReference Include="..\TransportLogisticDataModels\TransportLogisticDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user