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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,4 @@ ModelManifest.xml
*.GhostDoc.xml
/artifacts
*.lock.json
/results
7 changes: 6 additions & 1 deletion AutoMapper.Collection.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.6
VisualStudioVersion = 15.0.27130.2010
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{19AAEE83-5EEC-4EAA-9CF7-16F8ED58B50E}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -10,8 +10,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{19AAEE
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{578F2483-CF08-409D-A316-31BCB7C5D9D0}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
global.json = global.json
README.md = README.md
version.props = version.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoMapper.Collection", "src\AutoMapper.Collection\AutoMapper.Collection.csproj", "{37AD667A-8080-476C-88FD-20310AC7CAF3}"
Expand Down Expand Up @@ -54,4 +56,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D5C8CD86-1F3F-4D3A-8A90-5F3726E8F998}
EndGlobalSection
EndGlobal
9 changes: 9 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<Import Project="version.props" />

<PropertyGroup>
<FluentAssertions>4.15.0</FluentAssertions>
<TestSDKVersion>15.5.0</TestSDKVersion>
<xUnitVersion>2.3.1</xUnitVersion>
</PropertyGroup>
</Project>
32 changes: 9 additions & 23 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ Framework '4.5.1x86'

properties {
$base_dir = resolve-path .
$build_dir = "$base_dir\build"
$source_dir = "$base_dir\src"
$result_dir = "$build_dir\results"
$result_dir = "$base_dir\results"
$artifacts_dir = "$base_dir\artifacts"
$global:config = "debug"
}
Expand All @@ -15,8 +14,8 @@ task local -depends init, compile, test
task ci -depends clean, release, local

task clean {
rd "$source_dir\artifacts" -recurse -force -ErrorAction SilentlyContinue | out-null
rd "$base_dir\build" -recurse -force -ErrorAction SilentlyContinue | out-null
rd "$artifacts_dir" -recurse -force -ErrorAction SilentlyContinue | out-null
rd "$result_dir" -recurse -force -ErrorAction SilentlyContinue | out-null
}

task init {
Expand All @@ -38,38 +37,25 @@ task compile -depends clean {

$buildParam = @{ $true = ""; $false = "--version-suffix=$buildSuffix"}[$tag -ne $NULL -and $revision -ne "local"]
$packageParam = @{ $true = ""; $false = "--version-suffix=$suffix"}[$tag -ne $NULL -and $revision -ne "local"]

echo "build: Tag is $tag"
echo "build: Package version suffix is $suffix"
echo "build: Build version suffix is $buildSuffix"

# restore packages to get Fixie.Console.exe in packages folder
exec { .\.nuget\NuGet.exe restore $base_dir\AutoMapper.Collection.sln }

# restore all project references (creating project.assets.json for each project)
exec { dotnet restore $base_dir\AutoMapper.Collection.sln }
exec { dotnet restore $base_dir\AutoMapper.Collection.sln /nologo }

exec { dotnet build $base_dir\AutoMapper.Collection.sln -c $config $buildParam /nologo }
exec { dotnet build $base_dir\AutoMapper.Collection.sln -c $config $buildParam /nologo --no-restore }

exec { dotnet pack $source_dir\AutoMapper.Collection -c $config --include-symbols --no-build --output $artifacts_dir $packageParam /nologo}

exec { dotnet pack $source_dir\AutoMapper.Collection.EntityFramework -c $config --include-symbols --no-build --output $artifacts_dir $packageParam /nologo}

exec { dotnet pack $source_dir\AutoMapper.Collection.LinqToSQL -c $config --include-symbols --no-build --output $artifacts_dir $packageParam /nologo}
exec { dotnet pack $base_dir\AutoMapper.Collection.sln -c $config --include-symbols --no-build --no-restore --output $artifacts_dir $packageParam /nologo}
}

task test {
$testRunners = @(gci $base_dir\packages -rec -filter Fixie.Console.exe)

if ($testRunners.Length -ne 1)
{
throw "Expected to find 1 Fixie.Console.exe, but found $($testRunners.Length)."
}
exec { dotnet test $source_dir\AutoMapper.Collection.Tests -c $config --no-build --no-restore --results-directory $result_dir --logger trx /nologo }

$testRunner = $testRunners[0].FullName
exec { dotnet test $source_dir\AutoMapper.Collection.EntityFramework.Tests -c $config --no-build --no-restore --results-directory $result_dir --logger trx /nologo }

exec { & $testRunner $source_dir\AutoMapper.Collection.Tests\bin\$config\AutoMapper.Collection.Tests.dll }
exec { & $testRunner $source_dir\AutoMapper.Collection.EntityFramework.Tests\bin\$config\AutoMapper.Collection.EntityFramework.Tests.dll }
}

function Install-Dotnet
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using Xunit;

[assembly: CollectionBehavior(DisableTestParallelization = true)]
Original file line number Diff line number Diff line change
@@ -1,99 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BDE127AB-AC3F-44DF-BC33-210DAFD12E15}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AutoMapper.Collection.EntityFramework.Tests</RootNamespace>
<TargetFrameworks>net461</TargetFrameworks>
<AssemblyName>AutoMapper.Collection.EntityFramework.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<Reference Include="AutoMapper, Version=6.2.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\..\packages\AutoMapper.6.2.1\lib\net45\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Fixie, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Fixie.1.0.2\lib\net45\Fixie.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FluentAssertions, Version=4.15.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\..\packages\FluentAssertions.4.15.0\lib\net45\FluentAssertions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FluentAssertions.Core, Version=4.15.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\..\packages\FluentAssertions.4.15.0\lib\net45\FluentAssertions.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<PackageReference Include="System.ValueTuple" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
<Compile Include="MapCollectionWithEqualityTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<ProjectReference Include="..\AutoMapper.Collection.EntityFramework\AutoMapper.Collection.EntityFramework.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AutoMapper.Collection.EntityFramework\AutoMapper.Collection.EntityFramework.csproj">
<Project>{e0fd41fd-af5b-4bec-970f-8412e7b6c914}</Project>
<Name>AutoMapper.Collection.EntityFramework</Name>
</ProjectReference>
<ProjectReference Include="..\AutoMapper.Collection\AutoMapper.Collection.csproj">
<Project>{37ad667a-8080-476c-88fd-20310ac7caf3}</Project>
<Name>AutoMapper.Collection</Name>
</ProjectReference>
<PackageReference Include="FluentAssertions" Version="$(FluentAssertions)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSDKVersion)" />
<PackageReference Include="xunit" Version="$(xUnitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(xUnitVersion)" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using AutoMapper.EntityFramework;
using AutoMapper.EquivalencyExpression;
using FluentAssertions;
using Xunit;

