Exemplo n.º 1
0
 public static void Initialize()
 {
     Mapper.AddProfile(new Inventory.Mapping.DomainToDatabase());
     Mapper.AddProfile(new Inventory.Mapping.DatabaseToDomain());
 }
Exemplo n.º 2
0
 protected BaseController()
 {
     Db = new DialogueStoreContext();
     Mapper.AddProfile <DialogueStoreProfile>();
 }
Exemplo n.º 3
0
 public static void Initialize()
 {
     Mapper.AddProfile(new NavCategoryValueToNavCategoryViewModelProfile());
     Mapper.AddProfile(new NavSubCategoryValueToNavSubCategoryViewModelProfile());
 }
Exemplo n.º 4
0
 static Mapeador()
 {
     Mapper.AddProfile <MvcProfile>();
 }
Exemplo n.º 5
0
 public static void Configurar()
 {
     Mapper.AddProfile <DominioParaViewModelProfile>();
     Mapper.AddProfile <ViewModelParaDominioProfile>();
 }
 public static void Configure()
 {
     Mapper.AddProfile <ModelToDomainMappingProfile>();
     Mapper.AddProfile <DomainToModelMappingProfile>();
 }
Exemplo n.º 7
0
 protected static void AddMappingProfile()
 {
     Mapper.AddProfile(MappingProfile);
 }
Exemplo n.º 8
0
 static MapLinkCoordinateFinder()
 {
     Mapper.AddProfile(new AddressMapper());
 }
 private static void ConfigureMaping()
 {
     Mapper.AddProfile(new AutoMapperProfile());
 }
Exemplo n.º 10
0
 public override void Because()
 {
     Mapper.AddProfile(new ChocolateyAutoMapperWebProfile());
 }
Exemplo n.º 11
0
 public static void Initialize()
 {
     Mapper.AddProfile(new ModelProfile());
 }
Exemplo n.º 12
0
 public static void Configurar()
 {
     Mapper.AddProfile <DomainToViewModelProfile>();
 }
        public void Configuration(IAppBuilder app)
        {
            log4net.Config.XmlConfigurator.Configure();
            ILog logger = LogManager.GetLogger("Logger");

            logger.Info("Application Started");
            logger.Info("Configuring DI container");
            IWindsorContainer container = new WindsorContainer();

            ServiceLocator.Set(container);
            BootstrapConfig.Register(container, logger);

            logger.Info("Configuring HTTP Middleware");
            app.MapSignalR();
            app.UseMultitenancy(new MultitenancyNotifications <TenantDto>
            {
                TenantIdentifierNotFound = context =>
                {
                    throw new HttpException(404, "Tenant identifier must be provided");
                },
                TenantRecordNotFound = context =>
                {
                    context.Response.Redirect("/signup/tenant/");
                    return(Task.FromResult(0));
                },
                CreateTenantContext = (context, tenantRecord) =>
                {
                    ITenantContextFactory tenantContextFactory = ServiceLocator.Resolve <ITenantContextFactory>();
                    TenantContext tenantContext = tenantContextFactory.Create(tenantRecord.Id, tenantRecord.NameFriendly, tenantRecord.AuthClientId, tenantRecord.AuthAuthority);
                    return(Task.FromResult(tenantContext));
                }
            });
            app.UsePerTenant((tenantContext, appBranch) =>
            {
                appBranch.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

                appBranch.UseCookieAuthentication(new CookieAuthenticationOptions
                {
                    CookieName = $"OAuthCookie.{tenantContext.FriendlyName}"
                });

                appBranch.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
                {
                    ClientId      = tenantContext.AuthClientId,
                    Authority     = tenantContext.AuthAuthority,
                    RedirectUri   = $"http://localhost:2295/{tenantContext.FriendlyName}/",
                    Notifications = new OpenIdConnectAuthenticationNotifications()
                    {
                        AuthenticationFailed = context =>
                        {
                            context.HandleResponse();
                            throw context.Exception;
                        }
                    }
                });

                appBranch.Use <AuthenticationChallangeMiddleware>();
                appBranch.Use <AuthenticationAudienceCheckMiddleware>(tenantContext);
                appBranch.Use <AuthenticationClaimsAppenderMiddleware>();
            });

            logger.Info("Configuring MVC Pipeline");
            AreaRegistration.RegisterAllAreas();
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier;

            logger.Info("Configuring Domain, DTO and Model Mapping");
            MappingConfig.RegisterMapping();
            Mapper.AddProfile(new Web.Models.Map());

            app.OnDispose(() =>
            {
                ServiceLocator.Resolve <ILog>().Info("Application Ended");
                ServiceLocator.Release();
            });
        }
