-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Development' of https://github.com/expressmapper/Expres…
…sMapper into Development
- Loading branch information
Showing
9 changed files
with
147 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
|
||
namespace ExpressMapper | ||
{ | ||
internal class DelegateCustomTypeMapper<T, TN> : ICustomTypeMapper<T, TN> | ||
{ | ||
private readonly Func<T, TN> _mapFunc; | ||
|
||
public DelegateCustomTypeMapper(Func<T, TN> mapFunc) | ||
{ | ||
_mapFunc = mapFunc; | ||
} | ||
|
||
public TN Map(IMappingContext<T, TN> context) | ||
{ | ||
return _mapFunc(context.Source); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,43 @@ | ||
using ExpressMapper.Tests.Model.Enums; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace ExpressMapper.Tests.Model.ViewModels | ||
{ | ||
public class TestViewModel : IEquatable<TestViewModel> | ||
{ | ||
public Guid Id { get; set; } | ||
using System.Linq; | ||
|
||
namespace ExpressMapper.Tests.Model.ViewModels | ||
{ | ||
public class TestViewModel : IEquatable<TestViewModel> | ||
{ | ||
public Guid Id { get; set; } | ||
public string Name { get; set; } | ||
public int Age { get; set; } | ||
public int NotNullable { get; set; } | ||
public int? Nullable { get; set; } | ||
public int? Nullable { get; set; } | ||
public decimal? Weight { get; set; } | ||
public long Height { get; set; } | ||
public bool BoolValue { get; set; } | ||
public CountryViewModel Country { get; set; } | ||
public bool BoolValue { get; set; } | ||
public CountryViewModel Country { get; set; } | ||
public List<SizeViewModel> Sizes { get; set; } | ||
public DateTime Created { get; set; } | ||
public GenderTypes Gender { get; set; } | ||
public string NullableGender { get; set; } | ||
public int GenderIndex { get; set; } | ||
public bool Equals(TestViewModel other) | ||
{ | ||
var sizes = true; | ||
if (Sizes != null && other.Sizes != null) | ||
{ | ||
if (Sizes.Count == other.Sizes.Count) | ||
{ | ||
if (Sizes.Where((t, i) => !t.Equals(other.Sizes[i])).Any()) | ||
{ | ||
sizes = false; | ||
} | ||
} | ||
public int GenderIndex { get; set; } | ||
public List<String> StringCollection { get; set; } | ||
public bool Equals(TestViewModel other) | ||
{ | ||
var sizes = true; | ||
if (Sizes != null && other.Sizes != null) | ||
{ | ||
if (Sizes.Count == other.Sizes.Count) | ||
{ | ||
if (Sizes.Where((t, i) => !t.Equals(other.Sizes[i])).Any()) | ||
{ | ||
sizes = false; | ||
} | ||
} | ||
} | ||
|
||
return Id == other.Id && Name == other.Name && Age == other.Age && NotNullable == other.NotNullable && Nullable.GetValueOrDefault() == other.Nullable.GetValueOrDefault() && Weight == other.Weight && BoolValue == other.BoolValue && Gender == other.Gender && NullableGender == other.NullableGender && GenderIndex == other.GenderIndex && | ||
Created == other.Created && ((Country == null && other.Country == null) || Country.Equals(other.Country)) && sizes; | ||
} | ||
} | ||
} | ||
return Id == other.Id && Name == other.Name && Age == other.Age && NotNullable == other.NotNullable && Nullable.GetValueOrDefault() == other.Nullable.GetValueOrDefault() && Weight == other.Weight && BoolValue == other.BoolValue && Gender == other.Gender && NullableGender == other.NullableGender && GenderIndex == other.GenderIndex && | ||
Created == other.Created && ((Country == null && other.Country == null) || Country.Equals(other.Country)) && sizes; | ||
} | ||
} | ||
} |