コード例 #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(opt =>
            {
                opt.AddPolicy(name: _policyName, builder =>
                {
                    builder.AllowAnyOrigin()
                    .AllowAnyHeader()
                    .AllowAnyMethod();
                });
            });

            services.AddControllers();
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "AnnualLeaveRequestAPI", Version = "v1"
                });
            });

            var sqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("AnnualLeaveRequestDB"));

            services.AddSingleton(sqlConnectionConfiguration);

            services.AddSingleton <AnnualLeaveRequestDataAccess>();

            services.AddSingleton <IAnnualLeaveRequestLogic, AnnualLeaveRequestLogic>();
        }
コード例 #2
0
        public DataContext(IOptions <SqlConnectionConfiguration> options, IAzureServiceTokenProviderWrapper azureServiceTokenProviderWrapper)
        {
            _ = options ?? throw new ArgumentNullException(nameof(options));

            sqlConnectionConfiguration            = options.Value;
            this.azureServiceTokenProviderWrapper = azureServiceTokenProviderWrapper;
        }
コード例 #3
0
ファイル: Startup.cs プロジェクト: danny14/SistemaDeNotas
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddSingleton <WeatherForecastService>();

            //Se registra la Entidad y Servicios
            services.AddScoped <IEstudianteService, EstudianteService>();
            services.AddScoped <IMateriaService, MateriaService>();
            services.AddScoped <IMatriculaService, MatriculaService>();
            services.AddScoped <IProfesoresService, ProfesoresService>();
            services.AddScoped <IGradoService, GradoService>();
            services.AddScoped <IListadoEstudianteProfesorService, ListadoEstudianteProfesorService>();
            services.AddScoped <IPeriodoService, PeriodoService>();
            services.AddScoped <IHorarioService, HorarioService>();
            services.AddScoped <IHorarioPDF, HorarioPDF>();
            services.AddScoped <INotasPDF, NotasPDF>();
            services.AddScoped <IAsistenciaService, AsistenciaService>();
            services.AddScoped <IAsistenciaPDF, AsistenciaPDF>();



            //Conexion a la BD
            //var SqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("SqlDBContext"));
            var SqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("SqlDBContext"));

            services.AddSingleton(SqlConnectionConfiguration);
        }
コード例 #4
0
        public void Setup()
        {
            PacketFactory.Initialize <NoS0575Packet>();
            var builder = new ConfigurationBuilder();
            var databaseConfiguration = new SqlConnectionConfiguration();

            builder.SetBasePath(Directory.GetCurrentDirectory() + ConfigurationPath);
            builder.AddJsonFile("database.json", false);
            builder.Build().Bind(databaseConfiguration);
            databaseConfiguration.Database = "postgresunittest";
            var sqlconnect = databaseConfiguration;

            DataAccessHelper.Instance.EnsureDeleted(sqlconnect);
            var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());

            XmlConfigurator.Configure(logRepository, new FileInfo(ConfigurationPath + "/log4net.config"));
            Logger.InitializeLogger(LogManager.GetLogger(typeof(LoginPacketController)));
            DataAccessHelper.Instance.Initialize(sqlconnect);
            DAOFactory.RegisterMapping(typeof(GameObject.Character).Assembly);
            var map = new MapDTO {
                MapId = 1
            };

            DAOFactory.MapDAO.InsertOrUpdate(ref map);
            _acc = new AccountDTO {
                Name = Name, Password = EncryptionHelper.Sha512("test")
            };
            DAOFactory.AccountDAO.InsertOrUpdate(ref _acc);
            _session.InitializeAccount(_acc);
            _handler = new LoginPacketController(new LoginConfiguration());
            _handler.RegisterSession(_session);
            WebApiAccess.RegisterBaseAdress();
            WebApiAccess.Instance.MockValues = new Dictionary <string, object>();
        }
コード例 #5
0
ファイル: DataAccessHelper.cs プロジェクト: crazyants/NosCore
 public void EnsureDeleted(SqlConnectionConfiguration Database)
 {
     _conn = Database;
     using (NosCoreContext context = CreateContext())
     {
         context.Database.EnsureDeleted();
     }
 }
