public RegisterForm() { InitializeComponent(); mapper = AutoMapperProvider.GetIMapper(); context = ContextProvider.GetApplicationContext(); registrationValidator = new RegistrationModelValidator(); }
public UserResultsForm(Guid userId) { InitializeComponent(); mapper = AutoMapperProvider.GetIMapper(); context = ContextProvider.GetApplicationContext(); FillUserResultsGrid(userId); }
public TimeResultForm(Guid testResultId) { mapper = AutoMapperProvider.GetIMapper(); context = ContextProvider.GetApplicationContext(); InitializeComponent(); SetFields(testResultId); }
public ResultsForm() { InitializeComponent(); StartPosition = FormStartPosition.CenterScreen; mapper = AutoMapperProvider.GetIMapper(); context = ContextProvider.GetApplicationContext(); FillUserResultsGrid(string.Empty); }
public AllTestForm() { InitializeComponent(); mapper = AutoMapperProvider.GetIMapper(); context = ContextProvider.GetApplicationContext(); SetItemsToTypeComboBox(); SetItemsToTopicComboBox(); }
public NewTestForm() { InitializeComponent(); StartPosition = FormStartPosition.CenterScreen; mapper = AutoMapperProvider.GetIMapper(); context = ContextProvider.GetApplicationContext(); newTestModelValidator = new NewTestModelValidator(); SetItemsToTypeComboBox(); SetItemsToTopicComboBox(); }
public Main() { InitializeComponent(); _mapper = AutoMapperProvider.GetIMapper(); _database = ApplicationProvider.GetUnitOfWork(); _clientService = ApplicationProvider.GetProxy(); Show(); //SetIcons(); Configure(); }
public void Map_Checkpoint_to_dto() { var id = Guid.NewGuid(); var mapper = new AutoMapperProvider(); var dto = mapper.Map <CheckpointDto>(new Checkpoint { Id = id, Count = 5 }); dto.Id.Value.Should().Be(id); dto.Count.Should().Be(5); var cp = mapper.Map <Checkpoint>(dto); cp.Id.Value.Should().Be(id); }
public QwestForm(Guid testId, int stepNumber, int numberOfSteps) { InitializeComponent(); StartPosition = FormStartPosition.CenterScreen; mapper = AutoMapperProvider.GetIMapper(); context = ContextProvider.GetApplicationContext(); this.testId = testId; this.Text = string.Format("Question #{0}/{1}", stepNumber, numberOfSteps); if (stepNumber == numberOfSteps) { ContinueButton.Text = "End"; } quizModelValidator = new QuizModelValidator(); }
public void MapTo_ReturnDto_WithEntity() { // Arrange var config = new MapperConfiguration(cfg => { cfg.CreateMap <Entity, Dto>(); }); var entity = GetEntity(); AutoMapperProvider mapperProvider = new AutoMapperProvider(config); // Act var dto = mapperProvider.MapTo <Dto>(entity); var dto2 = new Dto(); dto2 = mapperProvider.MapTo(entity, dto2); // Assert Assert.True(dto.ValuesEqualTo(entity)); Assert.True(entity.ValuesEqualTo(dto2)); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // services.TryAddScoped<StatisticListener>(); // AppEvents.ApplicationStarting += (sender, serviceProvider) => // { // var listener = serviceProvider.GetService<StatisticListener>(); // AppEvents.Services = serviceProvider; // listener.StartListening(); // }; // AppEvents.ApplicationStopping += (sender, serviceProvider) => // { // var listener = serviceProvider.GetService<StatisticListener>(); // listener.StopListening(); // }; services.TryAddSingleton <IAppSettings>(AppSettings); services.TryAddSingleton <AppEvents>(AppEvents); services.TryAddSingleton <Configuration>((s) => { var configPath = HostingEnvironment.ContentRootFileProvider.GetFileInfo("our.orders.config"); return(configPath.Exists ? JsonConvert.DeserializeObject <Configuration>(File.ReadAllText(configPath.PhysicalPath)) : new Configuration()); }); services.TryAddSingleton <AutoMapperProvider>(); services.TryAddSingleton <IEmailSender, LoggerSender>(); var autoMapperProvider = new AutoMapperProvider(services); services.AddSingleton <Profile, AutoMapperProfile>(); services.AddSingleton <IMapper>((s) => autoMapperProvider.GetMapper(s)); services.AddMemoryCache(); services.AddAntiforgery(options => { options.Cookie.Name = "XSRF-TOKEN"; options.HeaderName = "X-XSRF-TOKEN"; options.FormFieldName = "requestVerificationToken"; }); // Appsettings services custom configuration AppEvents.OnConfigure(services); // ****** Services depending on AppSettings ****** // AppSettings validation var appSettingsValidator = new AppSettingsValidator(); appSettingsValidator.EnsureValid(AppSettings); var roleStore = new RoleStore(); services.AddSingleton <RoleStore>(roleStore); services.AddSingleton <IRoleStore <Role> >(roleStore); services.AddTransient <IOrder, Order>(); services.AddTransient <IProduct, Product>(); services.AddTransient <IClient, Client>(); services.AddTransient <ShippingTemplate>(); services.AddTransient <DocumentTemplate>(); services.AddTransient <Shop>(); services.AddTransient <Movement>(); services.AddTransient <Voucher>(); services.AddTransient <StockUnit>(); services.AddTransient <Warehouse>(); services.AddTransient <Category>(); services.AddTransient <User>(); services.TryAddTransient <OrderService, OrderService>(); services.TryAddTransient <IService <IOrder>, OrderService>(); services.TryAddTransient <ProductService, ProductService>(); services.TryAddTransient <IService <IProduct>, ProductService>(); services.TryAddTransient <IService <IShippingTemplate>, Service <IShippingTemplate> >(); services.TryAddTransient <IService <DocumentTemplate>, Service <DocumentTemplate> >(); services.TryAddTransient <IService <IClient>, Service <IClient> >(); services.TryAddTransient <IService <Shop>, Service <Shop> >(); services.TryAddTransient <IService <Movement>, Service <Movement> >(); services.TryAddTransient <IService <Voucher>, Service <Voucher> >(); services.TryAddTransient <IService <StockUnit>, Service <StockUnit> >(); services.TryAddTransient <IService <Warehouse>, Service <Warehouse> >(); services.TryAddTransient <IService <Category>, Service <Category> >(); var key = Encoding.ASCII.GetBytes(AppSettings.JwtSecret); // ****** End Services depending on AppSettings ****** // configure jwt authentication services .AddAuthentication(x => { x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) // .AddCookie(cfg => cfg.SlidingExpiration = true) .AddJwtBearer(x => { x.RequireHttpsMetadata = false; //x.SaveToken = true; x.TokenValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(key), ValidateIssuer = false, ValidateAudience = false }; x.Events = new JwtBearerEvents { // For debugging... OnAuthenticationFailed = async(context) => { await Task.FromResult(0); }, OnChallenge = async(context) => { await Task.FromResult(0); }, OnMessageReceived = async(context) => { await Task.FromResult(0); }, OnTokenValidated = async(context) => { await Task.FromResult(0); } }; }); // Add framework services. services .AddMvc(options => { // options.Conventions.Insert(0, new RoutePrefixConvention(new RouteAttribute("our-orders"))); options.Filters.Add <OperationCancelledExceptionFilter>(); }) .AddJsonOptions(options => { options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; options.SerializerSettings.ContractResolver = new DefaultContractResolver(); options.SerializerSettings.Formatting = Formatting.Indented; options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter()); JsonConvert.DefaultSettings = () => new JsonSerializerSettings() { ContractResolver = new DefaultContractResolver(), Formatting = Newtonsoft.Json.Formatting.Indented, NullValueHandling = NullValueHandling.Ignore, Converters = new List <JsonConverter> { new StringEnumConverter() } }; }) .ConfigureApplicationPartManager(manager => { manager.FeatureProviders.Add(new InternalControllerFeature()); manager.FeatureProviders.Add(new ExternalControllerFeatureProvider(AppSettings)); }); #if NETCORE2_2 var embeddedProvider = new ManifestEmbeddedFileProvider(Assembly.GetAssembly(this.GetType())); #else var embeddedProvider = new EmbeddedFileProvider(Assembly.GetAssembly(this.GetType()), "our.orders"); #endif services.AddSingleton <IFileProvider>(embeddedProvider); // configure DI for application services // services.AddScoped<IUserService, UserService>(); }
public MemberMapperTests() { _mapper ??= AutoMapperProvider.Get(); }
public VolunteerEmergencyContactController() { _ctx = HttpContext.Current.GetOwinContext().Get <CrmServiceContext>(); _mapper = AutoMapperProvider.GetMapper(); }
public CommonMapperTests() { _mapper ??= AutoMapperProvider.Get(); }
private void DependencyInjectionSystem(IServiceCollection services) { services.AddScoped <IOops, Oops>(); services.AddScoped <IDropDownList, DropDownList>(); services.AddSingleton(cm => AutoMapperProvider.ConfigureAutoMapper()); }
public RegionController() { _ctx = HttpContext.Current.GetOwinContext().Get <CrmServiceContext>(); _mapper = AutoMapperProvider.GetMapper(); }
public VolunteerSelfIdentificationController() { _ctx = HttpContext.Current.GetOwinContext().Get <CrmServiceContext>(); _mapper = AutoMapperProvider.GetMapper(); }
public AccountMapperTests() { _mapper ??= AutoMapperProvider.Get(); }
public PortalUserStore(CrmServiceContext crmServiceContext) { _ctx = crmServiceContext; _mapper = AutoMapperProvider.GetMapper(); }
public LoginWindow() { InitializeComponent(); _mapper = AutoMapperProvider.GetIMapper(); _clientService = ApplicationProvider.GetProxy(); }