Code:
/ FX-1434 / FX-1434 / 1.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
- PathFigureCollection.cs
- StateMachineSubscriptionManager.cs
- ListBase.cs
- SwitchElementsCollection.cs
- SmiRequestExecutor.cs
- JsonQNameDataContract.cs
- TraceContextEventArgs.cs
- DateTimeConverter.cs
- ModulesEntry.cs
- EventBindingService.cs
- SimpleBitVector32.cs
- Fonts.cs
- MetadataItem.cs
- Int64Converter.cs
- ColorConvertedBitmapExtension.cs
- MemberAssignmentAnalysis.cs
- TextEditorMouse.cs
- EntityViewGenerationConstants.cs
- Int64KeyFrameCollection.cs
- SrgsSubset.cs
- SerializationAttributes.cs
- PreProcessInputEventArgs.cs
- IResourceProvider.cs
- SuppressMessageAttribute.cs
- GroupBoxRenderer.cs
- OptimizerPatterns.cs
- DesignerActionItemCollection.cs
- XPathArrayIterator.cs
- DependencyPropertyConverter.cs
- AudioBase.cs
- ModelUIElement3D.cs
- ConnectionManagementSection.cs
- AddInAttribute.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- DefaultClaimSet.cs
- SetIndexBinder.cs
- RemotingConfiguration.cs
- linebase.cs
- WCFServiceClientProxyGenerator.cs
- Rectangle.cs
- InvokeAction.cs
- EnumConverter.cs
- NetTcpSecurity.cs
- X509SubjectKeyIdentifierClause.cs
- HandlerBase.cs
- Options.cs
- ClientUtils.cs
- UInt16Converter.cs
- InternalConfirm.cs
- BitStack.cs
- NavigationCommands.cs
- UnsafeNativeMethods.cs
- GeometryModel3D.cs
- FormViewPagerRow.cs
- BulletChrome.cs
- TraversalRequest.cs
- XmlArrayItemAttribute.cs
- SequenceDesignerAccessibleObject.cs
- LinqDataSourceHelper.cs
- CngAlgorithmGroup.cs
- SmiRecordBuffer.cs
- RuntimeEnvironment.cs
- QueryCoreOp.cs
- DataSourceProvider.cs
- Item.cs
- DataGridItemAttachedStorage.cs
- ChangeDirector.cs
- EmissiveMaterial.cs
- Resources.Designer.cs
- TextView.cs
- BuildProviderAppliesToAttribute.cs
- FileVersion.cs
- DbConnectionClosed.cs
- Itemizer.cs
- TabControlAutomationPeer.cs
- HtmlInputHidden.cs
- CqlParserHelpers.cs
- MostlySingletonList.cs
- DbDataRecord.cs
- ActivityInstance.cs
- EventLogger.cs
- UIElement.cs
- CompilationUnit.cs
- WebPartMovingEventArgs.cs
- StorageModelBuildProvider.cs
- AlignmentYValidation.cs
- CodeRegionDirective.cs
- ConfigXmlComment.cs
- UnsafeNativeMethods.cs
- OpCodes.cs
- AccessKeyManager.cs
- RelativeSource.cs
- FormsAuthentication.cs
- RelationshipConstraintValidator.cs
- PersistenceTypeAttribute.cs
- BaseParser.cs
- NonPrimarySelectionGlyph.cs
- DataRecord.cs
- DataGridToolTip.cs
- AsymmetricKeyExchangeDeformatter.cs