Skip to content

Commit

Permalink
Merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
JonPSmith committed Nov 15, 2022
2 parents c68a32d + 178185a commit 16390d0
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 56 deletions.
10 changes: 5 additions & 5 deletions Benchmarking/Benchmarking.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="EfCore.TestSupport" Version="5.2.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.11" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
12 changes: 9 additions & 3 deletions DataLayer/DataLayer.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.10" />
<PackageReference Include="GenericServices.StatusGeneric" Version="1.1.0" />
<PackageReference Include="GenericServices.StatusGeneric" Version="1.2.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.0" />
<PackageReference Include="GenericServices.StatusGeneric" Version="1.1.0" />
<PackageReference Include="GenericServices.StatusGeneric" Version="1.2.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
<PackageReference Include="GenericServices.StatusGeneric" Version="1.2.0" />
</ItemGroup>

</Project>
23 changes: 15 additions & 8 deletions GenericServices/GenericServices.csproj
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net6.0;net7.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="AutoMapper" Version="12.0.0" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="5.0.11 " />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.10" />
<PackageReference Include="GenericServices.StatusGeneric" Version="1.1.0" />
<PackageReference Include="GenericServices.StatusGeneric" Version="1.2.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="6.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.11" />
<PackageReference Include="GenericServices.StatusGeneric" Version="1.1.0" />
<PackageReference Include="AutoMapper" Version="12.0.0" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="GenericServices.StatusGeneric" Version="1.2.0" />
</ItemGroup>

<PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0'">
<PackageReference Include="AutoMapper" Version="12.0.0" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="7.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
<PackageReference Include="GenericServices.StatusGeneric" Version="1.2.0" />
</ItemGroup>

<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion>5.1.1</PackageVersion>
<Version>5.1.1</Version>
Expand Down
14 changes: 9 additions & 5 deletions GenericServices/Internal/Decoders/DecodedEntityClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using GenericServices.Configuration.Internal;
using Microsoft.EntityFrameworkCore;
using StatusGeneric;
using Microsoft.EntityFrameworkCore.Metadata.Internal;

namespace GenericServices.Internal.Decoders
{
Expand Down Expand Up @@ -53,10 +54,13 @@ public DecodedEntityClass(Type entityType, DbContext context)
return;
}

// This replaces 'context.Model.FindEntityType(entityType)' because that didn't provide Owned Types
var efType = context.Model.GetEntityTypes(entityType)
//You can multiple Owned types
.FirstOrDefault();
//// This replaces 'context.Model.FindEntityType(entityType)' because that didn't provide Owned Types
//var efType = context.Model.GetEntityTypes(entityType)
// //You can multiple Owned types
// .FirstOrDefault();
var efEntityTypes = context.Model.GetEntityTypes();
var efType = efEntityTypes.Where(x => x.ClrType.Name == entityType.Name)
.FirstOrDefault();

if (efType == null)
{
Expand All @@ -78,7 +82,7 @@ public DecodedEntityClass(Type entityType, DbContext context)
return;
}

