Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / WebParts / PersonalizationStateQuery.cs / 2 / PersonalizationStateQuery.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls.WebParts { using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Security.Permissions; using System.Web.Util; [Serializable] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class PersonalizationStateQuery { private static readonly Dictionary_knownPropertyTypeMappings; private HybridDictionary _data; static PersonalizationStateQuery() { _knownPropertyTypeMappings = new Dictionary (StringComparer.OrdinalIgnoreCase); _knownPropertyTypeMappings["PathToMatch"] = typeof(string); _knownPropertyTypeMappings["UserInactiveSinceDate"] = typeof(DateTime); _knownPropertyTypeMappings["UsernameToMatch"] = typeof(string); } public PersonalizationStateQuery() { _data = new HybridDictionary(true); // _data["UserInactiveSinceDate"] = PersonalizationAdministration.DefaultInactiveSinceDate; } public string PathToMatch { get { return (string) this["PathToMatch"]; } set { if (value != null) { value = value.Trim(); } _data["PathToMatch"] = value; } } public DateTime UserInactiveSinceDate { get { object o = this["UserInactiveSinceDate"]; Debug.Assert(o != null, "Should always have a default value!"); return (DateTime) o; } set { _data["UserInactiveSinceDate"] = value; } } public string UsernameToMatch { get { return (string) this["UsernameToMatch"]; } set { if (value != null) { value = value.Trim(); } _data["UsernameToMatch"] = value; } } public object this[string queryKey] { get { queryKey = StringUtil.CheckAndTrimString(queryKey, "queryKey"); return _data[queryKey]; } set { queryKey = StringUtil.CheckAndTrimString(queryKey, "queryKey"); // if (_knownPropertyTypeMappings.ContainsKey(queryKey)) { Type valueType = _knownPropertyTypeMappings[queryKey]; Debug.Assert(valueType != null); if ((value == null && valueType.IsValueType) || (value != null && !valueType.IsAssignableFrom(value.GetType()))) { throw new ArgumentException( SR.GetString(SR.PersonalizationStateQuery_IncorrectValueType, queryKey, valueType.FullName)); } } _data[queryKey] = value; } } } } // 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.WebControls.WebParts { using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Security.Permissions; using System.Web.Util; [Serializable] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class PersonalizationStateQuery { private static readonly Dictionary_knownPropertyTypeMappings; private HybridDictionary _data; static PersonalizationStateQuery() { _knownPropertyTypeMappings = new Dictionary (StringComparer.OrdinalIgnoreCase); _knownPropertyTypeMappings["PathToMatch"] = typeof(string); _knownPropertyTypeMappings["UserInactiveSinceDate"] = typeof(DateTime); _knownPropertyTypeMappings["UsernameToMatch"] = typeof(string); } public PersonalizationStateQuery() { _data = new HybridDictionary(true); // _data["UserInactiveSinceDate"] = PersonalizationAdministration.DefaultInactiveSinceDate; } public string PathToMatch { get { return (string) this["PathToMatch"]; } set { if (value != null) { value = value.Trim(); } _data["PathToMatch"] = value; } } public DateTime UserInactiveSinceDate { get { object o = this["UserInactiveSinceDate"]; Debug.Assert(o != null, "Should always have a default value!"); return (DateTime) o; } set { _data["UserInactiveSinceDate"] = value; } } public string UsernameToMatch { get { return (string) this["UsernameToMatch"]; } set { if (value != null) { value = value.Trim(); } _data["UsernameToMatch"] = value; } } public object this[string queryKey] { get { queryKey = StringUtil.CheckAndTrimString(queryKey, "queryKey"); return _data[queryKey]; } set { queryKey = StringUtil.CheckAndTrimString(queryKey, "queryKey"); // if (_knownPropertyTypeMappings.ContainsKey(queryKey)) { Type valueType = _knownPropertyTypeMappings[queryKey]; Debug.Assert(valueType != null); if ((value == null && valueType.IsValueType) || (value != null && !valueType.IsAssignableFrom(value.GetType()))) { throw new ArgumentException( SR.GetString(SR.PersonalizationStateQuery_IncorrectValueType, queryKey, valueType.FullName)); } } _data[queryKey] = value; } } } } // 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
- ThreadAttributes.cs
- FixedSOMTextRun.cs
- HttpAsyncResult.cs
- ValueTypeFixupInfo.cs
- DataGridViewTopLeftHeaderCell.cs
- PageClientProxyGenerator.cs
- DragAssistanceManager.cs
- SafeNativeMethods.cs
- DesignerMetadata.cs
- Membership.cs
- AssemblyAttributes.cs
- SwitchLevelAttribute.cs
- ParameterSubsegment.cs
- _NestedMultipleAsyncResult.cs
- TrustManagerMoreInformation.cs
- DataViewListener.cs
- DataMisalignedException.cs
- InstalledFontCollection.cs
- ListItemCollection.cs
- GACIdentityPermission.cs
- DocComment.cs
- UnSafeCharBuffer.cs
- XmlDigitalSignatureProcessor.cs
- ModuleBuilder.cs
- XmlBinaryWriterSession.cs
- AttributeEmitter.cs
- _NTAuthentication.cs
- DataQuery.cs
- ResourceDictionaryCollection.cs
- SimpleApplicationHost.cs
- Odbc32.cs
- ExeContext.cs
- DBConnection.cs
- IDispatchConstantAttribute.cs
- ZipFileInfoCollection.cs
- XslTransformFileEditor.cs
- ImageCollectionEditor.cs
- ProbeDuplexCD1AsyncResult.cs
- BuildProvider.cs
- ExpressionEvaluator.cs
- DataGridViewEditingControlShowingEventArgs.cs
- SoapReflectionImporter.cs
- SiteMapProvider.cs
- SchemaTableOptionalColumn.cs
- CallContext.cs
- DateTimeConverter2.cs
- ObjectDataSourceStatusEventArgs.cs
- PathGeometry.cs
- ModuleBuilder.cs
- FolderLevelBuildProviderCollection.cs
- InlineObject.cs
- Translator.cs
- LastQueryOperator.cs
- ServiceObjectContainer.cs
- ChangePassword.cs
- AnonymousIdentificationModule.cs
- PropertyValue.cs
- DmlSqlGenerator.cs
- ProfilePropertyMetadata.cs
- AppDomainResourcePerfCounters.cs
- CollectionViewGroupRoot.cs
- LinearKeyFrames.cs
- BitmapSourceSafeMILHandle.cs
- EntityDataSourceStatementEditorForm.cs
- XmlSchemaGroupRef.cs
- ListBoxChrome.cs
- StrongNamePublicKeyBlob.cs
- DataBindingList.cs
- ProcessModuleCollection.cs
- TablePattern.cs
- DataBoundControlAdapter.cs
- ConfigurationManagerInternalFactory.cs
- PageAsyncTask.cs
- DataObjectFieldAttribute.cs
- RelOps.cs
- BulletedListEventArgs.cs
- ConfigurationPermission.cs
- EdmEntityTypeAttribute.cs
- NetworkInterface.cs
- Decorator.cs
- MembershipSection.cs
- DocumentViewerHelper.cs
- EntitySetBaseCollection.cs
- MenuItemBindingCollection.cs
- DesignConnectionCollection.cs
- NullableBoolConverter.cs
- ProtocolsConfiguration.cs
- ProfileSettingsCollection.cs
- SignatureHelper.cs
- DataGridColumnHeadersPresenter.cs
- CorrelationInitializer.cs
- DrawingContext.cs
- HttpRequest.cs
- NullExtension.cs
- CheckBoxStandardAdapter.cs
- ListDictionary.cs
- XmlExceptionHelper.cs
- WebControlParameterProxy.cs
- XmlProcessingInstruction.cs
- FontSourceCollection.cs