Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / System / data / design / DbSourceCommand.cs / 1 / DbSourceCommand.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All Rights Reserved. // Information Contained Herein is Proprietary and Confidential. // //----------------------------------------------------------------------------- using System; using System.Data; using System.Data.Common; using System.Design; using System.Diagnostics; namespace System.Data.Design { using System; using System.ComponentModel; [ DataSourceXmlClass (SchemaName.DbCommand), DefaultProperty ("CommandText") ] internal class DbSourceCommand : DataSourceComponent, ICloneable, INamedObject { private DbSource _parent; private CommandOperation commandOperation; private string commandText; private CommandType commandType; private DbSourceParameterCollection parameterCollection; private bool modifiedByUser = false; private string name; public DbSourceCommand () { commandText = String.Empty; commandType = CommandType.Text; parameterCollection = new DbSourceParameterCollection (this); } public DbSourceCommand (DbSource parent, CommandOperation operation) : this() { SetParent (parent); CommandOperation = operation; } internal CommandOperation CommandOperation { get { return commandOperation; } set { commandOperation = value; } } [ DataSourceXmlElement (), Browsable (false), ] public string CommandText { get { return this.commandText; } set { this.commandText = value; } } [ DataSourceXmlAttribute (ItemType = typeof(CommandType)), DefaultValue (CommandType.Text) ] public CommandType CommandType { get { return this.commandType; } set { if( value == CommandType.TableDirect ) { if( this._parent != null && this._parent.Connection != null ) { string provider = this._parent.Connection.Provider; if( !StringUtil.EqualValue(provider, "System.Data.OleDb") ) { throw new Exception( SR.GetString(SR.DD_E_TableDirectValidForOleDbOnly) ); } } } this.commandType = value; } } [ Browsable (false), DataSourceXmlAttribute (ItemType = typeof(bool)) ] public bool ModifiedByUser { get { return this.modifiedByUser; } set { this.modifiedByUser = value; } } ////// Name is primarily used to display it in proerty grid /// Name is setting by its parent /// ///[Browsable(false)] public string Name { get { return name; } set { name = value; } } [ DataSourceXmlSubItem (ItemType = typeof(DesignParameter)) ] public DbSourceParameterCollection Parameters { get { return this.parameterCollection; } } private bool ShouldSerializeParameters () { return (null != this.parameterCollection && (0 < this.parameterCollection.Count)); } /// /// for IObjectWithParent /// [Browsable (false)] public override object Parent { get { return _parent; } } public object Clone() { DbSourceCommand cmd = new DbSourceCommand (); cmd.commandText = this.commandText; cmd.commandType = this.commandType; cmd.commandOperation = this.commandOperation; cmd.parameterCollection = (DbSourceParameterCollection)this.parameterCollection.Clone (); cmd.parameterCollection.CollectionHost = cmd; // ModifiedByUser flag is reset to default (false). return cmd; } internal void SetParent (DbSource parent) { _parent = parent; } public override string ToString() { if (StringUtil.NotEmptyAfterTrim (((INamedObject)this).Name)){ return ((INamedObject)this).Name; } return base.ToString(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HierarchicalDataSourceControl.cs
- TimeSpanHelper.cs
- TextEditorThreadLocalStore.cs
- BamlCollectionHolder.cs
- CacheOutputQuery.cs
- DefaultHttpHandler.cs
- FixedFindEngine.cs
- ConstraintEnumerator.cs
- RadioButtonList.cs
- Scene3D.cs
- VSWCFServiceContractGenerator.cs
- HashCoreRequest.cs
- BitmapMetadataBlob.cs
- StylusPlugin.cs
- AddressingVersion.cs
- SmtpReplyReaderFactory.cs
- InvariantComparer.cs
- RegexRunnerFactory.cs
- PageBuildProvider.cs
- XmlSchemaSequence.cs
- ClrProviderManifest.cs
- PagerSettings.cs
- HostVisual.cs
- WarningException.cs
- DelayDesigner.cs
- WorkflowDispatchContext.cs
- SqlParameter.cs
- DeclarativeCatalogPart.cs
- Panel.cs
- ItemsControl.cs
- SettingsProviderCollection.cs
- FontResourceCache.cs
- Cell.cs
- WebBrowserProgressChangedEventHandler.cs
- FormClosingEvent.cs
- AssemblyLoader.cs
- SecUtil.cs
- WebHttpBindingCollectionElement.cs
- TextBoxBaseDesigner.cs
- EntityUtil.cs
- CompatibleComparer.cs
- BindValidationContext.cs
- FileDataSourceCache.cs
- GridViewSelectEventArgs.cs
- BooleanExpr.cs
- EmptyReadOnlyDictionaryInternal.cs
- MsmqMessageSerializationFormat.cs
- SerializerDescriptor.cs
- TransformedBitmap.cs
- PasswordBox.cs
- InternalDispatchObject.cs
- AutomationIdentifier.cs
- CalendarDay.cs
- StringDictionary.cs
- printdlgexmarshaler.cs
- EntryWrittenEventArgs.cs
- CalendarSelectionChangedEventArgs.cs
- ToolStripItemDataObject.cs
- ColorTranslator.cs
- GatewayIPAddressInformationCollection.cs
- BasicKeyConstraint.cs
- ControlPropertyNameConverter.cs
- MissingSatelliteAssemblyException.cs
- Ray3DHitTestResult.cs
- MultipleViewPattern.cs
- SemanticBasicElement.cs
- SafeNativeMethods.cs
- SQLChars.cs
- ElementNotEnabledException.cs
- GenericNameHandler.cs
- SeparatorAutomationPeer.cs
- SqlProviderServices.cs
- FailedToStartupUIException.cs
- Vector.cs
- ACE.cs
- TcpProcessProtocolHandler.cs
- httpserverutility.cs
- ActiveXSite.cs
- PhysicalAddress.cs
- DifferencingCollection.cs
- TextTrailingWordEllipsis.cs
- DefaultValidator.cs
- TextTreeTextElementNode.cs
- ListBoxItemWrapperAutomationPeer.cs
- ListManagerBindingsCollection.cs
- RankException.cs
- peernodestatemanager.cs
- GifBitmapDecoder.cs
- WmfPlaceableFileHeader.cs
- VectorCollection.cs
- MembershipSection.cs
- DetailsView.cs
- FunctionImportElement.cs
- TextServicesDisplayAttribute.cs
- DurableInstanceManager.cs
- XmlSchemaRedefine.cs
- SmtpLoginAuthenticationModule.cs
- FontWeight.cs
- ASCIIEncoding.cs
- DataGridViewLinkCell.cs