Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
<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>

<ItemGroup>
<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' ">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.0" />
</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" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void Persist_InsertOrUpdate_WhenEntityExist_ThenTheEntityShouldBeUpdated(

// 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]
Expand Down Expand Up @@ -85,7 +85,7 @@ public void Persist_InsertOrUpdate_WhenEntityDoesNotExist_ThenTheEntityShouldBeI
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);
}

Expand Down Expand Up @@ -161,7 +161,7 @@ public async Task Persist_InsertOrUpdateAsync_WhenEntityDoesNotExist_ThenTheEnti
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);
}

Expand Down Expand Up @@ -328,7 +328,7 @@ public void Persist_InsertOrUpdate_WhenSameEntity_ThenSavedEntityShouldBeSame()

// 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]
Expand Down Expand Up @@ -414,7 +414,7 @@ public async Task Persist_InsertOrUpdateAsync_WhenSameEntity_ThenSavedEntityShou

// 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>

Expand Down
12 changes: 0 additions & 12 deletions src/AutoMapper.Collection.EntityFrameworkCore/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down