Exemplo n.º 14
0
 public static void AddMappings()
 {
     Mapper.AddProfile <MyProfile>();
 }
Exemplo n.º 15
0
 private static void RegisterMaps()
 {
     Mapper.AddProfile <ContatoProfile>();
     Mapper.AddProfile <TelefoneProfile>();
 }
Exemplo n.º 16
0
 static MetricsMapper()
 {
     Mapper.AddProfile <GeneralProfile>();
     Mapper.AllowNullDestinationValues = false;
 }
Exemplo n.º 17
0
 public static void Config()
 {
     Mapper.AddProfile(new TradingProfile());
     Mapper.AddProfile(new DataEntryProfile());
 }
Exemplo n.º 18
0
        private void RegisterMaps()
        {
            var profile = new BookingApiMapperProfile();

            Mapper.AddProfile(profile);
            Mapper.AssertConfigurationIsValid(profile.ProfileName);

            Mapper.CreateMap <BookingSettingsRequest, UpdateBookingSettings>();
            Mapper.CreateMap <CreateOrderRequest, Commands.CreateOrder>()
            .ForMember(p => p.Id, options => options.Ignore())
            .ForMember(p => p.EstimatedFare, opt => opt.ResolveUsing(x => x.Estimate.Price))
            .ForMember(p => p.UserNote, opt => opt.ResolveUsing(x => x.Note))
            .ForMember(p => p.OrderId,
                       options => options.ResolveUsing(x => x.Id == Guid.Empty ? Guid.NewGuid() : x.Id));

            Mapper.CreateMap <CreateOrderRequest, SendBookingConfirmationEmail>()
            .ForMember(p => p.Id, options => options.Ignore());

            Mapper.CreateMap <PaymentSettings, Commands.CreateOrder.PaymentInformation>();
            Mapper.CreateMap <BookingSettings, SendBookingConfirmationEmail.InternalBookingSettings>();
            Mapper.CreateMap <Address, IbsAddress>()
            .ForSourceMember(p => p.FullAddress, options => options.Ignore())
            // Fix for issue where FullAddress contains a place name at the begining.
            .AfterMap((addr, ibsAddr) => ibsAddr.FullAddress = Regex.IsMatch(addr.FullAddress, "^[a-zA-Z]") && addr.DisplayAddress.HasValue()
                    ? addr.DisplayAddress
                    : addr.FullAddress
                      );

            Mapper.CreateMap <OrderStatusDetail, OrderStatusRequestResponse>();
            Mapper.CreateMap <OrderPairingDetail, OrderPairingResponse>();

            Mapper.CreateMap <apcurium.MK.Booking.IBS.ChargeAccounts.RequestResponse.Resources.Prompt, apcurium.MK.Booking.Api.Contract.Resources.Prompt>();
            Mapper.CreateMap <ChargeAccount, IbsChargeAccount>();
            Mapper.CreateMap <ChargeAccountValidation, IbsChargeAccountValidation>();

            Mapper.CreateMap <RegisterAccount, Commands.RegisterAccount>()
            .ForMember(p => p.AccountId,
                       options => options.ResolveUsing(x => x.AccountId == Guid.Empty ? Guid.NewGuid() : x.AccountId));
            Mapper.CreateMap <RegisterAccount, RegisterTwitterAccount>()
            .ForMember(p => p.AccountId,
                       options => options.ResolveUsing(x => x.AccountId == Guid.Empty ? Guid.NewGuid() : x.AccountId));

            Mapper.CreateMap <RegisterAccount, RegisterFacebookAccount>()
            .ForMember(p => p.AccountId,
                       options => options.ResolveUsing(x => x.AccountId == Guid.Empty ? Guid.NewGuid() : x.AccountId));


            Mapper.CreateMap <SaveAddress, AddFavoriteAddress>();

            Mapper.CreateMap <SaveAddress, UpdateFavoriteAddress>();

            Mapper.CreateMap <DefaultFavoriteAddress, AddDefaultFavoriteAddress>();

            Mapper.CreateMap <DefaultFavoriteAddress, UpdateDefaultFavoriteAddress>();

            Mapper.CreateMap <Tariff, CreateTariff>()
            .ForMember(p => p.TariffId, opt => opt.ResolveUsing(x => x.Id == Guid.Empty ? Guid.NewGuid() : x.Id))
            .ForMember(p => p.CompanyId, opt => opt.UseValue(AppConstants.CompanyId));

            Mapper.CreateMap <Tariff, UpdateTariff>()
            .ForMember(p => p.TariffId, opt => opt.ResolveUsing(x => x.Id == Guid.Empty ? Guid.NewGuid() : x.Id))
            .ForMember(p => p.CompanyId, opt => opt.UseValue(AppConstants.CompanyId));


            Mapper.CreateMap <RuleRequest, CreateRule>()
            .ForMember(p => p.RuleId, opt => opt.ResolveUsing(x => x.Id == Guid.Empty ? Guid.NewGuid() : x.Id))
            .ForMember(p => p.CompanyId, opt => opt.UseValue(AppConstants.CompanyId));

            Mapper.CreateMap <RuleRequest, UpdateRule>()
            .ForMember(p => p.RuleId, opt => opt.ResolveUsing(x => x.Id == Guid.Empty ? Guid.NewGuid() : x.Id))
            .ForMember(p => p.CompanyId, opt => opt.UseValue(AppConstants.CompanyId));

            Mapper.CreateMap <RuleActivateRequest, ActivateRule>()
            .ForMember(p => p.CompanyId, opt => opt.UseValue(AppConstants.CompanyId));

            Mapper.CreateMap <RuleDeactivateRequest, DeactivateRule>()
            .ForMember(p => p.CompanyId, opt => opt.UseValue(AppConstants.CompanyId));

            Mapper.CreateMap <CreditCardRequest, AddOrUpdateCreditCard>()
            .ForMember(x => x.CreditCardId,
                       opt => opt.ResolveUsing(x => x.CreditCardId == Guid.Empty ? Guid.NewGuid() : x.CreditCardId));

            Mapper.CreateMap <PopularAddress, AddPopularAddress>();
            Mapper.CreateMap <PopularAddress, UpdatePopularAddress>();

            Mapper.CreateMap <HailRequest, CreateOrderRequest>();
            Mapper.CreateMap <OrderKey, IbsOrderKey>();
            Mapper.CreateMap <IbsOrderKey, OrderKey>();
            Mapper.CreateMap <VehicleCandidate, IbsVehicleCandidate>();
            Mapper.CreateMap <IbsHailResponse, OrderHailResult>();
            Mapper.CreateMap <IbsVehicleCandidate, VehicleCandidate>();
        }
