Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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; } } } } // 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.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; } } } } // 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
- Label.cs
- RequestContext.cs
- Inline.cs
- OrderedDictionary.cs
- MessageVersionConverter.cs
- PropertyValueUIItem.cs
- SiteMapNodeCollection.cs
- CodeMemberEvent.cs
- ConfigurationSection.cs
- cookie.cs
- InkPresenter.cs
- TagMapInfo.cs
- WebServiceParameterData.cs
- CacheMemory.cs
- WindowInteractionStateTracker.cs
- serverconfig.cs
- StylusPointDescription.cs
- LocalServiceSecuritySettings.cs
- ComponentGuaranteesAttribute.cs
- CustomValidator.cs
- Vector3dCollection.cs
- StringDictionary.cs
- VSWCFServiceContractGenerator.cs
- GridViewPageEventArgs.cs
- Authorization.cs
- DeflateInput.cs
- SQLGuidStorage.cs
- WebPartUserCapability.cs
- PathFigure.cs
- UrlAuthFailedErrorFormatter.cs
- SystemWebSectionGroup.cs
- XmlSchemaCompilationSettings.cs
- TaiwanLunisolarCalendar.cs
- EndOfStreamException.cs
- JsonWriterDelegator.cs
- DataGridBoolColumn.cs
- ErrorProvider.cs
- entityreference_tresulttype.cs
- TimeSpan.cs
- SortedDictionary.cs
- InOutArgumentConverter.cs
- BuildManager.cs
- ExtensionDataObject.cs
- ParameterReplacerVisitor.cs
- UnsafeNativeMethods.cs
- DispatcherEventArgs.cs
- RadioButtonList.cs
- TextBreakpoint.cs
- ByeOperationAsyncResult.cs
- ToolstripProfessionalRenderer.cs
- peernodeimplementation.cs
- ColorIndependentAnimationStorage.cs
- BinaryObjectWriter.cs
- ReferenceTypeElement.cs
- DataGridAutoFormatDialog.cs
- ImportContext.cs
- ReferentialConstraint.cs
- SystemParameters.cs
- HttpProfileBase.cs
- _ScatterGatherBuffers.cs
- Point3D.cs
- HtmlAnchor.cs
- ZipIOLocalFileHeader.cs
- EndEvent.cs
- ToolStripRenderer.cs
- GroupStyle.cs
- Setter.cs
- DataViewListener.cs
- ActivityTypeResolver.xaml.cs
- ParserExtension.cs
- SmtpCommands.cs
- ProgressChangedEventArgs.cs
- AnonymousIdentificationModule.cs
- CodeIdentifiers.cs
- NewArrayExpression.cs
- FormViewDeletedEventArgs.cs
- FormatterServices.cs
- ConsumerConnectionPointCollection.cs
- DrawingBrush.cs
- CharacterShapingProperties.cs
- ForceCopyBuildProvider.cs
- AnimationClock.cs
- GeometryGroup.cs
- ColorContext.cs
- DataGridViewUtilities.cs
- MembershipPasswordException.cs
- SoundPlayerAction.cs
- MatrixTransform.cs
- SimpleHandlerFactory.cs
- BamlReader.cs
- UniformGrid.cs
- TrackingWorkflowEventArgs.cs
- DBCommand.cs
- NullableBoolConverter.cs
- AttachInfo.cs
- ClassImporter.cs
- XmlILIndex.cs
- Table.cs
- Point4D.cs
- clipboard.cs