Skip to content

Commit

Permalink
adding minor comments plus fixing mapping without compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
anisimovyuriy committed May 16, 2015
1 parent 88ff138 commit 653723e
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ExpressMapper NET40/CollectionTypes.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace ExpressMapper
{
/// <summary>
/// Enumeration for determining collection type
/// </summary>
public enum CollectionTypes
{
None = 0,
Expand Down
1 change: 1 addition & 0 deletions ExpressMapper NET40/ExpressMapper NET40.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\ExpressMapper.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
4 changes: 4 additions & 0 deletions ExpressMapper NET40/ICustomTypeMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
public interface ICustomTypeMapper
{
}

/// <summary>
/// Interface to implement custom mapper
/// </summary>
public interface ICustomTypeMapper<in T, out TN> : ICustomTypeMapper
{
TN Map(T src);
Expand Down
5 changes: 5 additions & 0 deletions ExpressMapper NET40/IMemberConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

namespace ExpressMapper
{
/// <summary>
/// Interface to extend the mapping
/// </summary>
/// <typeparam name="T">source</typeparam>
/// <typeparam name="TN">destination</typeparam>
public interface IMemberConfiguration<T, TN>
{
IMemberConfiguration<T, TN> Instantiate(Func<T, TN> constructor);
Expand Down
5 changes: 5 additions & 0 deletions ExpressMapper NET40/ITypeMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ public interface ITypeMapper
void Compile();
}

/// <summary>
/// Interface that implements internals of mapping
/// </summary>
/// <typeparam name="T">source</typeparam>
/// <typeparam name="TN">destination</typeparam>
public interface ITypeMapper<T, TN> : ITypeMapper
{
TN MapTo(T obj);
Expand Down
3 changes: 3 additions & 0 deletions ExpressMapper NET40/MapNotImplemented.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace ExpressMapper
{
/// <summary>
/// Not implemented exception
/// </summary>
public class MapNotImplemented : Exception
{
public MapNotImplemented(Type src, Type dest, string message) : base(message)
Expand Down
4 changes: 4 additions & 0 deletions ExpressMapper NET40/TypeMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ public void Custom(ICustomTypeMapper<T, TN> customTypeMapper)

public TN MapTo(T obj)
{
if (_mapFunc == null)
{
Compile();
}
return _mapFunc(obj);
}

Expand Down
14 changes: 14 additions & 0 deletions ExpressMapper.Tests NET40/BasicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ namespace ExpressMapper.Tests
[TestFixture]
public class BasicTests : BaseTestClass
{
[Test]
public void CompilelessMap()
{
Mapper.Register<TestModel, TestViewModel>();
Mapper.Register<Size, SizeViewModel>();
Mapper.Register<Country, CountryViewModel>();

var test = Functional.AutoMemberMap();

var testViewModel = test.Key.MapTo<TestModel, TestViewModel>();

Assert.AreEqual(testViewModel, test.Value);
}

[Test]
public void AutoMemberMap()
{
Expand Down

0 comments on commit 653723e

Please sign in to comment.