static Mapper() { TypeMapper.CreateMap <With.Message.IObservation, Observed>(); TypeMapper.CreateMap <With.Message.IStopped, Stopped>(); TypeMapper.CreateMap <With.Message.IStarted, Started>(); TypeMapper.CreateMap <With.Message.IDeregister, Deregistered>(); TypeMapper.CreateMap <With.Message.IRegister, Registered>(); //TypeMapper.CreateMap<With.Component.MeasurementType, Schema.MeasurementType>(); TypeMapper.CreateMap <With.Component.IIdentity, Component.Identity>().ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.ToString())); TypeMapper.CreateMap <With.Component.IDescription, Component.Description>(); TypeMapper.CreateMap <With.Component.IEntity, Component.Entity>().ForMember(dest => dest.Identity, opt => opt.MapFrom(src => src.Identity)); TypeMapper.CreateMap <With.Component.IEntityDescription, Component.EntityDescription>(); TypeMapper.CreateMap <With.Component.IMeasurement, Component.Measurement>(); TypeMapper.CreateMap <With.Component.IValueDescription, Component.ValueDescription>(); TypeMapper.CreateMap <With.Component.IObservable, Component.Observable>().ForMember(dest => dest.Identity, opt => opt.MapFrom(src => src.Identity)); TypeMapper.CreateMap <With.Component.IParameter, Component.Parameter>().ForMember(dest => dest.Identity, opt => opt.MapFrom(src => src.Identity)); TypeMapper.CreateMap <With.Component.IParameterDescription, Component.ParameterDescription>(); TypeMapper.CreateMap <With.Component.IActionable, Component.Actionable>().ForMember(dest => dest.Identity, opt => opt.MapFrom(src => src.Identity)); /* * TypeMapper.CreateMap<With.Component.IParameterValue, Schema.ParameterValue>() * .ForMember(dest => dest.UniqueIdentifier, opt => opt.MapFrom(src => src.Identity)); */ TypeMapper.CreateMap <With.Message.IRegister, Event.Registered>(); TypeMapper.CreateMap <With.Message.IDeregister, Event.Deregistered>(); TypeMapper.CreateMap <With.Message.IObservation, Event.Observed>(); TypeMapper.CreateMap <With.Message.IAction, Event.Action>(); TypeMapper.AssertConfigurationIsValid(); }
private static void CreateMapping <TSource, TDest, TImplementation>() { TypeMapper.CreateMap <TSource, TImplementation>(); TypeMapper.CreateMap <TSource, TDest>().As <TImplementation>(); }
private static void CreateMapping <TSource, TDest, TImplementation>(Action <IMappingExpression <TSource, TImplementation> > mapping) { mapping(TypeMapper.CreateMap <TSource, TImplementation>()); TypeMapper.CreateMap <TSource, TDest>().As <TImplementation>(); }
public void SetUp() { AutoMapperMapper.Reset(); AutoMapperMapper.CreateMap <Source, Destination>(); }