Skip to content

Commit

Permalink
Updated Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
garywoodfine committed Feb 23, 2018
1 parent c53d001 commit 574decf
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Threenine.Map/Threenine.Map.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Company>Three Nine Consulting Limited</Company>
<Authors>Gary Woodfine</Authors>
<PackageProjectUrl>https://threenine.github.io/ReflectMap/</PackageProjectUrl>
<PackageProjectUrl>https://threenine.github.io/Threenine.Map/</PackageProjectUrl>
<PackageIconUrl>http://static.threenine.co.uk/threeninemap_icon.png</PackageIconUrl>
<PackageTags>mapping AutoMapper Reflection</PackageTags>
<Copyright>Copyright ©2018 Three Nine Consulting Limited</Copyright>
<Description>Reflection mapper wrapper for AutoMapper</Description>
<PackageLicenseUrl>http://opensource.org/licenses/MS-PL</PackageLicenseUrl>
<NeutralLanguage>en</NeutralLanguage>
<RepositoryUrl>https://github.com/threenine/ReflectMap</RepositoryUrl>
<RepositoryUrl>https://github.com/threenine/Threenine.Map</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageReleaseNotes>Breaking changes in version 1.0.2 - removed dependency on PhilosophicalMonkey.
- added new Scan Method</PackageReleaseNotes>
Expand Down
47 changes: 47 additions & 0 deletions docs/MapConfigurationFactory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,50 @@ Your mappings will now be available throughout your application. So now making
}

Will result in your Mapping being invoked

LoadMapsFromAssemblies
----------------------

If speed and optimisation is a concern and you would rather explicitly pass in your assemblies containing your mapping logic you can do so, making use of the `LoadMapsFromAssemblies`
method. It accepts a `params` array of assemblies, which you can supply an unlimited assemblies to it containing your mapping logic.

One way to do so would be to define a helper method to return an assembly by passing name to it, then retrieve the assmebly from those names
::
public class GetMappings
{
public void Get()
{
var domainObjects = GetAssemblyByName("DomainObjects");
var entityObjects = GetAssemblyByName("EntityObjects");

MapConfigurationFactory.LoadMapsFromAssemblies(domainObjects, entityObjects);
}

private Assembly GetAssemblyByName(string name)
{
return AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(assembly => assembly.GetName().Name == name);
}
}

LoadAllMappings
---------------
If you only want to load mappings from a particular assembly then you can make use of `LoadAllMappings` making use of a smilar stategy.

::
public class GetMappings
{
public void Get()
{
var domainObjects = GetAssemblyByName("DomainObjects");
MapConfigurationFactory.LoadAllMappings(domainObjects.GetTypes());
}

private Assembly GetAssemblyByName(string name)
{
return AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(assembly => assembly.GetName().Name == name);
}
}

0 comments on commit 574decf

Please sign in to comment.