コード例 #6
0
        public NosCoreContext CreateDbContext(string[] args)
        {
            var databaseConfiguration = new SqlConnectionConfiguration();

            ConfiguratorBuilder.InitializeConfiguration(args, new[] { "database.yml" }, databaseConfiguration);
            var optionsBuilder = new DbContextOptionsBuilder <NosCoreContext>();

            optionsBuilder.UseNpgsql(databaseConfiguration.ConnectionString);
            return(new NosCoreContext(optionsBuilder.Options));
        }
コード例 #7
0
        public NosCoreContext CreateDbContext(string[] args)
        {
            var _databaseConfiguration = new SqlConnectionConfiguration();
            var builder = new ConfigurationBuilder();

            builder.SetBasePath(Directory.GetCurrentDirectory() + _configurationPath);
            builder.AddJsonFile("database.json", false);
            builder.Build().Bind(_databaseConfiguration);
            return(new NosCoreContext(_databaseConfiguration));
        }
コード例 #8
0
ファイル: Startup.cs プロジェクト: revotek/BlazorDapperDemo
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddScoped <IVideoService, VideoService>();
            var SqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("SqlDBContext"));

            services.AddSingleton(SqlConnectionConfiguration);

            services.AddServerSideBlazor(o => o.DetailedErrors = true);
        }
コード例 #9
0
ファイル: Startup.cs プロジェクト: Suchitech02/BlazorAppSPA
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddSingleton <WeatherForecastService>();
            services.AddTransient <IEmployeeService, EmployeeService>();
            services.AddTransient <ICityService, CityService>();
            var SqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("DefaultConnection"));

            services.AddSingleton(SqlConnectionConfiguration);
        }
コード例 #10
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddSingleton <WeatherForecastService>();
            services.AddSingleton <MenuService>();

            var sqlConnectionConfig = new SqlConnectionConfiguration(Configuration.GetConnectionString("DefaultConnection"));

            services.AddSingleton(sqlConnectionConfig);
        }
コード例 #11
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();

            var sqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("AnnualLeaveRequestDB"));

            services.AddSingleton(sqlConnectionConfiguration);

            services.AddSingleton <AnnualLeaveRequestDataAccess>();

            services.AddSingleton <IAnnualLeaveRequestLogic, AnnualLeaveRequestLogic>();
        }
コード例 #12
0
ファイル: Startup.cs プロジェクト: gokel166/IgLeadershipCore
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();

            var sqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("IgniteConnection"));

            services.AddSingleton(sqlConnectionConfiguration);

            services.AddScoped <IMGTSEmployeeService, MGTSEmployeeService>();
            services.AddScoped <IIgniteUserApplicationService, IgniteUserApplicationService>();
            services.AddScoped <IQuestionsToAnswerService, QuestionsToAnswerService>();
            services.AddScoped <IReportService, ReportService>();
        }
コード例 #13
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddSingleton <WeatherForecastService>();

            var sqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("SqlDbContext"));

            services.AddSingleton(sqlConnectionConfiguration);


            services.AddServerSideBlazor(o => o.DetailedErrors = true);
        }
コード例 #14
0
        public NosCoreContext CreateDbContext(string[] args)
        {
            var databaseConfiguration = new SqlConnectionConfiguration();
            var builder = new ConfigurationBuilder();

            builder.SetBasePath(Directory.GetCurrentDirectory() + ConfigurationPath);
            builder.AddJsonFile("database.json", false);
            builder.Build().Bind(databaseConfiguration);
            var optionsBuilder = new DbContextOptionsBuilder <NosCoreContext>();

            optionsBuilder.UseNpgsql(databaseConfiguration.ConnectionString);
            return(new NosCoreContext(optionsBuilder.Options));
        }
コード例 #15
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddScoped <IDBService, DBService>();

            // SQL connection
            var SqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("SqlDBcontex"));

            services.AddSingleton(SqlConnectionConfiguration);

            // Debugging
            services.AddServerSideBlazor(o => o.DetailedErrors = true);
        }
コード例 #16
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors();
            services.AddControllersWithViews();
            services.AddRazorPages();
            services.AddScoped <ILogfileService, LogfileService>();
            var sqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("SqlDbContext"));

            services.AddSingleton(sqlConnectionConfiguration);
            //services.AddHttpClient<ILogfileService, LogfileService>();
            services.AddScoped <HttpClient>();
            //services.AddLocalization(options => options.ResourcesPath = "Resources");
            services.AddSingleton(typeof(ITelerikStringLocalizer), typeof(ShareResxLocalizer));
        }