Exemplo n.º 19
0
        protected override void ApplicationStarted(UmbracoApplicationBase app, ApplicationContext ctx)
        {
            // Configure mapping
            Mapper.AddProfile <ViewModelMappingProfile>();


            //// Configure endpoint
            HeadRest.ConfigureEndpoint(new HeadRestOptions
            {
                CustomRouteMappings = new HeadRestRouteMap()
                                      .For("^/(?<altRoute>init|routes)/?$").MapTo("/")
                                      .For("^/(blog)/(?<page>[0-9]+)/?$").MapTo("/$1/"),
                ViewModelMappings = new HeadRestViewModelMap()
                                    .For(Home.ModelTypeAlias)
                                    .If(x => x.Request.HeadRestRouteParam("altRoute") == "init")
                                    .MapTo <InitViewModel>()
                                    .For(Home.ModelTypeAlias).MapTo <HomePageViewModel>()
                                    .For(ContentPage.ModelTypeAlias).MapTo <ContentPageViewModel>()
                                    .For(Blog.ModelTypeAlias).MapTo <BlogPageViewModel>()
                                    .For(Blogpost.ModelTypeAlias).MapTo <BlogPostPageViewModel>()
                                    .For(Products.ModelTypeAlias).MapTo <ProductsViewModel>()
                                    .For(Product.ModelTypeAlias).MapTo <ProductPageViewModel>()
            });
            // Configure default values
            ContentService.Created += (sender, args) =>
            {
                if (args.Entity.ContentType.Alias == Blogpost.ModelTypeAlias)
                {
                    args.Entity.SetValue("publishDate", DateTime.Now);
                }
            };

            // Configure lucene
            var indexer = (UmbracoContentIndexer)ExamineManager.Instance.IndexProviderCollection["ExternalIndexer"];

            indexer.DocumentWriting += (sender, args) =>
            {
                if (args.Fields["nodeTypeAlias"].InvariantEquals(Blogpost.ModelTypeAlias))
                {
                    var publishDate = args.Fields.ContainsKey("publishDate")
                        ? DateTime.Parse(args.Fields["publishDate"])
                        : DateTime.Parse(args.Fields["createDate"]);

                    var sortableField = new Field("__Sort_publishDate",
                                                  publishDate.ToString("yyyyMMddHHmmss", CultureInfo.InvariantCulture),
                                                  Field.Store.YES,
                                                  Field.Index.NOT_ANALYZED);

                    args.Document.Add(sortableField);
                }
            };

            indexer.GatheringNodeData += (sender, args) =>
            {
                var publishDate = args.Fields.ContainsKey("publishDate")
                    ? DateTime.Parse(args.Fields["publishDate"])
                    : DateTime.Parse(args.Fields["createDate"]);

                args.Fields["searchPublishDate"] = DateTools.DateToString(publishDate, DateTools.Resolution.SECOND);

                args.Fields.Add("searchPath", string.Join(" ", args.Fields["path"].Split(',')));
            };
        }
