Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / ObjectPersistData.cs / 1 / ObjectPersistData.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI {
using System.Collections;
using System.Collections.Specialized;
using System.Web.Util;
using System.Security.Permissions;
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public class ObjectPersistData {
private Type _objectType;
private bool _isCollection;
private ArrayList _collectionItems;
private bool _localize;
private string _resourceKey;
private IDictionary _propertyTableByFilter;
private IDictionary _propertyTableByProperty;
private ArrayList _allPropertyEntries;
private ArrayList _eventEntries;
private IDictionary _builtObjects;
public ObjectPersistData(ControlBuilder builder, IDictionary builtObjects) {
_objectType = builder.ControlType;
_localize = builder.Localize;
_resourceKey = builder.GetResourceKey();
_builtObjects = builtObjects;
if (typeof(ICollection).IsAssignableFrom(_objectType)) {
_isCollection = true;
}
_collectionItems = new ArrayList();
_propertyTableByFilter = new HybridDictionary(true);
_propertyTableByProperty = new HybridDictionary(true);
_allPropertyEntries = new ArrayList();
_eventEntries = new ArrayList();
foreach (PropertyEntry entry in builder.SimplePropertyEntries) {
AddPropertyEntry(entry);
}
foreach (PropertyEntry entry in builder.ComplexPropertyEntries) {
AddPropertyEntry(entry);
}
foreach (PropertyEntry entry in builder.TemplatePropertyEntries) {
AddPropertyEntry(entry);
}
foreach (PropertyEntry entry in builder.BoundPropertyEntries) {
AddPropertyEntry(entry);
}
foreach (EventEntry entry in builder.EventEntries) {
AddEventEntry(entry);
}
}
///
/// Get all property entries
///
public ICollection AllPropertyEntries {
get {
return _allPropertyEntries;
}
}
public IDictionary BuiltObjects {
get {
return _builtObjects;
}
}
public ICollection CollectionItems {
get {
return _collectionItems;
}
}
public ICollection EventEntries {
get {
return _eventEntries;
}
}
///
/// True if this persistence data is for a collection
///
public bool IsCollection {
get {
return _isCollection;
}
}
public bool Localize {
get {
return _localize;
}
}
///
/// The type of the object with these properties.
///
public Type ObjectType {
get {
return _objectType;
}
}
public string ResourceKey {
get {
return _resourceKey;
}
}
///
/// Adds a property to this persistence data, adding it to all necessary
/// data structures.
///
private void AddPropertyEntry(PropertyEntry entry) {
if (_isCollection && (entry is ComplexPropertyEntry && ((ComplexPropertyEntry)entry).IsCollectionItem)) {
_collectionItems.Add(entry);
}
else {
IDictionary filteredProperties = (IDictionary)_propertyTableByFilter[entry.Filter];
if (filteredProperties == null) {
filteredProperties = new HybridDictionary(true);
_propertyTableByFilter[entry.Filter] = filteredProperties;
}
Debug.Assert((entry.Name != null) && (entry.Name.Length > 0));
filteredProperties[entry.Name] = entry;
ArrayList properties = (ArrayList)_propertyTableByProperty[entry.Name];
if (properties == null) {
properties = new ArrayList();
_propertyTableByProperty[entry.Name] = properties;
}
properties.Add(entry);
}
_allPropertyEntries.Add(entry);
}
private void AddEventEntry(EventEntry entry) {
_eventEntries.Add(entry);
}
///
///
public void AddToObjectControlBuilderTable(IDictionary table) {
if (_builtObjects != null) {
foreach (DictionaryEntry entry in _builtObjects) {
table[entry.Key] = entry.Value;
}
}
}
///
/// Gets a PropertyEntry for the specified filter and property name
///
public PropertyEntry GetFilteredProperty(string filter, string name) {
IDictionary filteredProperties = GetFilteredProperties(filter);
if (filteredProperties != null) {
return (PropertyEntry)filteredProperties[name];
}
return null;
}
///
/// Gets all PropertyEntries for the specified filter
///
public IDictionary GetFilteredProperties(string filter) {
return (IDictionary)_propertyTableByFilter[filter];
}
///
/// Gets all filtered PropertiesEntries for a specified property (name uses dot-syntax e.g. Font.Bold)
///
public ICollection GetPropertyAllFilters(string name) {
ICollection properties = (ICollection)_propertyTableByProperty[name];
if (properties == null) {
return new ArrayList();
}
return properties;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI {
using System.Collections;
using System.Collections.Specialized;
using System.Web.Util;
using System.Security.Permissions;
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public class ObjectPersistData {
private Type _objectType;
private bool _isCollection;
private ArrayList _collectionItems;
private bool _localize;
private string _resourceKey;
private IDictionary _propertyTableByFilter;
private IDictionary _propertyTableByProperty;
private ArrayList _allPropertyEntries;
private ArrayList _eventEntries;
private IDictionary _builtObjects;
public ObjectPersistData(ControlBuilder builder, IDictionary builtObjects) {
_objectType = builder.ControlType;
_localize = builder.Localize;
_resourceKey = builder.GetResourceKey();
_builtObjects = builtObjects;
if (typeof(ICollection).IsAssignableFrom(_objectType)) {
_isCollection = true;
}
_collectionItems = new ArrayList();
_propertyTableByFilter = new HybridDictionary(true);
_propertyTableByProperty = new HybridDictionary(true);
_allPropertyEntries = new ArrayList();
_eventEntries = new ArrayList();
foreach (PropertyEntry entry in builder.SimplePropertyEntries) {
AddPropertyEntry(entry);
}
foreach (PropertyEntry entry in builder.ComplexPropertyEntries) {
AddPropertyEntry(entry);
}
foreach (PropertyEntry entry in builder.TemplatePropertyEntries) {
AddPropertyEntry(entry);
}
foreach (PropertyEntry entry in builder.BoundPropertyEntries) {
AddPropertyEntry(entry);
}
foreach (EventEntry entry in builder.EventEntries) {
AddEventEntry(entry);
}
}
///
/// Get all property entries
///
public ICollection AllPropertyEntries {
get {
return _allPropertyEntries;
}
}
public IDictionary BuiltObjects {
get {
return _builtObjects;
}
}
public ICollection CollectionItems {
get {
return _collectionItems;
}
}
public ICollection EventEntries {
get {
return _eventEntries;
}
}
///
/// True if this persistence data is for a collection
///
public bool IsCollection {
get {
return _isCollection;
}
}
public bool Localize {
get {
return _localize;
}
}
///
/// The type of the object with these properties.
///
public Type ObjectType {
get {
return _objectType;
}
}
public string ResourceKey {
get {
return _resourceKey;
}
}
///
/// Adds a property to this persistence data, adding it to all necessary
/// data structures.
///
private void AddPropertyEntry(PropertyEntry entry) {
if (_isCollection && (entry is ComplexPropertyEntry && ((ComplexPropertyEntry)entry).IsCollectionItem)) {
_collectionItems.Add(entry);
}
else {
IDictionary filteredProperties = (IDictionary)_propertyTableByFilter[entry.Filter];
if (filteredProperties == null) {
filteredProperties = new HybridDictionary(true);
_propertyTableByFilter[entry.Filter] = filteredProperties;
}
Debug.Assert((entry.Name != null) && (entry.Name.Length > 0));
filteredProperties[entry.Name] = entry;
ArrayList properties = (ArrayList)_propertyTableByProperty[entry.Name];
if (properties == null) {
properties = new ArrayList();
_propertyTableByProperty[entry.Name] = properties;
}
properties.Add(entry);
}
_allPropertyEntries.Add(entry);
}
private void AddEventEntry(EventEntry entry) {
_eventEntries.Add(entry);
}
///
///
public void AddToObjectControlBuilderTable(IDictionary table) {
if (_builtObjects != null) {
foreach (DictionaryEntry entry in _builtObjects) {
table[entry.Key] = entry.Value;
}
}
}
///
/// Gets a PropertyEntry for the specified filter and property name
///
public PropertyEntry GetFilteredProperty(string filter, string name) {
IDictionary filteredProperties = GetFilteredProperties(filter);
if (filteredProperties != null) {
return (PropertyEntry)filteredProperties[name];
}
return null;
}
///
/// Gets all PropertyEntries for the specified filter
///
public IDictionary GetFilteredProperties(string filter) {
return (IDictionary)_propertyTableByFilter[filter];
}
///
/// Gets all filtered PropertiesEntries for a specified property (name uses dot-syntax e.g. Font.Bold)
///
public ICollection GetPropertyAllFilters(string name) {
ICollection properties = (ICollection)_propertyTableByProperty[name];
if (properties == null) {
return new ArrayList();
}
return properties;
}
}
}
// 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
- SoapConverter.cs
- ErrorWrapper.cs
- RecordConverter.cs
- XmlDocumentSchema.cs
- SolidColorBrush.cs
- GridViewDeletedEventArgs.cs
- IssuedTokenClientCredential.cs
- SerializationSectionGroup.cs
- ContentType.cs
- XmlSchemaSimpleTypeList.cs
- MarkupExtensionReturnTypeAttribute.cs
- AuthenticationSection.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- MetaTableHelper.cs
- RadioButton.cs
- CodeAccessSecurityEngine.cs
- AssemblyAttributesGoHere.cs
- DataGridViewIntLinkedList.cs
- EventKeyword.cs
- COM2ICategorizePropertiesHandler.cs
- PatternMatcher.cs
- TypeBrowser.xaml.cs
- Subtree.cs
- UpdatePanelTrigger.cs
- XsltContext.cs
- ProfileBuildProvider.cs
- HttpListenerRequestTraceRecord.cs
- SafeRightsManagementEnvironmentHandle.cs
- StoragePropertyMapping.cs
- mediaeventshelper.cs
- CodeTypeReferenceCollection.cs
- StringBuilder.cs
- Stack.cs
- NamedPipeTransportBindingElement.cs
- HttpApplication.cs
- DesignerAutoFormat.cs
- SimpleHandlerBuildProvider.cs
- KoreanCalendar.cs
- HttpCapabilitiesBase.cs
- streamingZipPartStream.cs
- InternalCache.cs
- RangeContentEnumerator.cs
- PageHandlerFactory.cs
- LeaseManager.cs
- OracleConnection.cs
- RegexInterpreter.cs
- OracleFactory.cs
- XmlCharacterData.cs
- SharedStatics.cs
- QilLiteral.cs
- RecordManager.cs
- Size3D.cs
- TreeWalker.cs
- TimeSpanSecondsConverter.cs
- UIElementHelper.cs
- SkewTransform.cs
- InvokeBase.cs
- SafeEventLogReadHandle.cs
- XmlILOptimizerVisitor.cs
- DecoderBestFitFallback.cs
- BStrWrapper.cs
- XmlSchemaValidationException.cs
- Native.cs
- TaskFormBase.cs
- HtmlShim.cs
- CollectionChangedEventManager.cs
- DesignTimeVisibleAttribute.cs
- DbConnectionInternal.cs
- Rijndael.cs
- ServiceDiscoveryBehavior.cs
- HiddenFieldPageStatePersister.cs
- xmlglyphRunInfo.cs
- PartialCachingControl.cs
- DataGridViewRowEventArgs.cs
- StrongTypingException.cs
- HtmlTableRow.cs
- HttpWebRequest.cs
- ClickablePoint.cs
- WindowsScroll.cs
- WorkflowViewService.cs
- AutomationIdentifier.cs
- OrderToken.cs
- SizeConverter.cs
- _Events.cs
- RelatedCurrencyManager.cs
- DictionaryEditChange.cs
- CalendarDateChangedEventArgs.cs
- SerializerWriterEventHandlers.cs
- RegexReplacement.cs
- Model3D.cs
- ResourceReferenceExpression.cs
- ComplexBindingPropertiesAttribute.cs
- SessionStateItemCollection.cs
- RuleAction.cs
- ApplicationManager.cs
- DataGridTextBoxColumn.cs
- Attributes.cs
- Axis.cs
- DataListComponentEditor.cs
- HttpStreams.cs