コード例 #1
0
 public EmailSvc(IOptions <SendGridOptions> sendGridOptions, IOptions <SmtpOptions> smtpOptions,
                 ICommonFunction commonFunction, IWebHostEnvironment env)
 {
     _env             = env;
     _commonFunction  = commonFunction;
     _sendGridOptions = sendGridOptions.Value;
     _smtpOptions     = smtpOptions.Value;
 }
コード例 #2
0
ファイル: DBInfo.cs プロジェクト: radtek/buffalobro
        /// <summary>
        /// 初始化数据库适配器
        /// </summary>
        private void InitAdapters()
        {
            IAdapterLoader loader = GetLoader(DbType);

            if (loader == null)
            {
                throw new Exception("不支持数据库类型:" + DbType);
            }

            _curAggregateFunctions = loader.AggregateFunctions;
            _curCommonFunctions    = loader.CommonFunctions;
            _curConvertFunctions   = loader.ConvertFunctions;
            _curDbAdapter          = loader.DbAdapter;
            _curDBStructure        = loader.DBStructure;
            _curMathFunctions      = loader.MathFunctions;
        }
コード例 #3
0
        public static async Task Initializer(ApplicationDbContext context,
                                             DataProtectionContext dpContext,
                                             ICommonFunction icommonFunction, ICountrySvc _countrySvc)
        {
            //check whether database exists
            if (!(context.GetService <IDatabaseCreator>() as RelationalDatabaseCreator).Exists())
            {
                await context.Database.EnsureCreatedAsync();
            }
            if (!(dpContext.GetService <IDatabaseCreator>() as RelationalDatabaseCreator).Exists())
            {
                await dpContext.Database.EnsureCreatedAsync();
            }

            //await  dpContext.Database.MigrateAsync();

            if (context.appUsers.Any())
            {
                return;
            }
            //if (context.appUsers != null) { return; }

            await icommonFunction.CreateAdminUser();

            await icommonFunction.CreateAppUser();

            //Initialize the coutry datatbase table
            var countries = await _countrySvc.GetCountries();

            if (countries.Count > 0)
            {
                await context.countries.AddRangeAsync(countries);

                await context.SaveChangesAsync();
            }
        }
コード例 #4
0
 public static void PrintResult(ICommonFunction myObject)
 {
     Console.WriteLine(myObject.PrintData());
     Console.WriteLine("--------------------");
 }