Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebParts / PersonalizationStateQuery.cs / 1305376 / 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.Web.Util; [Serializable] 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; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // 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.Web.Util; [Serializable] 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; } } } } // 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
- DropSource.cs
- FreeFormPanel.cs
- SessionStateUtil.cs
- RadioButton.cs
- EncodingNLS.cs
- EmbeddedMailObjectsCollection.cs
- ScaleTransform3D.cs
- Vector3D.cs
- LineGeometry.cs
- CodeValidator.cs
- HelpInfo.cs
- TimeStampChecker.cs
- AssociationType.cs
- MouseGestureValueSerializer.cs
- Soap12FormatExtensions.cs
- elementinformation.cs
- CodeNamespaceImportCollection.cs
- PartBasedPackageProperties.cs
- FrameworkEventSource.cs
- GenericUI.cs
- TableColumnCollection.cs
- DropDownList.cs
- QueuePathDialog.cs
- TextCharacters.cs
- XhtmlBasicValidationSummaryAdapter.cs
- FontCollection.cs
- ConfigXmlComment.cs
- TextBoxBase.cs
- AspNetHostingPermission.cs
- ConfigurationFileMap.cs
- ToolStripSplitButton.cs
- EndEvent.cs
- PropertyItem.cs
- SocketElement.cs
- RuntimeConfig.cs
- FlowLayout.cs
- SmtpSection.cs
- PixelShader.cs
- FragmentQuery.cs
- ComponentEvent.cs
- AttachedAnnotationChangedEventArgs.cs
- LassoHelper.cs
- FragmentNavigationEventArgs.cs
- GeneralTransform3DTo2DTo3D.cs
- AddingNewEventArgs.cs
- ContextMarshalException.cs
- XmlNamespaceMapping.cs
- ExpressionCopier.cs
- SchemaCollectionPreprocessor.cs
- ExternalCalls.cs
- FilteredDataSetHelper.cs
- EncryptedType.cs
- CSharpCodeProvider.cs
- ContainerActivationHelper.cs
- Merger.cs
- XmlUtf8RawTextWriter.cs
- ConditionCollection.cs
- Console.cs
- ErasingStroke.cs
- SelectedDatesCollection.cs
- WpfGeneratedKnownProperties.cs
- RelationshipEndCollection.cs
- RuleAction.cs
- SqlRecordBuffer.cs
- DataContext.cs
- Directory.cs
- TranslateTransform3D.cs
- ForeignKeyConstraint.cs
- ConvertersCollection.cs
- HtmlHead.cs
- ErrorEventArgs.cs
- ServiceDeploymentInfo.cs
- EnumValAlphaComparer.cs
- Size3DValueSerializer.cs
- BamlBinaryReader.cs
- UpdatePanelControlTrigger.cs
- UserControlAutomationPeer.cs
- PathData.cs
- OleDbPermission.cs
- VScrollBar.cs
- AsymmetricSignatureFormatter.cs
- HtmlUtf8RawTextWriter.cs
- Substitution.cs
- ParentQuery.cs
- TextChangedEventArgs.cs
- FlowLayoutPanel.cs
- StorageInfo.cs
- DateTimeOffsetStorage.cs
- CoreSwitches.cs
- CursorInteropHelper.cs
- Deserializer.cs
- MulticastIPAddressInformationCollection.cs
- UniformGrid.cs
- Emitter.cs
- UnsafeNativeMethodsCLR.cs
- OdbcPermission.cs
- ParenthesizePropertyNameAttribute.cs
- PrintPreviewControl.cs
- configsystem.cs
- FramingDecoders.cs