Skip to content

Factory object mappings

Emma Corbett edited this page Jun 25, 2020 · 1 revision

The EntityFactory.cs and ResponseFactory.cs classes provide mapping functions between objects. You can then call this class whenever you require this mapping, keeping your classes which hold logic tidier and clearer.

If the mapping functions are tested in isolation then they can be used in tests as well so you don't have to write out the mapping in your tests, also keeping them tidier.

  • EntityFactory.cs maps fields from the database entities defined the database context to fields in your domain object. This method should be tested in EntityFactoryTest.cs.

  • ResponseFactory.cs maps fields in your domain object to the response object and should be tested in ResponseFactoryTest.cs.

Clone this wiki locally