namespace AutoMapper.Collection.EntityFramework.Tests
{
Expand All @@ -21,6 +22,7 @@ public MapCollectionWithEqualityTests()
});
}

[Fact]
public void Should_Keep_Existing_List()
{
var dtos = new List<ThingDto>
Expand All @@ -38,6 +40,7 @@ public void Should_Keep_Existing_List()
Mapper.Map(dtos, items).Should().BeSameAs(items);
}

[Fact]
public void Should_Update_Existing_Item()
{
var dtos = new List<ThingDto>
Expand All @@ -56,6 +59,7 @@ public void Should_Update_Existing_Item()
Mapper.Map(dtos, items.ToList()).Should().HaveElementAt(0, cache.First());
}

[Fact]
public void Should_Work_With_Null_Destination()
{
var dtos = new List<ThingDto>
Expand All @@ -67,6 +71,7 @@ public void Should_Work_With_Null_Destination()
Mapper.Map<List<Thing>>(dtos).Should().HaveSameCount(dtos);
}

[Fact]
public void Should_Be_Instanced_Based()
{
Mapper.Reset();
Expand All @@ -92,6 +97,7 @@ public void Should_Be_Instanced_Based()
Mapper.Map(dtos, items.ToList()).Should().NotContain(cache.First());
}

//[Fact]
//public void Should_Persist_To_Update()
//{
// var db = new DB();
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<Description>Collection updating support for EntityFramework 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>
<VersionPrefix>3.1.3</VersionPrefix>
<Authors>Tyler Carlson</Authors>
<TargetFramework>net45</TargetFramework>
<AssemblyName>AutoMapper.Collection.EntityFramework</AssemblyName>
Expand All @@ -21,6 +20,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.ExpressionMapping" Version="1.0.0" />
<PackageReference Include="EntityFramework" Version="6.1.3" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/AutoMapper.Collection.EntityFramework/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Data.Entity;
using AutoMapper.QueryableExtensions.Impl;
using AutoMapper.Extensions.ExpressionMapping.Impl;

namespace AutoMapper.EntityFramework
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<Description>Collection updating support for LinqToSQL with AutoMapper. Extends Table&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>
<VersionPrefix>3.1.3</VersionPrefix>
<Authors>Tyler Carlson</Authors>
<TargetFramework>net45</TargetFramework>
<AssemblyName>AutoMapper.Collection.LinqToSQL</AssemblyName>
Expand All @@ -20,6 +19,10 @@
<ProjectReference Include="..\AutoMapper.Collection\AutoMapper.Collection.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.ExpressionMapping" Version="1.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System.Data" />
<Reference Include="System.Data.Linq" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Data.Linq;
using AutoMapper.QueryableExtensions.Impl;
using AutoMapper.Extensions.ExpressionMapping.Impl;

namespace AutoMapper.Collection.LinqToSQL
{
Expand Down
3 changes: 3 additions & 0 deletions src/AutoMapper.Collection.Tests/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using Xunit;

[assembly: CollectionBehavior(DisableTestParallelization = true)]
Loading