コード例 #1
0
        protected DataAccessContextBase(IDataAccess dataAccess, string name, DataAccessMethod method, object state)
        {
            if (dataAccess == null)
            {
                throw new ArgumentNullException(nameof(dataAccess));
            }

            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            _name       = name;
            _method     = method;
            _dataAccess = dataAccess;

            if (state != null)
            {
                _states = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase)
                {
                    { string.Empty, state }
                }
            }
            ;
        }
コード例 #2
0
        public static bool Validate(this IDataMutateContextBase context, DataAccessMethod method, Metadata.IDataEntityProperty property, out object value)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (!context.Options.ValidatorSuppressed)
            {
                var validator = context.Validator;

                if (validator != null)
                {
                    switch (method)
                    {
                    case DataAccessMethod.Insert:
                        return(validator.OnInsert(context, property, out value));

                    case DataAccessMethod.Update:
                        return(validator.OnUpdate(context, property, out value));
                    }
                }
            }

            value = null;
            return(false);
        }
コード例 #3
0
 /// <summary>
 /// Specify data provider, connection string, data table and data access method to access the data source.
 /// </summary>
 /// <param name="providerInvariantName">Invariant data provider name, such as System.Data.SqlClient</param>
 /// <param name="connectionString">
 /// Data provider specific connection string.
 /// WARNING: The connection string can contain sensitive data (for example, a password).
 /// The connection string is stored in plain text in source code and in the compiled assembly.
 /// Restrict access to the source code and assembly to protect this sensitive information.
 /// </param>
 /// <param name="tableName">The name of the data table.</param>
 /// <param name="dataAccessMethod">Specifies the order to access data.</param>
 public DataSourceAttribute(string providerInvariantName, string connectionString, string tableName, DataAccessMethod dataAccessMethod)
 {
     m_invariantProviderName = providerInvariantName;
     m_connectionString      = connectionString;
     m_tableName             = tableName;
     m_accessMethod          = dataAccessMethod;
 }
コード例 #4
0
        protected DataAccessFilterBase(DataAccessMethod method, params string[] names)
        {
            _flags = GetFlag(method);
            _names = names;

            if (_names != null && _names.Length > 0)
            {
                Array.Sort(_names);
            }
        }
コード例 #5
0
        public DataAccessFilterContext(IDataAccess dataAccess, DataAccessMethod method, DataAccessEventArgs arguments) : base(dataAccess)
        {
            if (arguments == null)
            {
                throw new ArgumentNullException(nameof(arguments));
            }

            _method    = method;
            _arguments = arguments;
        }
コード例 #6
0
        protected DataAccessContextBase(IDataAccess dataAccess, string name, DataAccessMethod method, TOptions options)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            this.Name       = name;
            this.Method     = method;
            this.DataAccess = dataAccess ?? throw new ArgumentNullException(nameof(dataAccess));
            this.Options    = options ?? throw new ArgumentNullException(nameof(options));
        }
コード例 #7
0
        protected DataAccessContextBase(IDataAccess dataAccess, string name, DataAccessMethod method, IDictionary <string, object> states)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            this.Name       = name;
            this.Method     = method;
            this.DataAccess = dataAccess ?? throw new ArgumentNullException(nameof(dataAccess));
            _states         = states;
        }
コード例 #8
0
 protected DataAccessFilterBase(DataAccessMethod method, params Type[] types)
 {
     _flags = GetFlag(method);
     _names = GetNames(types);
 }
コード例 #9
0
 private static int GetFlag(DataAccessMethod method)
 {
     return((int)Math.Pow(2, (int)method));
 }
コード例 #10
0
ファイル: VSTestAttributes.cs プロジェクト: bmourat/testfx
 /// <summary>
 /// Initializes a new instance of the <see cref="DataSourceAttribute"/> class. This instance will be initialized with a data provider, connection string, data table and data access method to access the data source.
 /// </summary>
 /// <param name="providerInvariantName">Invariant data provider name, such as System.Data.SqlClient</param>
 /// <param name="connectionString">
 /// Data provider specific connection string.
 /// WARNING: The connection string can contain sensitive data (for example, a password).
 /// The connection string is stored in plain text in source code and in the compiled assembly.
 /// Restrict access to the source code and assembly to protect this sensitive information.
 /// </param>
 /// <param name="tableName">The name of the data table.</param>
 /// <param name="dataAccessMethod">Specifies the order to access data.</param>
 public DataSourceAttribute(string providerInvariantName, string connectionString, string tableName, DataAccessMethod dataAccessMethod)
 {
     this.ProviderInvariantName = providerInvariantName;
     this.ConnectionString      = connectionString;
     this.TableName             = tableName;
     this.DataAccessMethod      = dataAccessMethod;
 }
コード例 #11
0
 protected DataAccessFilterBase(DataAccessMethod method, params string[] names)
 {
     _methods = new DataAccessMethod[] { method };
     _names   = names;
 }
コード例 #12
0
 internal DataSourceAttribute(string providerInvariantName, string connectionString, string tableName, DataAccessMethod dataAccessMethod)
 {
 }
コード例 #13
0
 /// <summary>
 ///     Initializes a new instance of the DataSourceAttribute class.
 ///     This instance will be initialized with a data provider, connection string, data table and data access method to access the data source.
 /// </summary>
 /// <param name="providerInvariantName">Invariant data provider name, such as System.Data.SqlClient .</param>
 /// <param name="connectionString">
 ///     Data provider specific connection string.
 ///     WARNING: The connection string can contain sensitive data (for example, a password).
 ///     The connection string is stored in plain text in source code and in the compiled assembly.
 ///     Restrict access to the source code and assembly to protect this sensitive information.</param>
 /// <param name="tableName">The name of the data table.</param>
 /// <param name="dataAccessMethod">Specifies the order to access data.</param>
 public DynamicDatasourceAttribute(string providerInvariantName, string connectionString, string tableName, DataAccessMethod dataAccessMethod)
 {
     _dataSource = new DataSourceAttribute(providerInvariantName, connectionString, tableName, dataAccessMethod);
 }
コード例 #14
0
 private DataServiceMethod(string name, DataAccessMethod kind, bool isMultiple)
 {
     this.Name       = name ?? kind.ToString();
     this.Kind       = kind;
     this.IsMultiple = isMultiple;
 }
コード例 #15
0
 private DataServiceMethod(DataAccessMethod kind)
 {
     this.Kind       = kind;
     this.Name       = kind.ToString();
     this.IsMultiple = false;
 }
コード例 #16
0
ファイル: VSTestAttributes.cs プロジェクト: modulexcite/IL2JS
 /// <summary>
 /// Specify data provider, connection string, data table and data access method to access the data source.
 /// </summary>
 /// <param name="providerInvariantName">Invariant data provider name, such as System.Data.SqlClient</param>
 /// <param name="connectionString">
 /// Data provider specific connection string. 
 /// WARNING: The connection string can contain sensitive data (for example, a password).
 /// The connection string is stored in plain text in source code and in the compiled assembly. 
 /// Restrict access to the source code and assembly to protect this sensitive information.
 /// </param>
 /// <param name="tableName">The name of the data table.</param>
 /// <param name="dataAccessMethod">Specifies the order to access data.</param>
 public DataSourceAttribute(string providerInvariantName, string connectionString, string tableName, DataAccessMethod dataAccessMethod)
 {
     m_invariantProviderName = providerInvariantName;
     m_connectionString = connectionString;
     m_tableName = tableName;
     m_accessMethod = dataAccessMethod;
 }