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 } } } ; }
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); }
/// <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; }
protected DataAccessFilterBase(DataAccessMethod method, params string[] names) { _flags = GetFlag(method); _names = names; if (_names != null && _names.Length > 0) { Array.Sort(_names); } }
public DataAccessFilterContext(IDataAccess dataAccess, DataAccessMethod method, DataAccessEventArgs arguments) : base(dataAccess) { if (arguments == null) { throw new ArgumentNullException(nameof(arguments)); } _method = method; _arguments = arguments; }
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)); }
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; }
protected DataAccessFilterBase(DataAccessMethod method, params Type[] types) { _flags = GetFlag(method); _names = GetNames(types); }
private static int GetFlag(DataAccessMethod method) { return((int)Math.Pow(2, (int)method)); }
/// <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; }
protected DataAccessFilterBase(DataAccessMethod method, params string[] names) { _methods = new DataAccessMethod[] { method }; _names = names; }
internal DataSourceAttribute(string providerInvariantName, string connectionString, string tableName, DataAccessMethod dataAccessMethod) { }
/// <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); }
private DataServiceMethod(string name, DataAccessMethod kind, bool isMultiple) { this.Name = name ?? kind.ToString(); this.Kind = kind; this.IsMultiple = isMultiple; }
private DataServiceMethod(DataAccessMethod kind) { this.Kind = kind; this.Name = kind.ToString(); this.IsMultiple = false; }
/// <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; }