Inheritance: FluentNHibernate.Automapping.DefaultAutomappingConfiguration
Beispiel #1
0
        public bool UpdateUserDetail(UserDetailsVM userVM)
        {
            l2g_tbl_UserDetails user = MappingConfig.UserDetailsToDataEntity(userVM);

            try
            {
                l2g_tbl_UserDetails userEntity = db.l2g_tbl_UserDetails.Where(x => x.UserId == user.UserId).First();
                userEntity.Firstname = user.Firstname;
                userEntity.Lastname  = user.Lastname;
                userEntity.DOB       = user.DOB;
                userEntity.Contact   = user.Contact;
                userEntity.HouseNo   = user.HouseNo;
                userEntity.Street    = user.Street;
                userEntity.PIN       = user.PIN;
                userEntity.Town      = user.Town;
                db.SaveChanges();
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }
        public void ExportOneObjectToNewExcelTest()
        {
            Test test = new Test();

            test.FirstProp = "test";
            List <Test> testlist = new List <Test>();

            testlist.Add(test);

            string        filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test.xml");
            MappingConfig mapcfg   = MappingConfig.ReadFromXmlFormat(filename);

            ExportInfo ex = new ExportInfo();

            ex.data     = testlist.Cast <Object>().ToList();
            ex.datatype = typeof(Test);
            ex.Config   = mapcfg;

            string fullfilename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test.xls");
            bool   result       = ExcelHelper.ExportObjectToNewExcel(fullfilename, ex);

            Assert.True(result);
        }
Beispiel #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <ApplicationContext>(opts =>
                                                       opts.UseSqlServer(Configuration["ConnectionString:DefaultConnection"],
                                                                         b => b.MigrationsAssembly("IdentityService")));

            services.AddTransient(typeof(IRoleRepository), typeof(RoleRepository));
            services.AddTransient(typeof(IUserRepository), typeof(UserRepository));
            services.AddTransient(typeof(IIdentityRepository), typeof(IdentityRepository));

            services.AddMvc().AddJsonOptions(options =>
            {
                options.SerializerSettings.ContractResolver
                    = new Newtonsoft.Json.Serialization.DefaultContractResolver();
            });

            // Register the Swagger generator, defining 1 or more Swagger documents
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "IdentityService", Version = "v1"
                });
                c.OperationFilter <AddRequiredHeaderParameter>();

                // Set the comments path for the Swagger JSON and UI.
                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                c.IncludeXmlComments(xmlPath);
            });

            services.AddIdentity <ApplicationUser, ApplicationRole>()
            .AddEntityFrameworkStores <ApplicationContext>()
            .AddDefaultTokenProviders();

            MappingConfig.RegisterMaps();
        }
Beispiel #4
0
        private static ushort InGameATanLookup(float yComp, float xComp)
        {
            //  if f14 == 0:
            //     return short(0x8038b000)
            //  else:
            //      return short(0x8038b000+2*int( (f12/f14)*1024.0 + 0.5)) # with +0.5 this is normal rounding, not towards zero

            uint offset;

            if (xComp == 0)
            {
                offset = 0;
            }
            else
            {
                offset = 2 * (uint)((yComp / xComp) * 1024f + 0.5f);
            }

            uint address = MappingConfig.HandleMapping(0x8038B000);

            return(Config.Stream.GetUInt16(address + offset));
            //int index = (int)(offset / 2);
            //return arcSineData[index];
        }
Beispiel #5
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            services.AddDbContext <DataContext>(options =>
                                                options.UseSqlServer(Configuration.GetConnectionString("WFF")));

            services.AddDistributedMemoryCache();
            services.AddSession(options =>
            {
                options.IdleTimeout     = TimeSpan.FromMinutes(10);
                options.Cookie.HttpOnly = true;
            });
            services.AddHttpContextAccessor();
            services.AddMemoryCache();

            services.Configure <Configuration>(Configuration.GetSection("MyConfig"));

            services.AddScoped <ILoginService, LoginService>();
            services.AddScoped <IHeaderViewModel, HeaderViewModel>();
            services.AddScoped <IADUserViewModel, ADUserViewModel>();
            services.AddScoped <IActionViewModel, ActionViewModel>();
            services.AddScoped <IUserUtil, UserUtil>();
            services.AddScoped <IBitacora, Bitacora>();
            services.AddScoped <IUserProfile, UserProfile>();
            services.AddScoped <IDesktopViewModel, DesktopViewModel>();
            services.AddScoped <IFormRequestService, FormRequestService>();
            services.AddScoped <IEmailService, EmailService>();
            services.AddScoped <IHistoryService, HistoryService>();
            services.AddScoped <IAttachmentService, AttachmentService>();
            services.AddScoped <IFormXmlService, FormXmlService>();
            services.AddScoped <IFormRequestViewModel, FormRequestViewModel>();
            services.AddScoped <IFormsBoardViewModel, FormsBoardViewModel>();
            services.AddScoped <IFormRequest, FormRequest>();

            MappingConfig.Configure();
        }
