Пример #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();

            //https://stackoverflow.com/questions/29841503/json-serialization-deserialization-in-asp-net-core
            services.AddMvc().AddNewtonsoftJson();

            /*
             * services.AddDbContext<PortfoliosContext>(options =>
             * {
             *  options.UseSqlServer(Configuration.GetConnectionString("FA_Portfolios"),
             *      assembly => assembly.MigrationsAssembly(typeof(PortfoliosContext).Assembly.FullName));
             * });
             */
            string connString = PortfoliosContext.GetConnectionString();

            services.AddDbContext <PortfoliosContext>(options => options.UseSqlServer(connString));

            #region Financial Analyst services/managers/parsers
            services.AddTransient <ICacheManager, FileCacheManager>();

            services.AddTransient <IDataSource, DataSourceDispatcher>();
            services.AddTransient <IPricesDataSource, YahooDataSource>();
            //services.AddTransient<IPricesDataSource, NasdaqDataSource>();
            services.AddTransient <IStockDataDataSource, ReutersDataSource>();
            services.AddTransient <IOptionChainDataSource, NasdaqDataSource>();
            services.AddTransient <IFinancialDataSource, ReutersDataSource>();
            services.AddTransient <IRiskFreeRatesDataSource, USTreasuryDataSource>();
            services.AddTransient <IAssetTypeDataSource, YahooDataSource>();
            services.AddTransient <IStatisticsDataSource, YahooDataSource>();
            services.AddTransient <IIndexesDataSource, DatahubIODataSource>();


            services.AddTransient <IEdgarService, EdgarService>();
            services.AddTransient <IEdgarDatasetParser, EdgarDatasetParser>();
            services.AddTransient <IEdgarFileParser, EdgarFileParser>();
            services.AddTransient <IMasterIndexesParser, MasterIndexesParser>();
            services.AddTransient <IEdgarWebClient, EdgarWebClient>();

            services.AddTransient <IEdgarRepository, EdgarRepository>();
            services.AddTransient <IEdgarFilesRepository, EdgarRepository>();
            services.AddTransient <IEdgarFilesBulkRepository, EdgarFilesBulkRepository>();
            services.AddTransient <IEdgarDatasetsRepository, EdgarRepository>();
            services.AddTransient <IEdgarDatasetsBulkRepository, EdgarDatasetsBulkRepository>();


            services.AddTransient <IPortfoliosContext, PortfoliosContext>();
            services.AddTransient <IPortfoliosManager, PortfoliosManager>();
            #endregion
        }
Пример #2
0
 public ItemsRepository(PortfoliosContext dbContext)
     : base(dbContext)
 {
     _portfoliosContext = dbContext;
 }
 public PortfoliosContextSeedData(PortfoliosContext dbContext)
 {
     _dbContext = dbContext;
 }