Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / xsp / System / Web / UI / WebControls / XmlDataSourceNodeDescriptor.cs / 1 / XmlDataSourceNodeDescriptor.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing.Design; using System.Security.Permissions; using System.Text; using System.Web; using System.Web.UI; using System.Web.Util; using System.Xml; using System.Xml.XPath; using AttributeCollection = System.ComponentModel.AttributeCollection; ////// internal sealed class XmlDataSourceNodeDescriptor : ICustomTypeDescriptor, IXPathNavigable { private XmlNode _node; ////// Creates a new instance of XmlDataSourceView. /// public XmlDataSourceNodeDescriptor(XmlNode node) { Debug.Assert(node != null, "Did not expect null node"); _node = node; } AttributeCollection ICustomTypeDescriptor.GetAttributes() { return AttributeCollection.Empty; } string ICustomTypeDescriptor.GetClassName() { return GetType().Name; } string ICustomTypeDescriptor.GetComponentName() { return null; } TypeConverter ICustomTypeDescriptor.GetConverter() { return null; } EventDescriptor ICustomTypeDescriptor.GetDefaultEvent() { return null; } PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty() { return null; } object ICustomTypeDescriptor.GetEditor(Type editorBaseType) { return null; } EventDescriptorCollection ICustomTypeDescriptor.GetEvents() { return null; } EventDescriptorCollection ICustomTypeDescriptor.GetEvents(Attribute[] attrs) { return null; } PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties() { return ((ICustomTypeDescriptor)this).GetProperties(null); } PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attrFilter) { System.Collections.Generic.Listlist = new System.Collections.Generic.List (); XmlAttributeCollection attrs = _node.Attributes; if (attrs != null) { for (int i = 0; i < attrs.Count; i++) { list.Add(new XmlDataSourcePropertyDescriptor(attrs[i].Name)); } } return new PropertyDescriptorCollection(list.ToArray()); } object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd) { if (pd is XmlDataSourcePropertyDescriptor) { return this; } return null; } XPathNavigator IXPathNavigable.CreateNavigator() { return _node.CreateNavigator(); } private class XmlDataSourcePropertyDescriptor : PropertyDescriptor { private string _name; public XmlDataSourcePropertyDescriptor(string name) : base(name, null) { _name = name; } public override Type ComponentType { get { return typeof(XmlDataSourceNodeDescriptor); } } public override bool IsReadOnly { get { return true; } } public override Type PropertyType { get { return typeof(string); } } public override bool CanResetValue(object o) { return false; } public override object GetValue(object o) { XmlDataSourceNodeDescriptor node = o as XmlDataSourceNodeDescriptor; if (node != null) { XmlAttributeCollection attrs = node._node.Attributes; if (attrs != null) { XmlAttribute attr = attrs[_name]; if (attr != null) { return attr.Value; } } } return String.Empty; } public override void ResetValue(object o) { } public override void SetValue(object o, object value) { } public override bool ShouldSerializeValue(object o) { return true; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing.Design; using System.Security.Permissions; using System.Text; using System.Web; using System.Web.UI; using System.Web.Util; using System.Xml; using System.Xml.XPath; using AttributeCollection = System.ComponentModel.AttributeCollection; ////// internal sealed class XmlDataSourceNodeDescriptor : ICustomTypeDescriptor, IXPathNavigable { private XmlNode _node; ////// Creates a new instance of XmlDataSourceView. /// public XmlDataSourceNodeDescriptor(XmlNode node) { Debug.Assert(node != null, "Did not expect null node"); _node = node; } AttributeCollection ICustomTypeDescriptor.GetAttributes() { return AttributeCollection.Empty; } string ICustomTypeDescriptor.GetClassName() { return GetType().Name; } string ICustomTypeDescriptor.GetComponentName() { return null; } TypeConverter ICustomTypeDescriptor.GetConverter() { return null; } EventDescriptor ICustomTypeDescriptor.GetDefaultEvent() { return null; } PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty() { return null; } object ICustomTypeDescriptor.GetEditor(Type editorBaseType) { return null; } EventDescriptorCollection ICustomTypeDescriptor.GetEvents() { return null; } EventDescriptorCollection ICustomTypeDescriptor.GetEvents(Attribute[] attrs) { return null; } PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties() { return ((ICustomTypeDescriptor)this).GetProperties(null); } PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attrFilter) { System.Collections.Generic.Listlist = new System.Collections.Generic.List (); XmlAttributeCollection attrs = _node.Attributes; if (attrs != null) { for (int i = 0; i < attrs.Count; i++) { list.Add(new XmlDataSourcePropertyDescriptor(attrs[i].Name)); } } return new PropertyDescriptorCollection(list.ToArray()); } object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd) { if (pd is XmlDataSourcePropertyDescriptor) { return this; } return null; } XPathNavigator IXPathNavigable.CreateNavigator() { return _node.CreateNavigator(); } private class XmlDataSourcePropertyDescriptor : PropertyDescriptor { private string _name; public XmlDataSourcePropertyDescriptor(string name) : base(name, null) { _name = name; } public override Type ComponentType { get { return typeof(XmlDataSourceNodeDescriptor); } } public override bool IsReadOnly { get { return true; } } public override Type PropertyType { get { return typeof(string); } } public override bool CanResetValue(object o) { return false; } public override object GetValue(object o) { XmlDataSourceNodeDescriptor node = o as XmlDataSourceNodeDescriptor; if (node != null) { XmlAttributeCollection attrs = node._node.Attributes; if (attrs != null) { XmlAttribute attr = attrs[_name]; if (attr != null) { return attr.Value; } } } return String.Empty; } public override void ResetValue(object o) { } public override void SetValue(object o, object value) { } public override bool ShouldSerializeValue(object o) { return true; } } } } // 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
- XmlTextAttribute.cs
- CommunicationObject.cs
- MediaSystem.cs
- WebContext.cs
- UnmanagedBitmapWrapper.cs
- CookieProtection.cs
- KernelTypeValidation.cs
- DataGridViewCellEventArgs.cs
- XmlToDatasetMap.cs
- WpfXamlType.cs
- MultiDataTrigger.cs
- ColorMatrix.cs
- Int32Rect.cs
- ReachPageContentSerializerAsync.cs
- DataControlField.cs
- ListViewUpdateEventArgs.cs
- oledbmetadatacollectionnames.cs
- EmptyCollection.cs
- SortFieldComparer.cs
- IndicCharClassifier.cs
- GeneralTransform3DCollection.cs
- DataGridAddNewRow.cs
- GradientBrush.cs
- DropShadowBitmapEffect.cs
- PathSegment.cs
- DrawingDrawingContext.cs
- BinaryMethodMessage.cs
- InertiaExpansionBehavior.cs
- CompiledRegexRunnerFactory.cs
- TemplateEditingFrame.cs
- HMACRIPEMD160.cs
- KerberosRequestorSecurityTokenAuthenticator.cs
- ColorAnimation.cs
- CodeCatchClauseCollection.cs
- UIntPtr.cs
- ConversionContext.cs
- MultiDataTrigger.cs
- Executor.cs
- ThreadAbortException.cs
- MappingMetadataHelper.cs
- MasterPageParser.cs
- SHA512Managed.cs
- EntityDataSource.cs
- BuildResult.cs
- WebPartCancelEventArgs.cs
- KeySplineConverter.cs
- PrinterUnitConvert.cs
- SmtpReplyReaderFactory.cs
- InvalidPropValue.cs
- XmlKeywords.cs
- DataConnectionHelper.cs
- ProviderUtil.cs
- DesignerLoader.cs
- updateconfighost.cs
- RayMeshGeometry3DHitTestResult.cs
- QueryReaderSettings.cs
- TextBounds.cs
- BindingMAnagerBase.cs
- StackSpiller.Bindings.cs
- Util.cs
- ProfessionalColors.cs
- BinaryConverter.cs
- SingleAnimationBase.cs
- DocumentGrid.cs
- elementinformation.cs
- CommandManager.cs
- ColorTransform.cs
- CompilerErrorCollection.cs
- XmlCustomFormatter.cs
- InvalidFilterCriteriaException.cs
- SqlPersonalizationProvider.cs
- ReachSerializationUtils.cs
- NavigationProperty.cs
- SqlCommandBuilder.cs
- DataGrid.cs
- SystemGatewayIPAddressInformation.cs
- XmlQueryOutput.cs
- DragEvent.cs
- smtppermission.cs
- RoutedEventConverter.cs
- UInt32Converter.cs
- RequestQueryParser.cs
- ServiceReference.cs
- GetBrowserTokenRequest.cs
- CommandValueSerializer.cs
- SmiRequestExecutor.cs
- DbException.cs
- ASCIIEncoding.cs
- Error.cs
- SQLMembershipProvider.cs
- _ProxyChain.cs
- DependencyPropertyConverter.cs
- ErrorWrapper.cs
- Size3D.cs
- XamlRtfConverter.cs
- Point.cs
- SequentialWorkflowRootDesigner.cs
- FormsAuthenticationEventArgs.cs
- XPathDescendantIterator.cs
- SQLMoneyStorage.cs