Creating a DTO
Let's see this with an example. In this case we will create a mapper for a Button model.
First we need a DTO. A DTO is Plain Old C# Object (POCO). In this example our DTO will be like the following:
A DTO class must use a DataTransfer
attribute from Mobilize.WebMap.Common.Attributes
.
Or alternatively must implement the IDataTransfer interface.
Follow these guidelines when creating your DTOs:
classes should not inherit from any other classes
use nullable types for value types. For example
int?
instead ofint
the name used on the
DataTransfer
attribute should beunique
as short as possible
it should start with a lowercase consonant
it should not use vowels
if it is made up of several words the next word should have just its first letter in uppercase
Last updated