Beispiel #6
0
        private static void ConfigureServices(IServiceCollection services)
        {
            services.AddLogging(builder => builder.AddConsole());

            var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");

            Configuration = new ConfigurationBuilder()
                            .SetBasePath(Directory.GetCurrentDirectory())
                            .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                            .AddJsonFile($"appsettings.{environment}.json", optional: true, reloadOnChange: true)
                            .AddEnvironmentVariables()
                            .Build();

            var ConfigurationProvider = new AppConfigurationProvider(Configuration, Directory.GetCurrentDirectory());

            //Ioc.Configure(services, ConfigurationProvider);

            DbContextConfiguration.UseSqlDataBase <DataBase>(services, ConfigurationProvider);

            MappingConfig.RegisterMappings();

            services.AddTransient <Functions, Functions>();
            services.AddSingleton(Configuration);
        }
 public UserToUserListItem()
 {
     MappingConfig.RegisterMappings();
 }
Beispiel #8
0
 public void AutomapperConfigTest()
 {
     MappingConfig.RegisterMappings();
     Mapper.AssertConfigurationIsValid();
 }
Beispiel #9
0
        public async Task <EmployeeOutputDto> GetById(int id)
        {
            var employee = await _employeesRepository.FindAsync(id);

            return(MappingConfig.Mapper().Map <EmployeeOutputDto>(employee));
        }
 public void TestInitialize()
 {
     MappingConfig.RegisterMappings();
     _mockService = MockRepository.GenerateMock <IBookService>();
     _controller  = new BookController(_mockService);
 }
Beispiel #11
0
        private void SetUpContextMenuStrips()
        {
            ControlUtilities.AddContextMenuStripFunctions(
                labelVersionNumber,
                new List <string>()
            {
                "Open Mapping",
                "Clear Mapping",
                "Inject Hitbox View Code",
                "Free Movement Action",
                "Everything in File",
                "Go to Closest Floor Vertex",
                "Save as Savestate",
                "Show MHS Vars",
                "Download Latest STROOP Release",
                "Documentation",
                "Show All Helpful Hints",
                "Enable TASer Settings",
                "Show Image Form",
                "Show Coin Ring Display Form",
                "Format Subtitles",
            },
                new List <Action>()
            {
                () => MappingConfig.OpenMapping(),
                () => MappingConfig.ClearMapping(),
                () => gfxTab.InjectHitboxViewCode(),
                () => Config.Stream.SetValue(MarioConfig.FreeMovementAction, MarioConfig.StructAddress + MarioConfig.ActionOffset),
                () => fileTab.DoEverything(),
                () => trianglesTab.GoToClosestVertex(),
                () => saveAsSavestate(),
                () =>
                {
                    string varFilePath = @"Config/MhsData.xml";
                    List <WatchVariableControlPrecursor> precursors =
                        XmlConfigParser.OpenWatchVariableControlPrecursors(varFilePath);
                    List <WatchVariableControl> controls = precursors.ConvertAll(
                        precursor => precursor.CreateWatchVariableControl());
                    VariablePopOutForm form = new VariablePopOutForm();
                    form.Initialize(controls);
                    form.ShowForm();
                },
                () => Process.Start("https://github.com/SM64-TAS-ABC/STROOP/releases/download/vDev/STROOP.zip"),
                () => Process.Start("https://ukikipedia.net/wiki/STROOP"),
                () => HelpfulHintUtilities.ShowAllHelpfulHints(),
                () =>
                {
                    tasTab.EnableTASerSettings();
                    tabControlMain.SelectedTab = tabPageTas;
                },
                () =>
                {
                    ImageForm imageForm = new ImageForm();
                    imageForm.Show();
                },
                () =>
                {
                    CoinRingDisplayForm form = new CoinRingDisplayForm();
                    form.Show();
                },
                () => SubtitleUtilities.FormatSubtitlesFromClipboard(),
            });

            ControlUtilities.AddCheckableContextMenuStripFunctions(
                labelVersionNumber,
                new List <string>()
            {
                "Update Cam Hack Angle",
                "Update Floor Tri",
            },
                new List <Func <bool> >()
            {
                () =>
                {
                    TestingConfig.UpdateCamHackAngle = !TestingConfig.UpdateCamHackAngle;
                    return(TestingConfig.UpdateCamHackAngle);
                },
                () =>
                {
                    TestingConfig.UpdateFloorTri = !TestingConfig.UpdateFloorTri;
                    return(TestingConfig.UpdateFloorTri);
                },
            });

            ControlUtilities.AddContextMenuStripFunctions(
                buttonMoveTabLeft,
                new List <string>()
            {
                "Restore Recommended Tab Order"
            },
                new List <Action>()
            {
                () => SavedSettingsConfig.InvokeRecommendedTabOrder()
            });

            ControlUtilities.AddContextMenuStripFunctions(
                buttonMoveTabRight,
                new List <string>()
            {
                "Restore Recommended Tab Order"
            },
                new List <Action>()
            {
                () => SavedSettingsConfig.InvokeRecommendedTabOrder()
            });

            ControlUtilities.AddContextMenuStripFunctions(
                trackBarObjSlotSize,
                new List <string>()
            {
                "Reset to Default Object Slot Size"
            },
                new List <Action>()
            {
                () =>
                {
                    trackBarObjSlotSize.Value = ObjectSlotsManager.DefaultSlotSize;
                    ChangeObjectSlotSize(ObjectSlotsManager.DefaultSlotSize);
                }
            });
        }
