Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- WindowsFormsSectionHandler.cs
- IntellisenseTextBox.cs
- ContainerFilterService.cs
- ModelTreeEnumerator.cs
- Block.cs
- Converter.cs
- TemplateBaseAction.cs
- ListenerElementsCollection.cs
- DescriptionAttribute.cs
- DbProviderManifest.cs
- DataGridViewRowsAddedEventArgs.cs
- InvokeBinder.cs
- OleTxTransaction.cs
- figurelength.cs
- sqlpipe.cs
- AspProxy.cs
- Wow64ConfigurationLoader.cs
- SectionVisual.cs
- ISSmlParser.cs
- RequestTimeoutManager.cs
- RegexStringValidator.cs
- Accessible.cs
- GeneralTransformGroup.cs
- XmlSchemaType.cs
- PhoneCall.cs
- RowSpanVector.cs
- FontFamilyValueSerializer.cs
- EntityDescriptor.cs
- PointKeyFrameCollection.cs
- HostingEnvironmentWrapper.cs
- XPathAncestorQuery.cs
- OracleDataAdapter.cs
- Message.cs
- DependentList.cs
- PrivateFontCollection.cs
- XmlTextReaderImplHelpers.cs
- MonitoringDescriptionAttribute.cs
- StringInfo.cs
- PatternMatchRules.cs
- ImageListDesigner.cs
- StorageModelBuildProvider.cs
- DragEventArgs.cs
- DataViewManager.cs
- XmlSchemaSimpleTypeUnion.cs
- NameScope.cs
- SimpleMailWebEventProvider.cs
- UInt32.cs
- GregorianCalendar.cs
- XPathMultyIterator.cs
- ScrollChrome.cs
- XmlSchemaSimpleContent.cs
- DoubleAnimation.cs
- DataGridViewColumnConverter.cs
- QilNode.cs
- TCEAdapterGenerator.cs
- StringBlob.cs
- SpeechDetectedEventArgs.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- NotCondition.cs
- HtmlTernaryTree.cs
- CultureSpecificCharacterBufferRange.cs
- ItemCheckEvent.cs
- DbTransaction.cs
- KeySpline.cs
- LazyInitializer.cs
- DesignerActionVerbItem.cs
- EditCommandColumn.cs
- LinearQuaternionKeyFrame.cs
- Action.cs
- Application.cs
- TextParagraphView.cs
- StylusSystemGestureEventArgs.cs
- ByeOperationCD1AsyncResult.cs
- FloatAverageAggregationOperator.cs
- keycontainerpermission.cs
- SmtpNtlmAuthenticationModule.cs
- UnmanagedBitmapWrapper.cs
- VerificationAttribute.cs
- DesignerVerbToolStripMenuItem.cs
- PeerInvitationResponse.cs
- NameSpaceExtractor.cs
- NativeMethods.cs
- ExpressionTable.cs
- ListViewGroupItemCollection.cs
- IpcChannelHelper.cs
- PathGeometry.cs
- XmlFormatExtensionPointAttribute.cs
- TextElementCollectionHelper.cs
- TypefaceCollection.cs
- Misc.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- FormsAuthenticationTicket.cs
- SafeTokenHandle.cs
- AuthenticationService.cs
- WindowsImpersonationContext.cs
- RotateTransform3D.cs
- TokenBasedSetEnumerator.cs
- StringArrayConverter.cs
- FtpWebResponse.cs
- Token.cs