Skip to content

Commit

Permalink
pr 99 merged manually
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardoporro committed Jan 31, 2024
2 parents 8dffa6d + 3e7e199 commit f4d8a8c
Show file tree
Hide file tree
Showing 88 changed files with 365 additions and 2,361 deletions.
13 changes: 13 additions & 0 deletions Detached.Mappers.sln
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Detached.Mappers.HotChocola
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "contrib", "contrib", "{5409CE02-02AD-448B-85A5-EFEABA6C52C8}"
EndProject

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Detached.Mappers.Tests.Contrib.ScottSoftware", "contrib\Detached.Mappers.Tests.Contrib.ScottSoftware\Detached.Mappers.Tests.Contrib.ScottSoftware.csproj", "{95AA701E-8042-460C-886F-60F550B9A477}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -92,6 +95,14 @@ Global
{B6162ECF-00B0-4506-B3E8-2A4B46517ECE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B6162ECF-00B0-4506-B3E8-2A4B46517ECE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B6162ECF-00B0-4506-B3E8-2A4B46517ECE}.Release|Any CPU.Build.0 = Release|Any CPU
{713EB397-9271-45F6-811C-CD84CD6BB194}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{713EB397-9271-45F6-811C-CD84CD6BB194}.Debug|Any CPU.Build.0 = Debug|Any CPU
{713EB397-9271-45F6-811C-CD84CD6BB194}.Release|Any CPU.ActiveCfg = Release|Any CPU
{713EB397-9271-45F6-811C-CD84CD6BB194}.Release|Any CPU.Build.0 = Release|Any CPU
{95AA701E-8042-460C-886F-60F550B9A477}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{95AA701E-8042-460C-886F-60F550B9A477}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95AA701E-8042-460C-886F-60F550B9A477}.Release|Any CPU.ActiveCfg = Release|Any CPU
{95AA701E-8042-460C-886F-60F550B9A477}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -110,6 +121,8 @@ Global
{42962E94-05D1-4D67-8BB2-572B04CBC3F7} = {C9521C36-FBA4-4B3E-AE14-A1735E9D1E71}
{B6162ECF-00B0-4506-B3E8-2A4B46517ECE} = {42962E94-05D1-4D67-8BB2-572B04CBC3F7}
{5409CE02-02AD-448B-85A5-EFEABA6C52C8} = {745CB1E1-F50B-4307-8BD6-1ADDC837102B}
{713EB397-9271-45F6-811C-CD84CD6BB194} = {C9521C36-FBA4-4B3E-AE14-A1735E9D1E71}
{95AA701E-8042-460C-886F-60F550B9A477} = {42962E94-05D1-4D67-8BB2-572B04CBC3F7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7FC47439-B36B-45BB-BEEC-A6D595358C63}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Detached.Mappers.EntityFramework.Contrib.SysTec.Dtos.Bug17;
using Detached.Mappers.EntityFramework.Contrib.SysTec.Dtos.Bug18;
using Detached.Mappers.EntityFramework.Contrib.SysTec.Dtos.inheritance;
using Detached.Mappers.EntityFramework.Extensions;
using Detached.Mappers.EntityFramework;
using GraphInheritenceTests.Dtos;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using Detached.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels
{
Expand All @@ -12,8 +7,9 @@ public class Address : IdBase
public string Street { get; set; }
public string PostalCode { get; set; }
public string City { get; set; }

public int CountryId { get; set; }

[Aggregation]
public Country Country { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels
namespace Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels
{
public class Country : IdBase
{
Expand All @@ -14,4 +8,4 @@ public class Country : IdBase
public int? FlagPictureId { get; set; }
public Picture FlagPicture { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
using Detached.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels
namespace Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels
{
public class Government : OrganizationBase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using Detached.Annotations;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using Detached.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Detached.Annotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Detached.Annotations;
using Microsoft.EntityFrameworkCore;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
using Detached.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels
namespace Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels
{
public class SubGovernment : Government
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.Dtos.Bug17;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.Dtos
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public class GovernmentDto : OrganizationBaseDto
{
public string GovernmentIdentifierCode { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.Dtos
{
Expand All @@ -12,4 +7,4 @@ public abstract class IdBaseDto : ConcurrencyStampBaseDto
[Key]
public int Id { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ public class OrganizationBaseDto : IdBaseDto

public int PrimaryAddressId { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using Detached.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.Dtos
{
Expand All @@ -13,4 +8,4 @@ public class OrganizationListDto : IdBaseDto

public List<OrganizationBaseDto> Organizations { get; set; } = new List<OrganizationBaseDto>();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels;
using Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.Dtos
{
public class StudentDto : IdBaseDto
{
public string Name { get; set; }

public int Age { get; set; }

public StudentGrades Grades { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public class SubGovernmentDto : GovernmentDto
{
public string SubName { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using Detached.Annotations;
using Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec.DeepModel
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using Detached.Annotations;
using Detached.Mappers.EntityFramework.Contrib.SysTec.ComplexModels;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Detached.Mappers.EntityFramework.Contrib.SysTec
{
Expand All @@ -15,7 +12,8 @@ public static string GetFriendlyName(this Enum genericEnum)
MemberInfo[] memberInfo = genericEnumType.GetMember(genericEnum.ToString());
if (memberInfo != null && memberInfo.Length > 0)
{
var _attribs = memberInfo[0].GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
var _attribs = memberInfo[0]
.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
if (_attribs != null && _attribs.Length > 0)
{
return ((System.ComponentModel.DescriptionAttribute)_attribs.ElementAt(0)).Description;
Expand All @@ -25,4 +23,4 @@ public static string GetFriendlyName(this Enum genericEnum)
return genericEnum.ToString();
}
}
}
}
18 changes: 18 additions & 0 deletions contrib/Detached.Mappers.Tests.Contrib.ScottSoftware/Creator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Collections.ObjectModel;

namespace Detached.Mappers.Tests.Contrib.ScottSoftware;

public class Creator
{
public int Id { get; set; }

public string FullName { get; set; }

public DateTime Born { get; set; }

public DateTime Died { get; set; }

public string? PrimaryLanguage { get; set; }

public Collection<Work> Works { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Detached.Mappers.Tests.Contrib.ScottSoftware;

public class CreatorConfiguration : IEntityTypeConfiguration<Creator>
{
public void Configure(EntityTypeBuilder<Creator> builder)
{
builder.HasKey(p => p.Id);
builder.HasMany(p => p.Works).WithOne(a => a.Creator).OnDelete(DeleteBehavior.Cascade);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.EntityFrameworkCore">
<HintPath>..\..\..\..\.nuget\packages\microsoft.entityframeworkcore\7.0.10\lib\net6.0\Microsoft.EntityFrameworkCore.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Detached.Mappers.EntityFramework\Detached.Mappers.EntityFramework.csproj" />
</ItemGroup>

</Project>
Loading

0 comments on commit f4d8a8c

Please sign in to comment.