예제 #1
0
파일: Mapper.cs 프로젝트: ibebbs/Harmonize
        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();
        }
예제 #2
0
        private static void ConfigureAutoMapper(Container container)
        {
            container.RegisterAll <Profile>(new BitbucketToDomainMappingProfile());

            Mapper.Initialize(x =>
            {
                var profiles = container.GetAllInstances <Profile>();

                foreach (var profile in profiles)
                {
                    x.AddProfile(profile);
                }
            });

            Mapper.AssertConfigurationIsValid();
        }
예제 #3
0
 public void ShouldThrowException()
 {
     AutoMapperMapper.AssertConfigurationIsValid();
 }