Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Data / System / Data / DataViewManagerListItemTypeDescriptor.cs / 1 / DataViewManagerListItemTypeDescriptor.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
// [....]
// [....]
//-----------------------------------------------------------------------------
namespace System.Data {
using System;
using System.ComponentModel;
///
/// [To be supplied.]
///
internal sealed class DataViewManagerListItemTypeDescriptor : ICustomTypeDescriptor {
private DataViewManager dataViewManager;
private PropertyDescriptorCollection propsCollection;
internal DataViewManagerListItemTypeDescriptor(DataViewManager dataViewManager) {
this.dataViewManager = dataViewManager;
}
internal void Reset() {
propsCollection = null;
}
internal DataView GetDataView(DataTable table) {
DataView dataView = new DataView(table);
dataView.SetDataViewManager(dataViewManager);
return dataView;
}
///
/// Retrieves an array of member attributes for the given object.
///
AttributeCollection ICustomTypeDescriptor.GetAttributes() {
return new AttributeCollection((Attribute[])null);
}
///
/// Retrieves the class name for this object. If null is returned,
/// the type name is used.
///
string ICustomTypeDescriptor.GetClassName() {
return null;
}
///
/// Retrieves the name for this object. If null is returned,
/// the default is used.
///
string ICustomTypeDescriptor.GetComponentName() {
return null;
}
///
/// Retrieves the type converter for this object.
///
TypeConverter ICustomTypeDescriptor.GetConverter() {
return null;
}
///
/// Retrieves the default event.
///
EventDescriptor ICustomTypeDescriptor.GetDefaultEvent() {
return null;
}
///
/// Retrieves the default property.
///
PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty() {
return null;
}
///
/// Retrieves the an editor for this object.
///
object ICustomTypeDescriptor.GetEditor(Type editorBaseType) {
return null;
}
///
/// Retrieves an array of events that the given component instance
/// provides. This may differ from the set of events the class
/// provides. If the component is sited, the site may add or remove
/// additional events.
///
EventDescriptorCollection ICustomTypeDescriptor.GetEvents() {
return new EventDescriptorCollection(null);
}
///
/// Retrieves an array of events that the given component instance
/// provides. This may differ from the set of events the class
/// provides. If the component is sited, the site may add or remove
/// additional events. The returned array of events will be
/// filtered by the given set of attributes.
///
EventDescriptorCollection ICustomTypeDescriptor.GetEvents(Attribute[] attributes) {
return new EventDescriptorCollection(null);
}
///
/// Retrieves an array of properties that the given component instance
/// provides. This may differ from the set of properties the class
/// provides. If the component is sited, the site may add or remove
/// additional properties.
///
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties() {
return((ICustomTypeDescriptor)this).GetProperties(null);
}
///
/// Retrieves an array of properties that the given component instance
/// provides. This may differ from the set of properties the class
/// provides. If the component is sited, the site may add or remove
/// additional properties. The returned array of properties will be
/// filtered by the given set of attributes.
///
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes) {
if (propsCollection == null) {
PropertyDescriptor[] props = null;
DataSet dataSet = dataViewManager.DataSet;
if (dataSet != null) {
int tableCount = dataSet.Tables.Count;
props = new PropertyDescriptor[tableCount];
for (int i = 0; i < tableCount; i++) {
props[i] = new DataTablePropertyDescriptor(dataSet.Tables[i]);
}
}
propsCollection = new PropertyDescriptorCollection(props);
}
return propsCollection;
}
///
/// Retrieves the object that directly depends on this value being edited. This is
/// generally the object that is required for the PropertyDescriptor's GetValue and SetValue
/// methods. If 'null' is passed for the PropertyDescriptor, the ICustomComponent
/// descripotor implemementation should return the default object, that is the main
/// object that exposes the properties and attributes,
///
object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd) {
return this;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
// [....]
// [....]
//-----------------------------------------------------------------------------
namespace System.Data {
using System;
using System.ComponentModel;
///
/// [To be supplied.]
///
internal sealed class DataViewManagerListItemTypeDescriptor : ICustomTypeDescriptor {
private DataViewManager dataViewManager;
private PropertyDescriptorCollection propsCollection;
internal DataViewManagerListItemTypeDescriptor(DataViewManager dataViewManager) {
this.dataViewManager = dataViewManager;
}
internal void Reset() {
propsCollection = null;
}
internal DataView GetDataView(DataTable table) {
DataView dataView = new DataView(table);
dataView.SetDataViewManager(dataViewManager);
return dataView;
}
///
/// Retrieves an array of member attributes for the given object.
///
AttributeCollection ICustomTypeDescriptor.GetAttributes() {
return new AttributeCollection((Attribute[])null);
}
///
/// Retrieves the class name for this object. If null is returned,
/// the type name is used.
///
string ICustomTypeDescriptor.GetClassName() {
return null;
}
///
/// Retrieves the name for this object. If null is returned,
/// the default is used.
///
string ICustomTypeDescriptor.GetComponentName() {
return null;
}
///
/// Retrieves the type converter for this object.
///
TypeConverter ICustomTypeDescriptor.GetConverter() {
return null;
}
///
/// Retrieves the default event.
///
EventDescriptor ICustomTypeDescriptor.GetDefaultEvent() {
return null;
}
///
/// Retrieves the default property.
///
PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty() {
return null;
}
///
/// Retrieves the an editor for this object.
///
object ICustomTypeDescriptor.GetEditor(Type editorBaseType) {
return null;
}
///
/// Retrieves an array of events that the given component instance
/// provides. This may differ from the set of events the class
/// provides. If the component is sited, the site may add or remove
/// additional events.
///
EventDescriptorCollection ICustomTypeDescriptor.GetEvents() {
return new EventDescriptorCollection(null);
}
///
/// Retrieves an array of events that the given component instance
/// provides. This may differ from the set of events the class
/// provides. If the component is sited, the site may add or remove
/// additional events. The returned array of events will be
/// filtered by the given set of attributes.
///
EventDescriptorCollection ICustomTypeDescriptor.GetEvents(Attribute[] attributes) {
return new EventDescriptorCollection(null);
}
///
/// Retrieves an array of properties that the given component instance
/// provides. This may differ from the set of properties the class
/// provides. If the component is sited, the site may add or remove
/// additional properties.
///
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties() {
return((ICustomTypeDescriptor)this).GetProperties(null);
}
///
/// Retrieves an array of properties that the given component instance
/// provides. This may differ from the set of properties the class
/// provides. If the component is sited, the site may add or remove
/// additional properties. The returned array of properties will be
/// filtered by the given set of attributes.
///
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes) {
if (propsCollection == null) {
PropertyDescriptor[] props = null;
DataSet dataSet = dataViewManager.DataSet;
if (dataSet != null) {
int tableCount = dataSet.Tables.Count;
props = new PropertyDescriptor[tableCount];
for (int i = 0; i < tableCount; i++) {
props[i] = new DataTablePropertyDescriptor(dataSet.Tables[i]);
}
}
propsCollection = new PropertyDescriptorCollection(props);
}
return propsCollection;
}
///
/// Retrieves the object that directly depends on this value being edited. This is
/// generally the object that is required for the PropertyDescriptor's GetValue and SetValue
/// methods. If 'null' is passed for the PropertyDescriptor, the ICustomComponent
/// descripotor implemementation should return the default object, that is the main
/// object that exposes the properties and attributes,
///
object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd) {
return this;
}
}
}
// 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
- OdbcStatementHandle.cs
- TreeViewDataItemAutomationPeer.cs
- TypeLoadException.cs
- ToolStripMenuItem.cs
- ShutDownListener.cs
- Vector3D.cs
- XmlNamedNodeMap.cs
- SerializationStore.cs
- EventListenerClientSide.cs
- QilValidationVisitor.cs
- SemanticKeyElement.cs
- Expression.cs
- Visual.cs
- HtmlControl.cs
- RootBuilder.cs
- SoapExtensionStream.cs
- FormParameter.cs
- DefaultMemberAttribute.cs
- TypeForwardedToAttribute.cs
- ValueOfAction.cs
- DateTimeFormatInfo.cs
- SortExpressionBuilder.cs
- TimeZone.cs
- ContentElement.cs
- TypeReference.cs
- InstallerTypeAttribute.cs
- TransportManager.cs
- WebPartCollection.cs
- DebugView.cs
- SelectionHighlightInfo.cs
- RegexWriter.cs
- OperationSelectorBehavior.cs
- TraceLog.cs
- XhtmlBasicTextBoxAdapter.cs
- ValueQuery.cs
- DataObjectFieldAttribute.cs
- CodeDelegateInvokeExpression.cs
- Int32CAMarshaler.cs
- LayoutManager.cs
- DocumentGridPage.cs
- Pointer.cs
- HttpModuleCollection.cs
- UDPClient.cs
- EntityDataSourceEntitySetNameItem.cs
- RowSpanVector.cs
- DataControlFieldCollection.cs
- Utils.cs
- DataControlImageButton.cs
- CLSCompliantAttribute.cs
- ImportContext.cs
- SerializationUtility.cs
- XmlTextReader.cs
- BitVector32.cs
- LocalizationComments.cs
- CalendarDesigner.cs
- ArgumentException.cs
- RadioButtonFlatAdapter.cs
- ReachBasicContext.cs
- DataGridParentRows.cs
- SqlConnectionString.cs
- DispatcherObject.cs
- EventItfInfo.cs
- XmlILAnnotation.cs
- SafeJobHandle.cs
- VerificationAttribute.cs
- BitmapMetadata.cs
- CriticalExceptions.cs
- HybridDictionary.cs
- HwndMouseInputProvider.cs
- FormCollection.cs
- RuleValidation.cs
- PaintEvent.cs
- WmlListAdapter.cs
- PathSegmentCollection.cs
- TickBar.cs
- UnionCodeGroup.cs
- AutoScrollHelper.cs
- FtpWebResponse.cs
- GlobalProxySelection.cs
- FilteredAttributeCollection.cs
- PaperSize.cs
- TemplateBindingExpression.cs
- ButtonBaseAutomationPeer.cs
- propertyentry.cs
- XmlCodeExporter.cs
- QueryOptionExpression.cs
- ThreadExceptionEvent.cs
- PropertyEmitterBase.cs
- ScriptManagerProxy.cs
- Utility.cs
- PropertyEmitterBase.cs
- TriState.cs
- RecordConverter.cs
- IgnorePropertiesAttribute.cs
- DoubleStorage.cs
- EnumValAlphaComparer.cs
- ListQueryResults.cs
- ChtmlLinkAdapter.cs
- SR.cs
- UnaryNode.cs