Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / EntityClient / EntityParameterCollection.cs / 1 / EntityParameterCollection.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....], [....]
//---------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Data.Metadata.Edm;
namespace System.Data.EntityClient
{
///
/// Class representing a parameter collection used in EntityCommand
///
public sealed partial class EntityParameterCollection : DbParameterCollection
{
private static Type ItemType = typeof(EntityParameter);
private bool _isDirty;
///
/// Constructs the EntityParameterCollection object
///
internal EntityParameterCollection()
: base()
{
}
///
/// Gets the parameter from the collection at the specified index
///
/// The index of the parameter to retrieved
/// The parameter at the index
public new EntityParameter this[int index]
{
get
{
return (EntityParameter)this.GetParameter(index);
}
set
{
this.SetParameter(index, value);
}
}
///
/// Gets the parameter with the given name from the collection
///
/// The name of the parameter to retrieved
/// The parameter with the given name
public new EntityParameter this[string parameterName]
{
get
{
return (EntityParameter)this.GetParameter(parameterName);
}
set
{
this.SetParameter(parameterName, value);
}
}
///
/// Gets whether this collection has been changes since the last reset
///
internal bool IsDirty
{
get
{
if (_isDirty)
{
return true;
}
// Loop through and return true if any parameter is dirty
foreach (EntityParameter parameter in this)
{
if (parameter.IsDirty)
{
return true;
}
}
return false;
}
}
///
/// Add a EntityParameter to the collection
///
/// The parameter to add to the collection
/// The index of the new parameter within the collection
public EntityParameter Add(EntityParameter value)
{
this.Add((object)value);
return value;
}
///
/// Add a EntityParameter with the given name and value to the collection
///
/// The name of the parameter to add
/// The value of the parameter to add
/// The index of the new parameter within the collection
public EntityParameter AddWithValue(string parameterName, object value)
{
EntityParameter param = new EntityParameter();
param.ParameterName = parameterName;
param.Value = value;
return this.Add(param);
}
///
/// Adds a EntityParameter with the given name and type to the collection
///
/// The name of the parameter to add
/// The type of the parameter
/// The index of the new parameter within the collection
public EntityParameter Add(string parameterName, DbType dbType)
{
return this.Add(new EntityParameter(parameterName, dbType));
}
///
/// Add a EntityParameter with the given name, type, and size to the collection
///
/// The name of the parameter to add
/// The type of the parameter
/// The size of the parameter
/// The index of the new parameter within the collection
public EntityParameter Add(string parameterName, DbType dbType, int size)
{
return this.Add(new EntityParameter(parameterName, dbType, size));
}
///
/// Adds a range of EntityParameter objects to this collection
///
/// The arary of EntityParameter objects to add
public void AddRange(EntityParameter[] values)
{
this.AddRange((Array)values);
}
///
/// Check if the collection has a parameter with the given parameter name
///
/// The parameter name to look for
/// True if the collection has a parameter with the given name
public override bool Contains(string parameterName)
{
return this.IndexOf(parameterName) != -1;
}
///
/// Copies the given array of parameters into this collection
///
/// The array to copy into
/// The index in the array where the copy starts
public void CopyTo(EntityParameter[] array, int index)
{
this.CopyTo((Array)array, index);
}
///
/// Finds the index in the collection of the given parameter object
///
/// The parameter to search for
/// The index of the parameter, -1 if not found
public int IndexOf(EntityParameter value)
{
return IndexOf((object)value);
}
///
/// Add a EntityParameter with the given value to the collection at a location indicated by the index
///
/// The index at which the parameter is to be inserted
/// The value of the parameter
public void Insert(int index, EntityParameter value)
{
this.Insert(index, (object)value);
}
///
/// Marks that this collection has been changed
///
private void OnChange()
{
_isDirty = true;
}
///
/// Remove a EntityParameter with the given value from the collection
///
/// The parameter to remove
public void Remove(EntityParameter value)
{
this.Remove((object)value);
}
///
/// Reset the dirty flag on the collection
///
internal void ResetIsDirty()
{
_isDirty = false;
// Loop through and reset each parameter
foreach (EntityParameter parameter in this)
{
parameter.ResetIsDirty();
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....], [....]
//---------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Data.Metadata.Edm;
namespace System.Data.EntityClient
{
///
/// Class representing a parameter collection used in EntityCommand
///
public sealed partial class EntityParameterCollection : DbParameterCollection
{
private static Type ItemType = typeof(EntityParameter);
private bool _isDirty;
///
/// Constructs the EntityParameterCollection object
///
internal EntityParameterCollection()
: base()
{
}
///
/// Gets the parameter from the collection at the specified index
///
/// The index of the parameter to retrieved
/// The parameter at the index
public new EntityParameter this[int index]
{
get
{
return (EntityParameter)this.GetParameter(index);
}
set
{
this.SetParameter(index, value);
}
}
///
/// Gets the parameter with the given name from the collection
///
/// The name of the parameter to retrieved
/// The parameter with the given name
public new EntityParameter this[string parameterName]
{
get
{
return (EntityParameter)this.GetParameter(parameterName);
}
set
{
this.SetParameter(parameterName, value);
}
}
///
/// Gets whether this collection has been changes since the last reset
///
internal bool IsDirty
{
get
{
if (_isDirty)
{
return true;
}
// Loop through and return true if any parameter is dirty
foreach (EntityParameter parameter in this)
{
if (parameter.IsDirty)
{
return true;
}
}
return false;
}
}
///
/// Add a EntityParameter to the collection
///
/// The parameter to add to the collection
/// The index of the new parameter within the collection
public EntityParameter Add(EntityParameter value)
{
this.Add((object)value);
return value;
}
///
/// Add a EntityParameter with the given name and value to the collection
///
/// The name of the parameter to add
/// The value of the parameter to add
/// The index of the new parameter within the collection
public EntityParameter AddWithValue(string parameterName, object value)
{
EntityParameter param = new EntityParameter();
param.ParameterName = parameterName;
param.Value = value;
return this.Add(param);
}
///
/// Adds a EntityParameter with the given name and type to the collection
///
/// The name of the parameter to add
/// The type of the parameter
/// The index of the new parameter within the collection
public EntityParameter Add(string parameterName, DbType dbType)
{
return this.Add(new EntityParameter(parameterName, dbType));
}
///
/// Add a EntityParameter with the given name, type, and size to the collection
///
/// The name of the parameter to add
/// The type of the parameter
/// The size of the parameter
/// The index of the new parameter within the collection
public EntityParameter Add(string parameterName, DbType dbType, int size)
{
return this.Add(new EntityParameter(parameterName, dbType, size));
}
///
/// Adds a range of EntityParameter objects to this collection
///
/// The arary of EntityParameter objects to add
public void AddRange(EntityParameter[] values)
{
this.AddRange((Array)values);
}
///
/// Check if the collection has a parameter with the given parameter name
///
/// The parameter name to look for
/// True if the collection has a parameter with the given name
public override bool Contains(string parameterName)
{
return this.IndexOf(parameterName) != -1;
}
///
/// Copies the given array of parameters into this collection
///
/// The array to copy into
/// The index in the array where the copy starts
public void CopyTo(EntityParameter[] array, int index)
{
this.CopyTo((Array)array, index);
}
///
/// Finds the index in the collection of the given parameter object
///
/// The parameter to search for
/// The index of the parameter, -1 if not found
public int IndexOf(EntityParameter value)
{
return IndexOf((object)value);
}
///
/// Add a EntityParameter with the given value to the collection at a location indicated by the index
///
/// The index at which the parameter is to be inserted
/// The value of the parameter
public void Insert(int index, EntityParameter value)
{
this.Insert(index, (object)value);
}
///
/// Marks that this collection has been changed
///
private void OnChange()
{
_isDirty = true;
}
///
/// Remove a EntityParameter with the given value from the collection
///
/// The parameter to remove
public void Remove(EntityParameter value)
{
this.Remove((object)value);
}
///
/// Reset the dirty flag on the collection
///
internal void ResetIsDirty()
{
_isDirty = false;
// Loop through and reset each parameter
foreach (EntityParameter parameter in this)
{
parameter.ResetIsDirty();
}
}
}
}
// 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
- DataGridViewBand.cs
- TextLineBreak.cs
- ConfigurationException.cs
- TimelineClockCollection.cs
- TextBoxAutoCompleteSourceConverter.cs
- ColorTranslator.cs
- DataServiceHostFactory.cs
- PolygonHotSpot.cs
- InvalidAsynchronousStateException.cs
- LookupNode.cs
- HtmlSelect.cs
- FontNamesConverter.cs
- SafeCryptoHandles.cs
- WebPartEditVerb.cs
- TemplateParser.cs
- OutArgument.cs
- TextEditorDragDrop.cs
- ToolTip.cs
- VectorAnimationUsingKeyFrames.cs
- SQLConvert.cs
- COM2PictureConverter.cs
- PointCollectionConverter.cs
- util.cs
- SqlStream.cs
- Privilege.cs
- Rule.cs
- ErrorTolerantObjectWriter.cs
- StrokeCollectionConverter.cs
- DependencyPropertyConverter.cs
- Wizard.cs
- _SecureChannel.cs
- SpeechAudioFormatInfo.cs
- Sequence.cs
- HTTP_SERVICE_CONFIG_URLACL_KEY.cs
- SspiHelper.cs
- StringValidator.cs
- CompositeDataBoundControl.cs
- WaveHeader.cs
- AppSettingsExpressionBuilder.cs
- ContentElement.cs
- ScrollProperties.cs
- FactoryGenerator.cs
- SafeNativeMethods.cs
- WindowsPrincipal.cs
- StrokeDescriptor.cs
- RoleServiceManager.cs
- _SecureChannel.cs
- XmlObjectSerializer.cs
- Lasso.cs
- ZipFileInfoCollection.cs
- RsaSecurityToken.cs
- DispatcherExceptionFilterEventArgs.cs
- ManipulationLogic.cs
- EventLogPermissionAttribute.cs
- CanonicalFontFamilyReference.cs
- RoleServiceManager.cs
- SQLChars.cs
- TrustExchangeException.cs
- TouchFrameEventArgs.cs
- RegexCompiler.cs
- DirectionalLight.cs
- AnonymousIdentificationSection.cs
- AttributedMetaModel.cs
- SqlProfileProvider.cs
- DrawingBrush.cs
- StateManagedCollection.cs
- SeverityFilter.cs
- CachedBitmap.cs
- MailMessageEventArgs.cs
- SqlMethods.cs
- ResolveMatchesMessage11.cs
- SecUtil.cs
- MembershipValidatePasswordEventArgs.cs
- ToolboxComponentsCreatedEventArgs.cs
- UidManager.cs
- DataGridView.cs
- ReadOnlyCollectionBuilder.cs
- PriorityQueue.cs
- BuildProviderCollection.cs
- WmpBitmapDecoder.cs
- Style.cs
- DataBoundControl.cs
- PasswordDeriveBytes.cs
- ValidationContext.cs
- ExpandCollapseProviderWrapper.cs
- ParallelEnumerableWrapper.cs
- HttpFileCollection.cs
- ConnectionInterfaceCollection.cs
- StorageTypeMapping.cs
- PixelFormatConverter.cs
- ByteStack.cs
- CompilationSection.cs
- httpstaticobjectscollection.cs
- NetNamedPipeBindingCollectionElement.cs
- OpenTypeLayout.cs
- HiddenFieldPageStatePersister.cs
- AuthenticationModuleElement.cs
- ApplicationSecurityManager.cs
- RenderDataDrawingContext.cs
- MessageEncodingBindingElementImporter.cs