Exemplo n.º 20
0
 public static void Configure()
 {
     Mapper.AddProfile(new UserInformationMapperProfile());
 }
Exemplo n.º 21
0
 public static void Configure()
 {
     Mapper.AddProfile(new AdminProfile());
 }
 public static void Initialize()
 {
     Mapper.AddProfile(new DomainToDatabase());
     Mapper.AddProfile(new DatabaseToDomain());
 }
Exemplo n.º 23
0
 public static void Configure()
 {
     Mapper.AddProfile(new ItemMapperProfile());
     Mapper.AddProfile(new UserMapperProfile());
 }
Exemplo n.º 24
0
 public static void RegisterProfiles()
 {
     Mapper.AddProfile <ArticleAutoMapperProfile>();
 }
Exemplo n.º 25
0
 public static void Configure()
 {
     Mapper.AddProfile <TaskToTaskViewModelProfile>();
     Mapper.AddProfile <TaskViewModelToTaskProfile>();
     Mapper.AddProfile <NewTaskViewModelToTaskProfile>();
 }
Exemplo n.º 26
0
 protected override void Establish_context()
 {
     _customProfile = new CustomProfile1();
     Mapper.AddProfile(_customProfile);
     Mapper.AddProfile <CustomProfile2>();
 }
Exemplo n.º 27
0
        public TaskControllerTests()
        {
            Mapper.AddProfile(new UserProfile());
            Mapper.AddProfile(new CustomerProfile());
            Mapper.AddProfile(new ProjectProfile());
            Mapper.AddProfile(new TaskProfile());

            invalidProject = new BasicProject()
            {
                CustomerId = 1, EstimatedHours = 5.0M, Id = 11, ProjectManager = new User()
                {
                    UserName = "******"
                }
            };
            var users = new List <User>()
            {
                new User()
                {
                    Id       = 1, UserName = "******",
                    Projects = new List <Project>()
                    {
                        new BasicProject()
                        {
                            Id = 1
                        }
                    }
                }
            }.AsQueryable();

            invalidTaskViewModel = new BasicTaskViewModel()
            {
                EstimatedHours = 3.00M, Id = 1, Project = new TaskViewModel.ProjectDetails()
                {
                    Id = 11
                }, Title = "TaskTitle"
            };
            validTask = new BasicTask()
            {
                Id               = validTaskId,
                EstimatedHours   = 3.00M,
                ProjectId        = 1,
                Title            = "Task Title",
                Users            = users.ToList(),
                CompletedDetails = null,
                Project          = new BasicProject()
                {
                    Id             = 1,
                    ProjectManager = new User()
                    {
                        IsActive = true,
                        Id       = 1,
                        UserName = "******"
                    }
                }
            };
            validTaskViewModel = (BasicTaskViewModel)Mapper.Map(validTask, validTask.GetType(), typeof(TaskViewModel));
            var tasks = new List <Task>()
            {
                validTask
            }.AsQueryable();

            taskRepository = new Mock <IRepository <Task> >();
            taskRepository.Setup(t => t.All).Returns(tasks);
            taskRepository.Setup(t => t.Find(invalidTaskId)).Returns((Task)null);
            taskRepository.Setup(t => t.Find(validTaskId)).Returns(validTask);
            projectService    = new Mock <IProjectService>();
            taskService       = new Mock <ITaskService>();
            userRepository    = new Mock <IRepository <User> >();
            projectRepository = new Mock <IRepository <Project> >();

            userRepository.Setup(u => u.All).Returns(users);
            controller = new TaskController(taskRepository.Object, taskService.Object, userRepository.Object, projectRepository.Object, projectService.Object);

            SetupControllerContext(controller);
        }
Exemplo n.º 28
0
 protected override void Establish_context()
 {
     Mapper.AddProfile <AProfile>();
 }
Exemplo n.º 29
0
 static MapLinkRouteCalculator()
 {
     Mapper.AddProfile(new RouteStopMapper());
     Mapper.AddProfile(new RouteMapper());
 }
Exemplo n.º 30
0
 public static void Configurar()
 {
     //Criação de um Perfil de Mapeamento para Domínio e View
     Mapper.AddProfile <DominioParaViewModelProfile>();
     Mapper.AddProfile <ViewModelParaDominioProfile>();
 }