1
0
Форкнуть 0
This commit is contained in:
Jimmy Bogard 2022-04-01 08:21:29 -05:00
Родитель d8c6ef84cf
Коммит c386d8f1d3
6 изменённых файлов: 13 добавлений и 53 удалений

4
.github/workflows/ci.yml поставляемый
Просмотреть файл

@ -21,10 +21,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- name: Setup .NET Core 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.x
- name: Setup .NET Core 6
uses: actions/setup-dotnet@v1
with:

4
.github/workflows/release.yml поставляемый
Просмотреть файл

@ -18,10 +18,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- name: Setup .NET Core 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.x
- name: Setup .NET Core 6
uses: actions/setup-dotnet@v1
with:

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
<AssemblyName>AutoMapper.Collection.EntityFrameworkCore.Tests</AssemblyName>
<IsPackable>false</IsPackable>
</PropertyGroup>
@ -10,19 +10,9 @@
<ProjectReference Include="..\AutoMapper.Collection.EntityFrameworkCore\AutoMapper.Collection.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.1.14" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.0.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
@ -30,7 +20,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
<PackageReference Include="FluentAssertions" Version="5.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="xunit" Version="2.4.1" />

Просмотреть файл

@ -48,7 +48,7 @@ namespace AutoMapper.Collection.EntityFrameworkCore.Tests
// Assert
db.Things.Count().Should().Be(3);
db.Things.FirstOrDefault(x => x.ID == item.ID).Title.Should().Be("Test");
db.Things.FirstOrDefault(x => x.ID == item.ID)?.Title.Should().Be("Test");
}
[Fact]
@ -85,7 +85,7 @@ namespace AutoMapper.Collection.EntityFrameworkCore.Tests
createdThing.Should().NotBeNull();
db.Things.Count().Should().Be(4);
var createdThingFromEF = db.Things.OrderByDescending(x => x.ID).FirstOrDefault();
createdThingFromEF.Title.Should().Be("Test");
createdThingFromEF?.Title.Should().Be("Test");
createdThing.Should().BeEquivalentTo(createdThingFromEF);
}
@ -161,7 +161,7 @@ namespace AutoMapper.Collection.EntityFrameworkCore.Tests
createdThing.Should().NotBeNull();
(await db.Things.CountAsync()).Should().Be(4);
var createdThingFromEF = await db.Things.OrderByDescending(x => x.ID).FirstOrDefaultAsync();
createdThingFromEF.Title.Should().Be("Test");
createdThingFromEF?.Title.Should().Be("Test");
createdThing.Should().BeEquivalentTo(createdThingFromEF);
}
@ -328,7 +328,7 @@ namespace AutoMapper.Collection.EntityFrameworkCore.Tests
// Assert
db.Things.Count().Should().Be(3);
db.Things.FirstOrDefault(x => x.ID == item.ID).Title.Should().Be(item.Title);
db.Things.FirstOrDefault(x => x.ID == item.ID)?.Title.Should().Be(item.Title);
}
[Fact]
@ -414,7 +414,7 @@ namespace AutoMapper.Collection.EntityFrameworkCore.Tests
// Assert
(await db.Things.CountAsync()).Should().Be(3);
(await db.Things.FirstOrDefaultAsync(x => x.ID == item.ID)).Title.Should().Be(item.Title);
(await db.Things.FirstOrDefaultAsync(x => x.ID == item.ID))?.Title.Should().Be(item.Title);
}
public virtual void Dispose() => db?.Dispose();

Просмотреть файл

@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Collection updating support for EntityFrameworkCore with AutoMapper. Extends DBSet&lt;T&gt; with Persist&lt;TDto&gt;().InsertUpdate(dto) and Persist&lt;TDto&gt;().Delete(dto). Will find the matching object and will Insert/Update/Delete.</Description>
<Authors>Tyler Carlson</Authors>
<TargetFrameworks>net461;netstandard2.0;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net6.0</TargetFrameworks>
<AssemblyName>AutoMapper.Collection.EntityFrameworkCore</AssemblyName>
<PackageId>AutoMapper.Collection.EntityFrameworkCore</PackageId>
<PackageIcon>icon.png</PackageIcon>
@ -24,11 +24,11 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper.Collection" Version="[7.0.0,8.0.0)" />
<PackageReference Include="AutoMapper.Collection" Version="[8.0.0,9.0.0)" />
<PackageReference Include="AutoMapper.Extensions.ExpressionMapping" Version="[5.0.0,6.0.0)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.ExpressionMapping" Version="4.0.2" />
<PackageReference Include="Roslynator.Analyzers" Version="2.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@ -39,17 +39,7 @@
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.14" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.14" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.0" />
</ItemGroup>

Просмотреть файл

@ -8,18 +8,6 @@ namespace AutoMapper.EntityFrameworkCore
{
public static class Extensions
{
/// <summary>
/// Obsolete: Use Persist(IMapper) instead.
/// Create a Persistence object for the <see cref="T:System.Data.Entity.DbSet`1"/> to have data persisted or removed from
/// Uses static API's Mapper for finding TypeMap between classes
/// </summary>
/// <typeparam name="TSource">Source table type to be updated</typeparam>
/// <param name="source">DbSet to be updated</param>
/// <returns>Persistence object to Update or Remove data</returns>
[Obsolete("Use Persist(IMapper) instead.", true)]
public static IPersistence<TSource> Persist<TSource>(this DbSet<TSource> source)
where TSource : class => throw new NotSupportedException();
/// <summary>
/// Create a Persistence object for the <see cref="T:System.Data.Entity.DbSet`1"/> to have data persisted or removed from
/// </summary>