static private ArgumentNull ( string parameter ) : |
||
parameter | string | |
return |
internal void AddPermissionEntry(DBConnectionString entry) { if (null == entry) { throw ADP.ArgumentNull("entry"); } if (!entry.ContainsPersistablePassword() || (entry.GetType() != typeof(DBConnectionString))) { entry = new DBConnectionString(entry, true); } AddEntry(entry); _isUnrestricted = false; // MDAC 84639 }
/*internal string this[int ordinal] { * get { * return _fieldNames[ordinal]; * } * }*/ internal int GetOrdinal(string fieldName) { if (null == fieldName) { throw ADP.ArgumentNull("fieldName"); } int index = IndexOf(fieldName); if (-1 == index) { throw ADP.IndexOutOfRange(fieldName); } return(index); }
public override int GetValues(object[] values) { if (values == null) { throw ADP.ArgumentNull("values"); } int num2 = (values.Length < this._schemaInfo.Length) ? values.Length : this._schemaInfo.Length; for (int i = 0; i < num2; i++) { values[i] = this._values[i]; } return(num2); }
public override int GetValues(object[] values) { if (null == values) { throw ADP.ArgumentNull(nameof(values)); } int copyLen = (values.Length < _schemaInfo.Length) ? values.Length : _schemaInfo.Length; for (int i = 0; i < copyLen; i++) { values[i] = _values[i]; } return(copyLen); }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (null == destinationType) { throw ADP.ArgumentNull("destinationType"); } if ((typeof(InstanceDescriptor) == destinationType) && (value is DataColumnMapping)) { DataColumnMapping mapping = (DataColumnMapping)value; object[] arguments = new object[] { mapping.SourceColumn, mapping.DataSetColumn }; Type[] types = new Type[] { typeof(string), typeof(string) }; return(new InstanceDescriptor(typeof(DataColumnMapping).GetConstructor(types), arguments)); } return(base.ConvertTo(context, culture, value, destinationType)); }
/// <include file='doc\DBDataPermission.uex' path='docs/doc[@for="DBDataPermission.DBDataPermission4"]/*' /> protected DBDataPermission(DBDataPermissionAttribute permissionAttribute) // for CreatePermission { if (null == permissionAttribute) { throw ADP.ArgumentNull("permissionAttribute"); } _isUnrestricted = permissionAttribute.Unrestricted; if (!_isUnrestricted) { _allowBlankPassword = permissionAttribute.AllowBlankPassword; if (permissionAttribute.ShouldSerializeConnectionString() || permissionAttribute.ShouldSerializeKeyRestrictions()) // MDAC 86773 { Add(permissionAttribute.ConnectionString, permissionAttribute.KeyRestrictions, permissionAttribute.KeyRestrictionBehavior); } } }
public void CopyToRows(DataRow[] array, int arrayIndex) { DataRow[] rowArray = this._dataRows; if (rowArray != null) { rowArray.CopyTo(array, arrayIndex); } else { if (array == null) { throw ADP.ArgumentNull("array"); } array[arrayIndex] = this.Row; } }
public void CopyToRows(DataRow[] array, int arrayIndex) { DataRow[] dataRows = _dataRows; if (null != dataRows) { dataRows.CopyTo(array, arrayIndex); } else { if (null == array) { throw ADP.ArgumentNull("array"); } array[arrayIndex] = Row; } }
/// <include file='doc\DataTableMappingCollection.uex' path='docs/doc[@for="DataTableMappingCollection.AddRange"]/*' /> public void AddRange(DataTableMapping[] values) { if (null == values) { throw ADP.ArgumentNull("values"); } int length = values.Length; for (int i = 0; i < length; ++i) { ValidateType(values[i]); } for (int i = 0; i < length; ++i) { AddWithoutEvents(values[i]); } }
protected DBDataPermission(DBDataPermissionAttribute permissionAttribute) { this._keyvaluetree = NameValuePermission.Default; if (permissionAttribute == null) { throw ADP.ArgumentNull("permissionAttribute"); } this._isUnrestricted = permissionAttribute.Unrestricted; if (!this._isUnrestricted) { this._allowBlankPassword = permissionAttribute.AllowBlankPassword; if (permissionAttribute.ShouldSerializeConnectionString() || permissionAttribute.ShouldSerializeKeyRestrictions()) { this.Add(permissionAttribute.ConnectionString, permissionAttribute.KeyRestrictions, permissionAttribute.KeyRestrictionBehavior); } } }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (null == destinationType) { throw ADP.ArgumentNull(nameof(destinationType)); } if ((typeof(InstanceDescriptor) == destinationType) && (value is DataTableMapping)) { DataTableMapping mapping = (DataTableMapping)value; DataColumnMapping[] columnMappings = new DataColumnMapping[mapping.ColumnMappings.Count]; mapping.ColumnMappings.CopyTo(columnMappings, 0); object[] values = new object[] { mapping.SourceTable, mapping.DataSetTable, columnMappings }; Type[] types = new Type[] { typeof(string), typeof(string), typeof(DataColumnMapping[]) }; ConstructorInfo ctor = typeof(DataTableMapping).GetConstructor(types) !; return(new InstanceDescriptor(ctor, values)); } return(base.ConvertTo(context, culture, value, destinationType)); }
public static DataColumn GetDataColumnBySchemaAction(string sourceColumn, string dataSetColumn, DataTable dataTable, Type dataType, MissingSchemaAction schemaAction) { if (dataTable == null) { throw ADP.ArgumentNull("dataTable"); } if (ADP.IsEmpty(dataSetColumn)) { return(null); } DataColumnCollection columns = dataTable.Columns; int index = columns.IndexOf(dataSetColumn); if ((0 <= index) && (index < columns.Count)) { DataColumn column = columns[index]; if (!ADP.IsEmpty(column.Expression)) { throw ADP.ColumnSchemaExpression(sourceColumn, dataSetColumn); } if ((null != dataType) && (dataType.IsArray != column.DataType.IsArray)) { throw ADP.ColumnSchemaMismatch(sourceColumn, dataType, column); } return(column); } switch (schemaAction) { case MissingSchemaAction.Add: case MissingSchemaAction.AddWithKey: return(new DataColumn(dataSetColumn, dataType)); case MissingSchemaAction.Ignore: return(null); case MissingSchemaAction.Error: throw ADP.ColumnSchemaMissing(dataSetColumn, dataTable.TableName, sourceColumn); } throw ADP.InvalidMissingSchemaAction(schemaAction); }
public static DataColumn GetDataColumnBySchemaAction(string sourceColumn, string dataSetColumn, DataTable dataTable, Type dataType, MissingSchemaAction schemaAction) { if (null == dataTable) { throw ADP.ArgumentNull(nameof(dataTable)); } if (string.IsNullOrEmpty(dataSetColumn)) { return(null); } DataColumnCollection columns = dataTable.Columns; Debug.Assert(null != columns, "GetDataColumnBySchemaAction: unexpected null DataColumnCollection"); int index = columns.IndexOf(dataSetColumn); if ((0 <= index) && (index < columns.Count)) { DataColumn dataColumn = columns[index]; Debug.Assert(null != dataColumn, "GetDataColumnBySchemaAction: unexpected null dataColumn"); if (!string.IsNullOrEmpty(dataColumn.Expression)) { throw ADP.ColumnSchemaExpression(sourceColumn, dataSetColumn); } if ((null == dataType) || (dataType.IsArray == dataColumn.DataType.IsArray)) { return(dataColumn); } throw ADP.ColumnSchemaMismatch(sourceColumn, dataType, dataColumn); } return(CreateDataColumnBySchemaAction(sourceColumn, dataSetColumn, dataTable, dataType, schemaAction)); }
/// <include file='doc\DataColumnMappingConverter.uex' path='docs/doc[@for="DataColumnMappingConverter.ConvertTo"]/*' /> /// <internalonly/> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw ADP.ArgumentNull("destinationType"); } if (destinationType == typeof(InstanceDescriptor) && value is DataColumnMapping) { DataColumnMapping d = (DataColumnMapping)value; ConstructorInfo ctor = typeof(DataColumnMapping).GetConstructor(new Type[] { typeof(string), typeof(string) }); if (ctor != null) { return(new InstanceDescriptor(ctor, new object[] { d.SourceColumn, d.DataSetColumn })); } } return(base.ConvertTo(context, culture, value, destinationType)); }
// <IPermission class="...Permission" version="1" AllowBlankPassword=false> // <add ConnectionString="provider=x;data source=y;" KeyRestrictions="address=;server=" KeyRestrictionBehavior=PreventUsage/> // </IPermission> /// <include file='doc\DBDataPermission.uex' path='docs/doc[@for="DBDataPermission.FromXml"]/*' /> override public void FromXml(SecurityElement securityElement) { // code derived from CodeAccessPermission.ValidateElement if (null == securityElement) { throw ADP.ArgumentNull("securityElement"); } string tag = securityElement.Tag; if (!tag.Equals(XmlStr._Permission) && !tag.Equals(XmlStr._IPermission)) { // TODO: do we need to check this? //String className = el.Attribute( XmlStr._class ); //return className == null || !className.Equals( ip.GetType().AssemblyQualifiedName ); throw ADP.NotAPermissionElement(); } String version = securityElement.Attribute(XmlStr._Version); if ((null != version) && !version.Equals(XmlStr._VersionNumber)) { throw ADP.InvalidXMLBadVersion(); } string unrestrictedValue = securityElement.Attribute(XmlStr._Unrestricted); _isUnrestricted = (null != unrestrictedValue) && Boolean.Parse(unrestrictedValue); Clear(); // MDAC 83105 if (!_isUnrestricted) { string allowNull = securityElement.Attribute(XmlStr._AllowBlankPassword); _allowBlankPassword = (null != allowNull) && Boolean.Parse(allowNull); ArrayList children = securityElement.Children; if (null != children) { foreach (SecurityElement keyElement in children) { if (keyElement.Tag.Equals(XmlStr._add)) { string constr = keyElement.Attribute(XmlStr._ConnectionString); string restrt = keyElement.Attribute(XmlStr._KeyRestrictions); string behavr = keyElement.Attribute(XmlStr._KeyRestrictionBehavior); if (null == constr) { constr = ADP.StrEmpty; } if (null == restrt) { restrt = ADP.StrEmpty; } KeyRestrictionBehavior behavior = KeyRestrictionBehavior.AllowOnly; if (null != behavr) { behavior = (KeyRestrictionBehavior)Enum.Parse(typeof(KeyRestrictionBehavior), behavr, true); } Add(constr, restrt, behavior); } } } } else { _allowBlankPassword = false; } }
public DataTable GetDataTableBySchemaAction(DataSet dataSet, MissingSchemaAction schemaAction) { if (null == dataSet) { throw ADP.ArgumentNull(nameof(dataSet)); } string dataSetTable = DataSetTable; if (string.IsNullOrEmpty(dataSetTable)) { #if DEBUG if (AdapterSwitches.DataSchema.TraceWarning) { Debug.WriteLine("explicit filtering of SourceTable \"" + SourceTable + "\""); } #endif return(null); } DataTableCollection tables = dataSet.Tables; int index = tables.IndexOf(dataSetTable); if ((0 <= index) && (index < tables.Count)) { #if DEBUG if (AdapterSwitches.DataSchema.TraceInfo) { Debug.WriteLine("schema match on DataTable \"" + dataSetTable); } #endif return(tables[index]); } switch (schemaAction) { case MissingSchemaAction.Add: case MissingSchemaAction.AddWithKey: #if DEBUG if (AdapterSwitches.DataSchema.TraceInfo) { Debug.WriteLine("schema add of DataTable \"" + dataSetTable + "\""); } #endif return(new DataTable(dataSetTable)); case MissingSchemaAction.Ignore: #if DEBUG if (AdapterSwitches.DataSchema.TraceWarning) { Debug.WriteLine("schema filter of DataTable \"" + dataSetTable + "\""); } #endif return(null); case MissingSchemaAction.Error: #if DEBUG if (AdapterSwitches.DataSchema.TraceError) { Debug.WriteLine("schema error on DataTable \"" + dataSetTable + "\""); } #endif throw ADP.MissingTableSchema(dataSetTable, SourceTable); } throw ADP.InvalidMissingSchemaAction(schemaAction); }