Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / EntityClient / DbParameterHelper.cs / 1305376 / DbParameterHelper.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- namespace System.Data.EntityClient { using System; using System.ComponentModel; using System.Data; using System.Data.Common; using System.Globalization; public sealed partial class EntityParameter : DbParameter { private object _value; private object _parent; private ParameterDirection _direction; private int? _size; private string _sourceColumn; private DataRowVersion _sourceVersion; private bool _sourceColumnNullMapping; private bool? _isNullable; private object _coercedValue; private EntityParameter(EntityParameter source) : this() { ADP.CheckArgumentNull(source, "source"); source.CloneHelper(this); ICloneable cloneable = (_value as ICloneable); if (null != cloneable) { _value = cloneable.Clone(); } } private object CoercedValue { get { return _coercedValue; } set { _coercedValue = value; } } [ RefreshProperties(RefreshProperties.All), System.Data.ResCategoryAttribute(Res.DataCategory_Data), System.Data.ResDescriptionAttribute(Res.DbParameter_Direction), ] override public ParameterDirection Direction { get { ParameterDirection direction = _direction; return ((0 != direction) ? direction : ParameterDirection.Input); } set { if (_direction != value) { switch (value) { case ParameterDirection.Input: case ParameterDirection.Output: case ParameterDirection.InputOutput: case ParameterDirection.ReturnValue: PropertyChanging(); _direction = value; break; default: throw ADP.InvalidParameterDirection(value); } } } } override public bool IsNullable { get { bool result = this._isNullable.HasValue ? this._isNullable.Value : true; return result; } set { _isNullable = value; } } internal int Offset { get { return 0; } } [ System.Data.ResCategoryAttribute(Res.DataCategory_Data), System.Data.ResDescriptionAttribute(Res.DbParameter_Size), ] override public int Size { get { int size = _size.HasValue ? _size.Value : 0; if (0 == size) { size = ValueSize(Value); } return size; } set { if (!_size.HasValue || _size.Value != value) { if (value < -1) { throw ADP.InvalidSizeValue(value); } PropertyChanging(); if (0 == value) { _size = null; } else { _size = value; } } } } private void ResetSize() { if (_size.HasValue) { PropertyChanging(); _size = null; } } private bool ShouldSerializeSize() { return (_size.HasValue && _size.Value != 0); } [ System.Data.ResCategoryAttribute(Res.DataCategory_Update), System.Data.ResDescriptionAttribute(Res.DbParameter_SourceColumn), ] override public string SourceColumn { get { string sourceColumn = _sourceColumn; return ((null != sourceColumn) ? sourceColumn : ADP.StrEmpty); } set { _sourceColumn = value; } } public override bool SourceColumnNullMapping { get { return _sourceColumnNullMapping; } set { _sourceColumnNullMapping = value; } } [ System.Data.ResCategoryAttribute(Res.DataCategory_Update), System.Data.ResDescriptionAttribute(Res.DbParameter_SourceVersion), ] override public DataRowVersion SourceVersion { get { DataRowVersion sourceVersion = _sourceVersion; return ((0 != sourceVersion) ? sourceVersion : DataRowVersion.Current); } set { switch(value) { case DataRowVersion.Original: case DataRowVersion.Current: case DataRowVersion.Proposed: case DataRowVersion.Default: _sourceVersion = value; break; default: throw ADP.InvalidDataRowVersion(value); } } } private void CloneHelperCore(EntityParameter destination) { destination._value = _value; destination._direction = _direction; destination._size = _size; destination._sourceColumn = _sourceColumn; destination._sourceVersion = _sourceVersion; destination._sourceColumnNullMapping = _sourceColumnNullMapping; destination._isNullable = _isNullable; } internal void CopyTo(DbParameter destination) { ADP.CheckArgumentNull(destination, "destination"); CloneHelper((EntityParameter)destination); } internal object CompareExchangeParent(object value, object comparand) { object parent = _parent; if (comparand == parent) { _parent = value; } return parent; } internal void ResetParent() { _parent = null; } override public string ToString() { return ParameterName; } private byte ValuePrecisionCore(object value) { if (value is Decimal) { return ((System.Data.SqlTypes.SqlDecimal)(Decimal) value).Precision; } return 0; } private byte ValueScaleCore(object value) { if (value is Decimal) { return (byte)((Decimal.GetBits((Decimal)value)[3] & 0x00ff0000) >> 0x10); } return 0; } private int ValueSizeCore(object value) { if (!ADP.IsNull(value)) { string svalue = (value as string); if (null != svalue) { return svalue.Length; } byte[] bvalue = (value as byte[]); if (null != bvalue) { return bvalue.Length; } char[] cvalue = (value as char[]); if (null != cvalue) { return cvalue.Length; } if ((value is byte) || (value is char)) { return 1; } } return 0; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- namespace System.Data.EntityClient { using System; using System.ComponentModel; using System.Data; using System.Data.Common; using System.Globalization; public sealed partial class EntityParameter : DbParameter { private object _value; private object _parent; private ParameterDirection _direction; private int? _size; private string _sourceColumn; private DataRowVersion _sourceVersion; private bool _sourceColumnNullMapping; private bool? _isNullable; private object _coercedValue; private EntityParameter(EntityParameter source) : this() { ADP.CheckArgumentNull(source, "source"); source.CloneHelper(this); ICloneable cloneable = (_value as ICloneable); if (null != cloneable) { _value = cloneable.Clone(); } } private object CoercedValue { get { return _coercedValue; } set { _coercedValue = value; } } [ RefreshProperties(RefreshProperties.All), System.Data.ResCategoryAttribute(Res.DataCategory_Data), System.Data.ResDescriptionAttribute(Res.DbParameter_Direction), ] override public ParameterDirection Direction { get { ParameterDirection direction = _direction; return ((0 != direction) ? direction : ParameterDirection.Input); } set { if (_direction != value) { switch (value) { case ParameterDirection.Input: case ParameterDirection.Output: case ParameterDirection.InputOutput: case ParameterDirection.ReturnValue: PropertyChanging(); _direction = value; break; default: throw ADP.InvalidParameterDirection(value); } } } } override public bool IsNullable { get { bool result = this._isNullable.HasValue ? this._isNullable.Value : true; return result; } set { _isNullable = value; } } internal int Offset { get { return 0; } } [ System.Data.ResCategoryAttribute(Res.DataCategory_Data), System.Data.ResDescriptionAttribute(Res.DbParameter_Size), ] override public int Size { get { int size = _size.HasValue ? _size.Value : 0; if (0 == size) { size = ValueSize(Value); } return size; } set { if (!_size.HasValue || _size.Value != value) { if (value < -1) { throw ADP.InvalidSizeValue(value); } PropertyChanging(); if (0 == value) { _size = null; } else { _size = value; } } } } private void ResetSize() { if (_size.HasValue) { PropertyChanging(); _size = null; } } private bool ShouldSerializeSize() { return (_size.HasValue && _size.Value != 0); } [ System.Data.ResCategoryAttribute(Res.DataCategory_Update), System.Data.ResDescriptionAttribute(Res.DbParameter_SourceColumn), ] override public string SourceColumn { get { string sourceColumn = _sourceColumn; return ((null != sourceColumn) ? sourceColumn : ADP.StrEmpty); } set { _sourceColumn = value; } } public override bool SourceColumnNullMapping { get { return _sourceColumnNullMapping; } set { _sourceColumnNullMapping = value; } } [ System.Data.ResCategoryAttribute(Res.DataCategory_Update), System.Data.ResDescriptionAttribute(Res.DbParameter_SourceVersion), ] override public DataRowVersion SourceVersion { get { DataRowVersion sourceVersion = _sourceVersion; return ((0 != sourceVersion) ? sourceVersion : DataRowVersion.Current); } set { switch(value) { case DataRowVersion.Original: case DataRowVersion.Current: case DataRowVersion.Proposed: case DataRowVersion.Default: _sourceVersion = value; break; default: throw ADP.InvalidDataRowVersion(value); } } } private void CloneHelperCore(EntityParameter destination) { destination._value = _value; destination._direction = _direction; destination._size = _size; destination._sourceColumn = _sourceColumn; destination._sourceVersion = _sourceVersion; destination._sourceColumnNullMapping = _sourceColumnNullMapping; destination._isNullable = _isNullable; } internal void CopyTo(DbParameter destination) { ADP.CheckArgumentNull(destination, "destination"); CloneHelper((EntityParameter)destination); } internal object CompareExchangeParent(object value, object comparand) { object parent = _parent; if (comparand == parent) { _parent = value; } return parent; } internal void ResetParent() { _parent = null; } override public string ToString() { return ParameterName; } private byte ValuePrecisionCore(object value) { if (value is Decimal) { return ((System.Data.SqlTypes.SqlDecimal)(Decimal) value).Precision; } return 0; } private byte ValueScaleCore(object value) { if (value is Decimal) { return (byte)((Decimal.GetBits((Decimal)value)[3] & 0x00ff0000) >> 0x10); } return 0; } private int ValueSizeCore(object value) { if (!ADP.IsNull(value)) { string svalue = (value as string); if (null != svalue) { return svalue.Length; } byte[] bvalue = (value as byte[]); if (null != bvalue) { return bvalue.Length; } char[] cvalue = (value as char[]); if (null != cvalue) { return cvalue.Length; } if ((value is byte) || (value is char)) { return 1; } } return 0; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WmlPhoneCallAdapter.cs
- SByte.cs
- RuntimeResourceSet.cs
- FixedHyperLink.cs
- CodeTypeDeclaration.cs
- MouseCaptureWithinProperty.cs
- Deflater.cs
- EntityWrapperFactory.cs
- WindowInteractionStateTracker.cs
- TextEndOfSegment.cs
- VisualBasicReference.cs
- PropertyBuilder.cs
- ControlBuilder.cs
- path.cs
- DataGridViewDesigner.cs
- SqlResolver.cs
- CookieHandler.cs
- SafeFileMapViewHandle.cs
- OleDbInfoMessageEvent.cs
- SimpleTextLine.cs
- InstanceLockQueryResult.cs
- SemaphoreSecurity.cs
- SequentialOutput.cs
- WebUtil.cs
- IListConverters.cs
- DataGridViewUtilities.cs
- PolicyLevel.cs
- ScriptDescriptor.cs
- MappingException.cs
- PackWebRequestFactory.cs
- cache.cs
- EventRoute.cs
- ButtonRenderer.cs
- FixedPosition.cs
- SchemaCollectionCompiler.cs
- CodeTypeReferenceExpression.cs
- UnmanagedMemoryStream.cs
- ListControlBoundActionList.cs
- SqlNodeAnnotation.cs
- EdmConstants.cs
- X509Certificate2.cs
- MimeTypePropertyAttribute.cs
- SapiAttributeParser.cs
- SingleAnimationBase.cs
- StylusCollection.cs
- Path.cs
- CharacterMetrics.cs
- EncryptedKey.cs
- SerTrace.cs
- WebPartConnectionsCloseVerb.cs
- DataServiceCollectionOfT.cs
- XmlSchemaSimpleContentRestriction.cs
- WindowsImpersonationContext.cs
- MaterialGroup.cs
- DataControlLinkButton.cs
- EntityTemplateUserControl.cs
- PreloadHost.cs
- LinkAreaEditor.cs
- ProtocolsSection.cs
- SqlInternalConnectionTds.cs
- EventsTab.cs
- ProfileSettingsCollection.cs
- DictionaryManager.cs
- ScrollChangedEventArgs.cs
- ByteStreamMessageEncoder.cs
- CompilationPass2Task.cs
- RowToFieldTransformer.cs
- DataGridViewCellConverter.cs
- OrderedEnumerableRowCollection.cs
- DbParameterHelper.cs
- StateMachineWorkflow.cs
- Baml2006KeyRecord.cs
- ImageMetadata.cs
- ContextStaticAttribute.cs
- MethodCallConverter.cs
- ButtonFieldBase.cs
- RoutingChannelExtension.cs
- InternalConfigEventArgs.cs
- FontWeightConverter.cs
- DrawingImage.cs
- UInt16Converter.cs
- PublisherMembershipCondition.cs
- XmlnsPrefixAttribute.cs
- FontSource.cs
- StringValueConverter.cs
- CheckedPointers.cs
- SqlNodeAnnotations.cs
- xml.cs
- DiagnosticTrace.cs
- WebControlAdapter.cs
- ScrollEventArgs.cs
- SymbolPair.cs
- WindowsMenu.cs
- ComPlusInstanceContextInitializer.cs
- PathStreamGeometryContext.cs
- InternalBufferOverflowException.cs
- Ops.cs
- CoTaskMemSafeHandle.cs
- ProfilePropertySettings.cs
- XmlSchemaAnyAttribute.cs