fix MessageInfo model, fix verisons of EntityFrameworkCore packages

This commit is contained in:
DavidMakarov 2024-05-16 21:16:19 +04:00
parent 220196aae9
commit 2f625f1674
8 changed files with 23 additions and 40 deletions

View File

@ -17,9 +17,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlowerShopFileImplement", "
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlowerShopDatabaseImplement", "FlowerShopDatabaseImplement\FlowerShopDatabaseImplement.csproj", "{07E0542C-0ED4-4F69-B72D-B51EFF80C599}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlowerShopDatabaseImplement", "FlowerShopDatabaseImplement\FlowerShopDatabaseImplement.csproj", "{07E0542C-0ED4-4F69-B72D-B51EFF80C599}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowerShopRestApi", "FlowerShopRestApi\FlowerShopRestApi.csproj", "{D77CFA3F-2DF8-4C16-A9D3-CC9C7AE1448B}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlowerShopRestApi", "FlowerShopRestApi\FlowerShopRestApi.csproj", "{D77CFA3F-2DF8-4C16-A9D3-CC9C7AE1448B}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowerShopClientApp", "FlowerShopClientApp\FlowerShopClientApp.csproj", "{E2A0B066-DBAA-4F67-9829-661DE97EA695}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlowerShopClientApp", "FlowerShopClientApp\FlowerShopClientApp.csproj", "{E2A0B066-DBAA-4F67-9829-661DE97EA695}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -9,7 +9,12 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.27"> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.16">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.16">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
@ -17,11 +22,13 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="NLog" Version="5.2.8" /> <PackageReference Include="NLog" Version="5.2.8" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" /> <PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" /> <PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\FlowerShopBusinessLogic\FlowerShopBusinessLogic.csproj" /> <ProjectReference Include="..\FlowerShopBusinessLogic\FlowerShopBusinessLogic.csproj" />
<ProjectReference Include="..\FlowerShopDatabaseImplement\FlowerShopDatabaseImplement.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -6,21 +6,13 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<Optimize>True</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<Optimize>False</Optimize>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.19" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.19"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.16">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.18" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -28,21 +20,6 @@
<ProjectReference Include="..\FlowerShopDataModels\FlowerShopDataModels.csproj" /> <ProjectReference Include="..\FlowerShopDataModels\FlowerShopDataModels.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)ImplementationExtensions\*.dll&quot;" /> <Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)ImplementationExtensions\*.dll&quot;" />
</Target> </Target>

View File

@ -12,14 +12,15 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace FlowerShopDatabaseImplement.Migrations namespace FlowerShopDatabaseImplement.Migrations
{ {
[DbContext(typeof(FlowerShopDatabase))] [DbContext(typeof(FlowerShopDatabase))]
[Migration("20240516142709_InitCreate")] [Migration("20240516171210_InitCreate")]
partial class InitCreate partial class InitCreate
{ {
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "6.0.27") .HasAnnotation("ProductVersion", "7.0.16")
.HasAnnotation("Relational:MaxIdentifierLength", 63); .HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@ -157,9 +158,6 @@ namespace FlowerShopDatabaseImplement.Migrations
b.Property<DateTime>("DateDelivery") b.Property<DateTime>("DateDelivery")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<int>("Id")
.HasColumnType("integer");
b.Property<string>("SenderName") b.Property<string>("SenderName")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");

View File

@ -6,8 +6,10 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace FlowerShopDatabaseImplement.Migrations namespace FlowerShopDatabaseImplement.Migrations
{ {
/// <inheritdoc />
public partial class InitCreate : Migration public partial class InitCreate : Migration
{ {
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
@ -74,7 +76,6 @@ namespace FlowerShopDatabaseImplement.Migrations
columns: table => new columns: table => new
{ {
MessageId = table.Column<string>(type: "text", nullable: false), MessageId = table.Column<string>(type: "text", nullable: false),
Id = table.Column<int>(type: "integer", nullable: false),
ClientId = table.Column<int>(type: "integer", nullable: true), ClientId = table.Column<int>(type: "integer", nullable: true),
SenderName = table.Column<string>(type: "text", nullable: false), SenderName = table.Column<string>(type: "text", nullable: false),
DateDelivery = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), DateDelivery = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
@ -176,6 +177,7 @@ namespace FlowerShopDatabaseImplement.Migrations
column: "ImplementerId"); column: "ImplementerId");
} }
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.DropTable(

View File

@ -17,7 +17,7 @@ namespace FlowerShopDatabaseImplement.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "6.0.27") .HasAnnotation("ProductVersion", "7.0.16")
.HasAnnotation("Relational:MaxIdentifierLength", 63); .HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@ -155,9 +155,6 @@ namespace FlowerShopDatabaseImplement.Migrations
b.Property<DateTime>("DateDelivery") b.Property<DateTime>("DateDelivery")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<int>("Id")
.HasColumnType("integer");
b.Property<string>("SenderName") b.Property<string>("SenderName")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");

View File

@ -2,6 +2,7 @@
using FlowerShopContracts.ViewModels; using FlowerShopContracts.ViewModels;
using FlowerShopDataModels.Models; using FlowerShopDataModels.Models;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization; using System.Runtime.Serialization;
namespace FlowerShopDatabaseImplement.Models namespace FlowerShopDatabaseImplement.Models
@ -9,7 +10,8 @@ namespace FlowerShopDatabaseImplement.Models
[DataContract] [DataContract]
public class MessageInfo : IMessageInfoModel public class MessageInfo : IMessageInfoModel
{ {
[DataMember] //[DataMember]
[NotMapped]
public int Id { get; set; } public int Id { get; set; }
[DataMember] [DataMember]
[Key] [Key]

BIN
backup.zip Normal file

Binary file not shown.