Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Unity-compatible Boxed.Mapping.Unity package #608

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions Framework.sln
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
.github\workflows\release-drafter.yml = .github\workflows\release-drafter.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boxed.Mapping.Unity", "Source\Boxed.Mapping\Boxed.Mapping.Unity.csproj", "{35F0C50B-BBE5-4F99-A507-B759A0EC717A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -132,6 +134,10 @@ Global
{1E0E624E-9291-4F6A-B68F-2E5FA178B6CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E0E624E-9291-4F6A-B68F-2E5FA178B6CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E0E624E-9291-4F6A-B68F-2E5FA178B6CF}.Release|Any CPU.Build.0 = Release|Any CPU
{35F0C50B-BBE5-4F99-A507-B759A0EC717A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35F0C50B-BBE5-4F99-A507-B759A0EC717A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35F0C50B-BBE5-4F99-A507-B759A0EC717A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35F0C50B-BBE5-4F99-A507-B759A0EC717A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -151,6 +157,7 @@ Global
{0AC34385-AACA-424C-9F53-089FA4803330} = {DC7FDD72-F9C9-42E9-90CC-468BDD9A5CC2}
{1BD25AE7-6BA8-4120-BFF2-E1B0EF3D6E84} = {F316174B-045B-4DC0-9097-8CE746A8BBB0}
{828C70F2-431D-46A8-82BD-436A20BA146A} = {1BD25AE7-6BA8-4120-BFF2-E1B0EF3D6E84}
{35F0C50B-BBE5-4F99-A507-B759A0EC717A} = {D37BD4B2-A87B-4FA1-A1E0-01F1CAD19F0D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3BCEA536-0EA4-4EC0-B121-7B83926F8514}
Expand Down
23 changes: 23 additions & 0 deletions Source/Boxed.Mapping/Boxed.Mapping.Unity.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Build">
<TargetFrameworks>net7.0;net6.0;netstandard2.1;netstandard2.0;netstandard1.3</TargetFrameworks>
<RootNamespace>Boxed.Mapping</RootNamespace>
</PropertyGroup>

<PropertyGroup Label="Package">
<Product>Object Mapping Boxed</Product>
<Description>An object to object mapper that does not use reflection. This is a Unity-compatible version.</Description>
<PackageTags>Mapper;Object Mapper;Automapper;Boxed;Muhammad Rehan Saeed;Framework;Unity</PackageTags>
<PackageReadmeFile>Boxed.Mapping.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup Label="Files">
<None Include="..\..\Documentation\Boxed.Mapping.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<Compile Remove="Factory.cs" />
</ItemGroup>

</Project>
4 changes: 4 additions & 0 deletions Source/Boxed.Mapping/Boxed.Mapping.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@
<None Include="..\..\Documentation\Boxed.Mapping.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<Compile Remove="Factory.Unity.cs" />
RehanSaeed marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>

</Project>
20 changes: 20 additions & 0 deletions Source/Boxed.Mapping/Factory.Unity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace Boxed.Mapping;

using System.Runtime.CompilerServices;

/// <summary>
/// Creates instances of type <typeparamref name="T"/>.
/// </summary>
/// <typeparam name="T">The type with a parameterless constructor.</typeparam>
public static class Factory<T>
where T : new()
{
/// <summary>
/// Creates an instance of type <typeparamref name="T"/> by calling it's parameterless constructor.
/// </summary>
/// <returns>An instance of type <typeparamref name="T"/>.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#pragma warning disable CA1000 // Do not declare static members on generic types
public static T CreateInstance() => new();
#pragma warning restore CA1000 // Do not declare static members on generic types
}
Loading