В моем проекте. NET CORE я использую многоуровневую структуру, а для пространственных типов я использую
dotMorten.Microsoft.SqlServer.Types Version="1.1.0"
Вот мои файлы .csproj :
Entities.csproj:
<ItemGroup>
<PackageReference Include="dotMorten.Microsoft.SqlServer.Types" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="3.1.5" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
</ItemGroup>
DataAccess.csproj:
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="3.1.5" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NLog" Version="4.7.2" />
<PackageReference Include="Npoi.Mapper" Version="3.4.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
</ItemGroup>
WebUI.csproj: -> ASP. NET CORE
<ItemGroup>
<PackageReference Include="itext7" Version="7.1.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.3" />
<PackageReference Include="NLog" Version="4.7.2" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.2" />
<PackageReference Include="Scrutor" Version="3.2.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
</ItemGroup>
Я пробовал ниже:
<runtime>
<dependentAssembly>
<assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" />
<bindingRedirect oldVersion="10.0.0.0" newVersion="14.0.0.0" />
</dependentAssembly>
</runtime>
- До пакета Nuget от dotMorten я использовал пакет
EntityFrameworkCore.SqlServer.HierarchyId
, но в то время у меня было исключение «Конструктор» для HierarchyId, когда я создавал миграцию, поэтому я решил использовать Пакет dotMorten's .
Заранее спасибо.