main
 1using System;
 2using AutoMapper;
 3using presentation.windows.common;
 4using presentation.windows.common.messages;
 5using presentation.windows.server.domain;
 6
 7namespace presentation.windows.server
 8{
 9    public class ConfigureMappings : NeedStartup
10    {
11        public void run()
12        {
13            Map<Person, AddedNewFamilyMember>(x =>
14            {
15                return new AddedNewFamilyMember
16                       {
17                           id = x.id,
18                           first_name = x.first_name,
19                           last_name = x.last_name,
20                       };
21            });
22
23            //Map<Message, object>(x =>
24            //{
25            //    using (var stream = new MemoryStream(x.Data))
26            //    {
27            //        return Serializer.NonGeneric.Deserialize(Type.GetType(x.Headers["type"]), stream);
28            //    }
29            //});
30        }
31
32        void Map<Input, Output>(Func<Input, Output> conversion)
33        {
34            Mapper
35                .CreateMap<Input, Output>()
36                .ConvertUsing(conversion);
37        }
38    }
39}