Table of Contents
Last updated: 2024-05-17

Building a Mapper


Caution

Sample code provided in here is for demonstration and educational purposes only which provides customers with programming information regarding the products and is not intended for use in a production environment. All production code should always follow development best practises. All sample code here is supplied "AS IS" without any warranties or support.

This chapter is a walkthrough of the steps required to create a mapper between two repositories based on the Model Framework. The key concepts used when creating a mapper based on the Model Framework are:

  • Mapper – The outer class defining the source and target repositories
  • Mapping – A named transformation of entities from the source repository into entities in the target repository.
  • Map – The actual implementation to be invoked when executing named Mapping.

A Mapper (Family10ToNova) can have multiple Mappings (MaleMapping, FemaleMapping) which all have their own Map (MaleMapping.Map()) implementation.

Create a Family to SAsBase Mapper


  1. Add a new Class Library project to the solution and name it Demo.Mapper.Family10ToNova. Make sure to use .NET Core 3.0 or .NET Standard 2.1.
  2. Add project reference to Demo.Toolbox.Family
  3. Add NuGet reference to Eurostep.ModelFramework.version.nupkg
  4. Change the implementation of the FamilyMapper class to say:

FamilyMapper.cs

Warning

It looks like the sample you are looking for does not exist.

Add a new file called FamilyMapping.cs and change the implementation of FamilyMapping to

FamilyMapping.cs

Warning

It looks like the sample you are looking for does not exist.

  • Create a new folder called Mappings in the project.
  • Inside the Mappings folder create a new file named MaleMapping.cs.
  • Change the implementation of the MaleMapping class to the following:

MaleMapping.cs

Warning

It looks like the sample you are looking for does not exist.

  • Add another file named OrganizationMapping.cs to the Mappings folder.
  • Change the implementation of the OrganizationMapping to the following:

IdentifyingContextMapping.cs

Warning

It looks like the sample you are looking for does not exist.

Clean and rebuild the solution to verify that everything compiles.