Esempio n. 1
0
        public Orchestrator(IInitializer initializer,
                            ILog log, IAdo ado,
                            IAuthenticationWrapper authWrapper, IRetryClient retryClient, ILogAppender logAppender,
                            IO365ActivityApiWrapper o365ActivityApiWrapper)
        {
            _log                    = log;
            _logAppender            = logAppender;
            _authWrapper            = authWrapper;
            _o365ActivityApiWrapper = o365ActivityApiWrapper;
            _ado                    = ado;
            _initializer            = initializer;
            _configuration          = _initializer.Configuration;
            _retryClient            = retryClient;

            AuditLogTimeStampsForPowerPlatform = GetLatestTimeStampForPowerPlatform;

            _O365ServiceAuthenticationContract = new ServiceAuthenticationContract
            {
                ClientId     = _configuration.AppSettings.AuditLogClientId,
                ClientSecret = _configuration.AppSettings.AuditLogClientSecret,
                LoginUrl     = _configuration.AppSettings.LoginUrl,
                ResourceUrl  = _configuration.AppSettings.Office365ResourceId,
                TenantId     = _configuration.AppSettings.TenantId
            };
        }
        /// <summary>
        /// 执行语句
        /// </summary>
        /// <param name="ado">数据库访问对象</param>
        /// <param name="cmdType">命令类型</param>
        /// <param name="cmdText">命令</param>
        /// <param name="models">模型</param>
        /// <returns></returns>
        public async static Task <int> ExecuteNonQueryWithModelsAsync(this IAdo ado, System.Data.CommandType cmdType, string cmdText, params object[] models)
        {
            var parameters = models.GetParametersFromModels();

            var result = await ado.ExecuteNonQueryAsync(cmdType, cmdText, parameters.AllParameters);

            models.SetOutputParametersValueToModels(parameters.OutputParameters);

            return(result);
        }
        /// <summary>
        /// 执行存储过程
        /// </summary>
        /// <param name="ado">数据库访问对象</param>
        /// <param name="name">存储过程名称</param>
        /// <param name="models">模型</param>
        /// <returns></returns>
        public async static Task <int> ExecuteStoredProcedureWithModelsAsync(this IAdo ado, string name, params object[] models)
        {
            var parameters = models.GetParametersFromModels();

            var result = await ado.ExecuteStoredProcedureAsync(name, parameters.AllParameters);

            models.SetOutputParametersValueToModels(parameters.OutputParameters);

            return(result);
        }
 public static IAdo GetAdo(ConnectionConfig currentConnectionConfig)
 {
     if (currentConnectionConfig.DbType == DbType.SqlServer)
     {
         return(new SqlServerProvider());
     }
     else
     {
         IAdo result = CreateInstance <IAdo>(GetClassName(currentConnectionConfig.DbType.ToString(), "Provider"));
         return(result);
     }
 }
Esempio n. 5
0
        public static IAdo GetAdo(ConnectionConfig currentConnectionConfig)
        {
            IAdo result = CreateInstance <IAdo>(GetClassName(currentConnectionConfig.DbType, "Provider"));

            return(result);
        }
Esempio n. 6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ado"></param>
 public SugarAdo(IAdo ado)
 {
     this.ado = ado;
 }
 /// <summary>
 /// 执行语句
 /// </summary>
 /// <param name="ado">数据库访问对象</param>
 /// <param name="cmdType">命令类型</param>
 /// <param name="cmdText">命令</param>
 /// <param name="models">模型</param>
 /// <returns></returns>
 public static int ExecuteNonQueryWithModels(this IAdo ado, System.Data.CommandType cmdType, string cmdText, params object[] models)
 {
     return(ado.ExecuteNonQueryWithModelsAsync(cmdType, cmdText, models).GetAwaiter().GetResult());
 }
 /// <summary>
 /// 执行存储过程
 /// </summary>
 /// <param name="ado">数据库访问对象</param>
 /// <param name="name">存储过程名称</param>
 /// <param name="parameters">参数</param>
 /// <returns></returns>
 public async static Task <int> ExecuteStoredProcedureAsync(this IAdo ado, string name, params DbParameter[] parameters)
 {
     return(await ado.ExecuteNonQueryAsync(System.Data.CommandType.StoredProcedure, name, parameters));
 }
 /// <summary>
 /// 执行存储过程
 /// </summary>
 /// <param name="ado">数据库访问对象</param>
 /// <param name="name">存储过程名称</param>
 /// <param name="parameters">参数</param>
 /// <returns></returns>
 public static int ExecuteStoredProcedure(this IAdo ado, string name, params DbParameter[] parameters)
 {
     return(ado.ExecuteStoredProcedureAsync(name, parameters).GetAwaiter().GetResult());
 }
Esempio n. 10
0
 /// <summary>
 /// 执行存储过程
 /// </summary>
 /// <param name="ado">数据库访问对象</param>
 /// <param name="name">存储过程名称</param>
 /// <param name="models">模型</param>
 /// <returns></returns>
 public static int ExecuteStoredProcedureWithModels(this IAdo ado, string name, params object[] models)
 {
     return(ado.ExecuteStoredProcedureWithModelsAsync(name, models).GetAwaiter().GetResult());
 }
Esempio n. 11
0
 /// <summary>
 /// 执行语句
 /// </summary>
 /// <param name="ado">数据库访问对象</param>
 /// <param name="cmdType">命令类型</param>
 /// <param name="cmdText">命令</param>
 /// <param name="parameters">参数</param>
 /// <returns></returns>
 public async static Task <int> ExecuteNonQueryAsync(this IAdo ado, System.Data.CommandType cmdType, string cmdText, params DbParameter[] parameters)
 {
     return(await ado.ExecuteNonQueryAsync(cmdType, cmdText, parameters));
 }
Esempio n. 12
0
 /// <summary>
 /// 执行语句
 /// </summary>
 /// <param name="ado">数据库访问对象</param>
 /// <param name="name">存储过程名称</param>
 /// <param name="parameters">参数</param>
 /// <returns></returns>
 public static int ExecuteNonQuery(this IAdo ado, string name, params DbParameter[] parameters)
 {
     return(ado.ExecuteNonQueryAsync(name, parameters).GetAwaiter().GetResult());
 }