var primaryKeys = efType.GetKeys().Where(x => x.IsPrimaryKey()).ToImmutableList();
var primaryKeys = efType.GetKeys().Where(x => (x == x.DeclaringEntityType.FindPrimaryKey())).ToImmutableList();
if (primaryKeys.Count != 1)
{
throw new InvalidOperationException($"The class {entityType.Name} has {primaryKeys.Count} primary keys. I can't handle that.");
Expand Down
3 changes: 2 additions & 1 deletion GenericServices/Setup/Internal/MappingProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using AutoMapper;
using AutoMapper.Internal;

[assembly: InternalsVisibleTo("Tests")]

Expand All @@ -15,7 +16,7 @@ internal class MappingProfile : Profile
public MappingProfile(bool addIgnoreParts)
{
if (addIgnoreParts)
ForAllPropertyMaps(pm => Filter(pm.SourceMember), (pm, opt) => opt.Ignore());
this.Internal().ForAllPropertyMaps(pm => Filter(pm.SourceMember), (pm, opt) => opt.Ignore());
}

/// <summary>
Expand Down
8 changes: 7 additions & 1 deletion ServiceLayer/ServiceLayer.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1'">
Expand All @@ -16,6 +16,12 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DataLayer\DataLayer.csproj" />
<ProjectReference Include="..\GenericServices\GenericServices.csproj" />
Expand Down
3 changes: 2 additions & 1 deletion Tests/Helpers/UnitTestProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.ComponentModel;
using System.Reflection;
using AutoMapper;
using AutoMapper.Internal;

namespace Tests.Helpers
{
Expand All @@ -13,7 +14,7 @@ public class UnitTestProfile : Profile
public UnitTestProfile(bool addIgnoreParts)
{
if (addIgnoreParts)
ForAllPropertyMaps(pm => Filter(pm.SourceMember), (pm, opt) => opt.Ignore());
this.Internal().ForAllPropertyMaps(pm => Filter(pm.SourceMember), (pm, opt) => opt.Ignore());
}

public void AddReadMap<TIn, TOut>(Action<IMappingExpression<TIn, TOut>> alterMapping = null)
Expand Down
75 changes: 45 additions & 30 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,47 +1,62 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>

<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="AutoMapper" Version="12.0.0" />
<PackageReference Include="EfCore.TestSupport" Version="5.2.2" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="5.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.10" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.1.0" />
<PackageReference Include="GenericServices.StatusGeneric" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="GenericServices.StatusGeneric" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="EfCore.TestSupport" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="6.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.11" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.1.0" />
<PackageReference Include="GenericServices.StatusGeneric" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="AutoMapper" Version="12.0.0" />
<PackageReference Include="EfCore.TestSupport" Version="5.2.2" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.0.0-preview3.21293.2" />
<PackageReference Include="GenericServices.StatusGeneric" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DataLayer\DataLayer.csproj" />
<ProjectReference Include="..\GenericServices\GenericServices.csproj" />
<ProjectReference Include="..\ServiceLayer\ServiceLayer.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0'">
<PackageReference Include="AutoMapper" Version="12.0.0" />
<PackageReference Include="EfCore.TestSupport" Version="5.2.2" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="7.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.0.1" />
<PackageReference Include="GenericServices.StatusGeneric" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DataLayer\DataLayer.csproj" />
<ProjectReference Include="..\GenericServices\GenericServices.csproj" />
<ProjectReference Include="..\ServiceLayer\ServiceLayer.csproj" />
</ItemGroup>

</Project>
3 changes: 2 additions & 1 deletion Tests/UnitTests/Libraries/TestAutoMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Linq;
using System.Reflection;
using AutoMapper;
using AutoMapper.Internal;
using AutoMapper.QueryableExtensions;
using DataLayer.EfClasses;
using Tests.Configs;
Expand Down Expand Up @@ -120,7 +121,7 @@ public void TestIgnoreReadOnlyProperties()
var config = new MapperConfiguration(cfg =>
{
//see https://github.com/AutoMapper/AutoMapper/issues/2571#issuecomment-374159340
cfg.ForAllPropertyMaps(pm => Filter(pm.SourceMember), (pm, opt) => opt.Ignore());
cfg.Internal().ForAllPropertyMaps(pm => Filter(pm.SourceMember), (pm, opt) => opt.Ignore());
cfg.CreateMap<WriteAuthorReadOnlyDto, Author>();
});

Expand Down
4 changes: 3 additions & 1 deletion Tests/UnitTests/TestIssues/TestIssue60.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using GenericServices.PublicButHidden;
using GenericServices.Setup;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using TestSupport.EfHelpers;
using Xunit;
using Xunit.Extensions.AssertExtensions;
Expand Down Expand Up @@ -60,7 +61,8 @@ public void TestGetEntityTypes()
using var context = new Context(options);

//ATTEMPT
var ownedTypes = context.Model.GetEntityTypes(typeof(Reference));
var ownedTypes = context.Model.GetEntityTypes()
.Where(x => x.ClrType.Name == typeof(Reference).Name);

//VERIFY
ownedTypes.Count().ShouldEqual(2);
Expand Down

0 comments on commit 16390d0

Please sign in to comment.