Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebParts / PersonalizationStateQuery.cs / 1 / 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); // VSWhidbey 357097: UserInactiveSinceDate needs to have a default value returned for the indexer property _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"); // VSWhidbey 436311: We need to check the value types for known properties 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; } } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ProtectedProviderSettings.cs
- TrackingStringDictionary.cs
- BooleanFacetDescriptionElement.cs
- View.cs
- _StreamFramer.cs
- WorkflowDesignerMessageFilter.cs
- Link.cs
- XmlAnyAttributeAttribute.cs
- IriParsingElement.cs
- ConfigurationManager.cs
- xmlformatgeneratorstatics.cs
- DataColumnMapping.cs
- UIServiceHelper.cs
- ByteStreamGeometryContext.cs
- KeyManager.cs
- Schema.cs
- PropertyGroupDescription.cs
- DBDataPermission.cs
- DesignerLoader.cs
- SmiMetaData.cs
- TitleStyle.cs
- SessionConnectionReader.cs
- AutoSizeToolBoxItem.cs
- DataChangedEventManager.cs
- OdbcConnectionOpen.cs
- Parser.cs
- VariableAction.cs
- SessionStateModule.cs
- RequestDescription.cs
- ItemCheckedEvent.cs
- DesignBindingPropertyDescriptor.cs
- QilUnary.cs
- DataGridViewColumnEventArgs.cs
- ContextMarshalException.cs
- WebZone.cs
- SmtpReplyReader.cs
- SByte.cs
- BrowserTree.cs
- RSAPKCS1SignatureFormatter.cs
- MonthChangedEventArgs.cs
- nulltextnavigator.cs
- DataGridHelper.cs
- MemberBinding.cs
- BypassElement.cs
- ChtmlTextWriter.cs
- TimeoutStream.cs
- PersonalizationProviderCollection.cs
- Pen.cs
- securitymgrsite.cs
- SmtpNtlmAuthenticationModule.cs
- PieceNameHelper.cs
- PrimitiveType.cs
- MulticastDelegate.cs
- CompositeFontInfo.cs
- ResourceAttributes.cs
- HandleRef.cs
- TypeConstant.cs
- RawStylusInputCustomDataList.cs
- ToolZoneDesigner.cs
- TaskFileService.cs
- NavigatingCancelEventArgs.cs
- SoapExtensionStream.cs
- FixedTextBuilder.cs
- SafeNativeMethods.cs
- BooleanAnimationBase.cs
- WebPartDisplayModeCollection.cs
- BufferAllocator.cs
- ApplicationProxyInternal.cs
- ReflectionServiceProvider.cs
- UpDownEvent.cs
- XmlUtilWriter.cs
- ObsoleteAttribute.cs
- TextRangeEdit.cs
- SqlWebEventProvider.cs
- MgmtConfigurationRecord.cs
- DesignerToolStripControlHost.cs
- Missing.cs
- SerializerProvider.cs
- KeyTimeConverter.cs
- SystemColors.cs
- XmlSchemaComplexContentRestriction.cs
- WindowsTab.cs
- SoapTypeAttribute.cs
- EndpointDesigner.cs
- DurableOperationAttribute.cs
- PagePropertiesChangingEventArgs.cs
- ResourceDictionary.cs
- BitVector32.cs
- WebPartCatalogCloseVerb.cs
- AuthStoreRoleProvider.cs
- TitleStyle.cs
- ReadWriteSpinLock.cs
- SafeSystemMetrics.cs
- TimeSpanMinutesConverter.cs
- BitmapFrameDecode.cs
- ToolboxItemFilterAttribute.cs
- OrthographicCamera.cs
- HelloMessageApril2005.cs
- ReadOnlyDataSource.cs
- AsyncOperation.cs