Beispiel #12
0
 private static object MapScalar(MappingConfig config, Type type, ColumnValueSet columns)
 {
     return(config.FromDb(type, columns.Single().Value));
 }
 public EntityMappingConfig()
 {
     _mappingConfig = new T();
     _mappingConfig.configureMapper();
 }
Beispiel #14
0
        private void AddItemsToContextMenuStrip()
        {
            ToolStripMenuItem resetVariablesItem = new ToolStripMenuItem("Reset Variables");

            resetVariablesItem.Click += (sender, e) => ResetVariables();

            ToolStripMenuItem clearAllButHighlightedItem = new ToolStripMenuItem("Clear All But Highlighted");

            clearAllButHighlightedItem.Click += (sender, e) => ClearAllButHighlightedVariables();

            ToolStripMenuItem fixVerticalScrollItem = new ToolStripMenuItem("Fix Vertical Scroll");

            fixVerticalScrollItem.Click += (sender, e) => FixVerticalScroll();

            ToolStripMenuItem addCustomVariablesItem = new ToolStripMenuItem("Add Custom Variables");

            addCustomVariablesItem.Click += (sender, e) =>
            {
                VariableCreationForm form = new VariableCreationForm();
                form.Initialize(this);
                form.Show();
            };

            ToolStripMenuItem addMappingVariablesItem = new ToolStripMenuItem("Add Mapping Variables");

            addMappingVariablesItem.Click += (sender, e) => AddVariables(MappingConfig.GetVariables());

            ToolStripMenuItem addDummyVariableItem = new ToolStripMenuItem("Add Dummy Variable...");
            List <string>     types = new List <string>(TypeUtilities.InGameTypeList);

            types.Add("string");
            foreach (string typeString in types)
            {
                ToolStripMenuItem typeItem = new ToolStripMenuItem(typeString);
                addDummyVariableItem.DropDownItems.Add(typeItem);
                typeItem.Click += (sender, e) =>
                {
                    int numEntries = 1;
                    if (KeyboardUtilities.IsCtrlHeld())
                    {
                        string numEntriesString = DialogUtilities.GetStringFromDialog(labelText: "Enter Num Vars:");
                        if (numEntriesString == null)
                        {
                            return;
                        }
                        int parsed = ParsingUtilities.ParseInt(numEntriesString);
                        parsed     = Math.Max(parsed, 0);
                        numEntries = parsed;
                    }

                    List <WatchVariableControl> controls = new List <WatchVariableControl>();
                    for (int i = 0; i < numEntries; i++)
                    {
                        string        specialType   = WatchVariableSpecialUtilities.AddDummyEntry(typeString);
                        WatchVariable watchVariable =
                            new WatchVariable(
                                name: specialType,
                                memoryTypeName: null,
                                specialType: specialType,
                                baseAddressType: BaseAddressTypeEnum.None,
                                offsetUS: null,
                                offsetJP: null,
                                offsetSH: null,
                                offsetEU: null,
                                offsetDefault: null,
                                mask: null,
                                shift: null,
                                handleMapping: true);
                        WatchVariableControlPrecursor precursor =
                            new WatchVariableControlPrecursor(
                                name: specialType,
                                watchVar: watchVariable,
                                subclass: typeString == "string" ? WatchVariableSubclass.String : WatchVariableSubclass.Number,
                                backgroundColor: null,
                                displayType: null,
                                roundingLimit: null,
                                useHex: null,
                                invertBool: null,
                                isYaw: null,
                                coordinate: null,
                                groupList: new List <VariableGroup>()
                        {
                            VariableGroup.Custom
                        });
                        WatchVariableControl control = precursor.CreateWatchVariableControl();
                        controls.Add(control);
                    }
                    AddVariables(controls);
                };
            }

            ToolStripMenuItem openSaveClearItem = new ToolStripMenuItem("Open / Save / Clear ...");

            ControlUtilities.AddDropDownItems(
                openSaveClearItem,
                new List <string>()
            {
                "Open", "Open as Pop Out", "Save in Place", "Save As", "Clear"
            },
                new List <Action>()
            {
                () => OpenVariables(),
                () => OpenVariablesAsPopOut(),
                () => SaveVariablesInPlace(),
                () => SaveVariables(),
                () => ClearVariables(),
            });

            ToolStripMenuItem doToAllVariablesItem = new ToolStripMenuItem("Do to all variables...");

            WatchVariableSelectionUtilities.CreateSelectionToolStripItems(
                () => GetCurrentVariableControls(), this)
            .ForEach(item => doToAllVariablesItem.DropDownItems.Add(item));

            ToolStripMenuItem filterVariablesItem = new ToolStripMenuItem("Filter Variables...");

            _filteringDropDownItems = _allGroups.ConvertAll(varGroup => CreateFilterItem(varGroup));
            UpdateFilterItemCheckedStatuses();
            _filteringDropDownItems.ForEach(item => filterVariablesItem.DropDownItems.Add(item));
            filterVariablesItem.DropDown.MouseEnter += (sender, e) =>
            {
                filterVariablesItem.DropDown.AutoClose = false;
            };
            filterVariablesItem.DropDown.MouseLeave += (sender, e) =>
            {
                filterVariablesItem.DropDown.AutoClose = true;
                filterVariablesItem.DropDown.Close();
            };

            ContextMenuStrip.Items.Add(resetVariablesItem);
            ContextMenuStrip.Items.Add(clearAllButHighlightedItem);
            ContextMenuStrip.Items.Add(fixVerticalScrollItem);
            ContextMenuStrip.Items.Add(addCustomVariablesItem);
            ContextMenuStrip.Items.Add(addMappingVariablesItem);
            ContextMenuStrip.Items.Add(addDummyVariableItem);
            ContextMenuStrip.Items.Add(openSaveClearItem);
            ContextMenuStrip.Items.Add(doToAllVariablesItem);
            ContextMenuStrip.Items.Add(filterVariablesItem);
        }
 public void ConfiguraAutoMapper()
 {
     MappingConfig.RegisterMap();
 }
        public static void AssemblyInit(TestContext context)
        {
            var config = WEB.App_Start.MappingConfig.InitializeMapper();

            MappingConfig.InitializeMapper(config);
        }