コード例 #17
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddScoped <IVideoService, VideoService>();

            //SQL banco de dados connection
            var SqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("SQLDbContext"));

            services.AddSingleton(SqlConnectionConfiguration);

            //Opcional para debugger
            services.AddServerSideBlazor(o => o.DetailedErrors = true);
        }
コード例 #18
0
ファイル: Startup.cs プロジェクト: KenMauch3/BlazorDapperCrud
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddScoped <IVideoService, VideoService>();

            // SQL database connection (name defined in appsettings.json).
            var SqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("SqlDBContext"));

            services.AddSingleton(SqlConnectionConfiguration);

            // Optional for debugging
            services.AddServerSideBlazor(o => o.DetailedErrors = true);
        }
コード例 #19
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor(o => o.DetailedErrors = true);

            // Data services
            services.AddScoped <IEmployeeService, EmployeeService>();
            services.AddScoped <ICityService, CityService>();

            // SQL service
            var sqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("SqlDbContext"));

            services.AddSingleton(sqlConnectionConfiguration);
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddScoped <IVideoService, VideoService>();

            //sql database connection
            var sqlConnectionConfiguration =
                new SqlConnectionConfiguration(Configuration.GetConnectionString("SqlDbContext"));

            services.AddSingleton(sqlConnectionConfiguration);

            //optional for debugging
            services.AddServerSideBlazor(o => o.DetailedErrors = true);
        }
コード例 #21
0
ファイル: Startup.cs プロジェクト: magalhaesulisses/BlazorCRM
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();

            //SQL database connn (name deffined in appsetting.json)
            var SqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("CRM"));

            services.AddSingleton(SqlConnectionConfiguration);

            //Interface init
            services.AddScoped <IARService, ARService>();

            //Opitinal for debbuging
            services.AddServerSideBlazor(o => o.DetailedErrors = true);
        }
コード例 #22
0
ファイル: Startup.cs プロジェクト: JadeKneen/QuizManagerApp
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <ApplicationDbContext>(options =>
                                                         options.UseSqlServer(
                                                             Configuration.GetConnectionString("DefaultConnection")));
            var sqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("DefaultConnection"));

            services.AddSingleton(sqlConnectionConfiguration);
            services.AddDefaultIdentity <IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
            .AddEntityFrameworkStores <ApplicationDbContext>();
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddAntDesign();
            services.AddScoped <AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider <IdentityUser> >();
            services.AddScoped <IPersonService, PersonService>();
            services.AddScoped <IQuizService, QuizService>();
        }
コード例 #23
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();

            services.AddScoped <IStadtService, StadtService>();
            services.AddScoped <IMitarbeiterService, MitarbeiterService>();
            services.AddScoped <IKategorieService, KategorieService>();
            services.AddScoped <ITasksService, TasksService>();
            services.AddScoped <IProjektService, ProjetkService>();
            services.AddScoped <IRoleService, RoleService>();
            services.AddScoped <LoginState>();

            var sqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("SqlDbContext"));

            services.AddSingleton(sqlConnectionConfiguration);
        }
コード例 #24
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();

            services.AddScoped <ILeadAutomatorRepoService, LeadAutomatorRepoService>();
            services.AddServerSideBlazor().AddCircuitOptions(options => { options.DetailedErrors = true; });

            // SQL database connection (name defined in appsettings.json).
            var SqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("SqlDBcontext"));

            services.AddSingleton(SqlConnectionConfiguration);

            services.AddScoped <LeadAutomatorService>();

            services.AddScoped <Services.AppData>();
        }
コード例 #25
0
ファイル: Startup.cs プロジェクト: kalitulenov/DauaPharm
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            //    services.AddServerSideBlazor();
            services.AddSyncfusionBlazor();  // добавил

            services.AddScoped <IPharmService, PharmService>();
            // SQL database connection (name defined in appsettings.json).
            var SqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("SqlDBcontext"));

            services.AddSingleton(SqlConnectionConfiguration);

            // Optional for debugging
            services.AddServerSideBlazor(o => o.DetailedErrors = true);

            services.AddSingleton <WeatherForecastService>();
            services.AddSingleton <AppState>();
        }
コード例 #26
0
ファイル: DataAccessHelper.cs プロジェクト: crazyants/NosCore
 public void Initialize(SqlConnectionConfiguration Database)
 {
     _conn = Database;
     using (NosCoreContext context = CreateContext())
     {
         try
         {
             context.Database.Migrate();
             context.Database.GetDbConnection().Open();
             Logger.Log.Info(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.DATABASE_INITIALIZED));
         }
         catch (Exception ex)
         {
             Logger.Log.Error("Database Error", ex);
             Logger.Log.Error(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.DATABASE_NOT_UPTODATE));
             throw;
         }
     }
 }
コード例 #27
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();

            services.AddServerSideBlazor()
            .AddCircuitOptions(options =>
            {
                //can toggle detailed errors on or off from app settings
                options.DetailedErrors = Convert.ToBoolean(Configuration["DetailedErrors"]);
            });

            var sqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("AnnualLeaveRequestDB"));

            services.AddSingleton(sqlConnectionConfiguration);

            services.AddSingleton <AnnualLeaveRequestDataAccess>();

            services.AddSingleton <IAnnualLeaveRequestLogic, AnnualLeaveRequestLogic>();
        }
コード例 #28
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("SqlDbContext")));
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddTransient <IEmployee, EmployeeDataAccessLayer>();
            services.AddTransient <IAddressService, AddressService>();

            services.AddSingleton <MenuService>();
            //services.AddScoped<Employee>();
            services.AddSingleton <HttpClient>();

            //Sql database connection (name defined in appsettings.json)
            var SqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("SqlDbContext"));

            services.AddSingleton(SqlConnectionConfiguration);

            //Optional for debugging
            services.AddServerSideBlazor(o => o.DetailedErrors = true);
        }
コード例 #29
0
        public void Setup()
        {
            PacketFactory.Initialize <NoS0575Packet>();
            var builder = new ConfigurationBuilder();
            var databaseConfiguration = new SqlConnectionConfiguration();

            builder.SetBasePath(Directory.GetCurrentDirectory() + ConfigurationPath);
            builder.AddJsonFile("database.json", false);
            builder.Build().Bind(databaseConfiguration);
            databaseConfiguration.Database = "postgresunittest";
            var sqlconnect = databaseConfiguration;

            DataAccessHelper.Instance.EnsureDeleted(sqlconnect);
            var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());

            XmlConfigurator.Configure(logRepository, new FileInfo(ConfigurationPath + "/log4net.config"));
            Logger.InitializeLogger(LogManager.GetLogger(typeof(CharacterScreenControllerTests)));
            DataAccessHelper.Instance.Initialize(sqlconnect);
            DAOFactory.RegisterMapping(typeof(Character).Assembly);
            var map = new MapDTO {
                MapId = 1
            };

            DAOFactory.MapDAO.InsertOrUpdate(ref map);
            _acc = new AccountDTO {
                Name = "AccountTest", Password = EncryptionHelper.Sha512("test")
            };
            DAOFactory.AccountDAO.InsertOrUpdate(ref _acc);
            _chara = new CharacterDTO
            {
                Name      = "TestExistingCharacter",
                Slot      = 1,
                AccountId = _acc.AccountId,
                MapId     = 1,
                State     = CharacterState.Active
            };
            DAOFactory.CharacterDAO.InsertOrUpdate(ref _chara);
            _session.InitializeAccount(_acc);
            _handler = new CharacterScreenPacketController();
            _handler.RegisterSession(_session);
        }
コード例 #30
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddSingleton <WeatherForecastService>();
            services.AddScoped <IClienteService, ClienteService>();
            services.AddScoped <ITiendaService, TiendaService>();
            services.AddScoped <IFileUpload, FileUpload>();
            services.AddScoped <IProductoService, ProductoService>();
            services.AddScoped <IEstadoProductoService, EstadoProductoService>();
            services.AddScoped <IFacturaService, FacturaService>();
            services.AddScoped <IFacturaProductoService, FacturaProductoService>();
            services.AddScoped <IFacturaPDF, FacturaPDF>();
            services.AddBlazoredSessionStorage();

            //Conecction DB
            var SqlConnectionConfiguration = new SqlConnectionConfiguration(Configuration.GetConnectionString("SqlDBContext"));

            //Patrón Singleton
            services.AddSingleton(SqlConnectionConfiguration);
        }
コード例 #31
0
ファイル: SqlConnection.cs プロジェクト: rcdosado/SMO
        private void SqlConnectionControl_Load(object sender, EventArgs e)
        {

            sqlConfig = new SqlConnectionConfiguration();
            ObjectGrid.SelectedObject = sqlConfig;
        }