Beispiel #17
0
 public ConnectionConfig(string connection, MappingConfig mapping = null, TimeSpan?timeout = null)
 {
     ConnectionString = connection;
     Mappping         = mapping ?? new MappingConfig();
     CommandTimeout   = timeout ?? TimeSpan.FromMinutes(1);
 }
Beispiel #18
0
 public void Setup()
 {
     MappingConfig.RegisterMappings(typeof(ErrorViewModel).Assembly);
 }
Beispiel #19
0
 public DefectToGridItemTests()
 {
     MappingConfig.RegisterMappings();
 }
 public void Configuration(IAppBuilder app)
 {
     ConfigureAuth(app);
     MappingConfig.RegisterMappings();
 }
Beispiel #21
0
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              ILoggerFactory loggerFactory,
                              SeedManager seedManager,
                              MigrationManager migrationManager)
        {
            var stopwatch = Stopwatch.StartNew();

            try
            {
                loggerFactory.AddSerilog();
                Log.Logger().Information("Application is starting...");
                Log.Logger().Information("Configuration:");

                ConfigurationProvider.GetType().GetProperties().ToList().ForEach(prop =>
                {
                    Log.Logger().Information("[{name}] = '{value}'", prop.Name, prop.GetValue(ConfigurationProvider));
                });

                DateTimeContext.Initialize(ConfigurationProvider.TimeZone);

                Log.Logger().Information("Configure EF Mappings...");
                MappingConfig.RegisterMappings();

                if (env.IsDevelopment())
                {
                    app.UseDeveloperExceptionPage();
                    app.UseDatabaseErrorPage();
                }
                else
                {
                    app.UseExceptionHandler("/Home/Error"); //todo IS incorrect page diesnt exist yet!!
                    app.UseHsts();
                    app.UseHttpsRedirection();
                }

                app.UseStaticFiles(new StaticFileOptions {
                    FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot"))
                });
                app.UseSession();
                app.UseAuthentication();

                app.UseMvc(routes =>
                {
                    routes.MapRoute(name: "Area", template: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
                    routes.MapRoute(name: "Area2", template: "{area:exists}/{controller=Home}/{action=Index}/{isReadonly?}");

                    routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
                    routes.MapRoute(name: "default2", template: "{controller=Home}/{action=Index}/{isReadonly?}");
                });

                //migrationManager.EnsureCreated(ConfigurationProvider);
                //migrationManager.ApplyMigrations(ConfigurationProvider);
                seedManager.Seed(ConfigurationProvider);
            }
            catch (Exception e)
            {
                Log.Logger().Error(e, "Application failed to start");

                throw;
            }
            finally
            {
                stopwatch.Stop();
                Log.Logger().Information("Startup time: {Seconds}s", stopwatch.Elapsed.Seconds);
            }
        }
 public void Init()
 {
     MappingConfig.RegisterMaps();
 }
 private static void ConfigureMappings()
 {
     MappingConfig.Configure();
 }
 public async Task Delete(MatchInputDto matchInput)
 {
     var match = MappingConfig.Mapper().Map <Match>(matchInput);
     await _matchesRepository.DeleteAsync(match);
 }
Beispiel #25
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, SagaBus sagaBus,
                              IOptions <OAuth20Configuration> oauthOptions)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseApplicationInsightsRequestTelemetry();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseApplicationInsightsExceptionTelemetry();

            app.UseStaticFiles();

            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationScheme  = AuthenticationSchemes.OAuth20Cookie,
                AutomaticChallenge    = false,
                AutomaticAuthenticate = false
            });

            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationScheme  = AuthenticationSchemes.PortalCookie,
                AutomaticChallenge    = false,
                AutomaticAuthenticate = false
            });

            var oauthConfig = oauthOptions.Value;
            var key         = oauthConfig.TokenSigningKey;
            var signingKey  = new SymmetricSecurityKey(Encoding.Unicode.GetBytes(key));
            var param       = new TokenValidationParameters
            {
                AuthenticationType       = "Bearer",
                ValidateIssuerSigningKey = true,
                IssuerSigningKey         = signingKey,
                ValidateIssuer           = true,
                ValidIssuer   = oauthConfig.TokenIssuer,
                ValidAudience = oauthConfig.TokenAudience
            };

            app.UseJwtBearerAuthentication(new JwtBearerOptions
            {
                TokenValidationParameters = param,
                AutomaticAuthenticate     = false,
                AutomaticChallenge        = false
            });

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            MappingConfig.ConfigureQueryModelMapping();
            sagaBus.RegisterSagas();

            app.UseSwagger();
            app.UseSwaggerUi(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Obsidian API");
            });
        }
        public async Task <IHttpActionResult> Post(PosterInputDTO model)
        {
            var poster = await _posterService.CreateAsync(model).ConfigureAwait(false);

            return(Ok(MappingConfig.Mapper().Map <PosterOutputDTO>(poster)));
        }
Beispiel #27
0
        public async Task <IEnumerable <EmployeeOutputDto> > GetAll()
        {
            var employees = await _employeesRepository.GetAllAsync();

            return(MappingConfig.Mapper().Map <List <EmployeeOutputDto> >(employees));
        }
 /// <summary>
 /// ctor.
 /// </summary>
 /// <param name="apiClient">API client to be used for API calls.</param>
 public CobinhoodClient(IApiClient apiClient) : base(apiClient)
 {
     MappingConfig.Initialize();
 }
Beispiel #29
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     MappingConfig.Init();
 }
Beispiel #30
0
 public static void Init(TestContext context)
 {
     MappingConfig.RegisterMaps();
 }