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
- MSAANativeProvider.cs
- ClientSettings.cs
- Hash.cs
- UpdatePanelTriggerCollection.cs
- InvocationExpression.cs
- _DomainName.cs
- ImageAutomationPeer.cs
- BitmapData.cs
- XmlDataSource.cs
- AutoResetEvent.cs
- SocketInformation.cs
- DotExpr.cs
- ObjectSelectorEditor.cs
- ButtonStandardAdapter.cs
- DBSchemaTable.cs
- MemberBinding.cs
- LayoutEvent.cs
- VersionedStreamOwner.cs
- HWStack.cs
- DetailsViewUpdateEventArgs.cs
- RootBrowserWindowAutomationPeer.cs
- SchemaImporterExtension.cs
- _NestedSingleAsyncResult.cs
- MailWriter.cs
- ConsoleCancelEventArgs.cs
- Stacktrace.cs
- DataMemberListEditor.cs
- WebPartManager.cs
- SqlClientWrapperSmiStream.cs
- WebPartTransformerAttribute.cs
- SelectionPattern.cs
- MethodImplAttribute.cs
- SafeThemeHandle.cs
- ObjectDataSourceSelectingEventArgs.cs
- StreamWriter.cs
- ArrayWithOffset.cs
- SqlConnection.cs
- MimeWriter.cs
- CompModSwitches.cs
- SessionStateItemCollection.cs
- StateFinalizationActivity.cs
- HtmlToClrEventProxy.cs
- HtmlShim.cs
- FunctionDescription.cs
- GlobalAllocSafeHandle.cs
- GradientStopCollection.cs
- GenericQueueSurrogate.cs
- UnauthorizedWebPart.cs
- ContentPlaceHolder.cs
- ContourSegment.cs
- FormViewInsertedEventArgs.cs
- ArrayTypeMismatchException.cs
- PrinterSettings.cs
- Stylus.cs
- SyndicationFeed.cs
- SqlConnectionString.cs
- DelegatingConfigHost.cs
- SoapAttributes.cs
- WebPartTracker.cs
- TreeNodeStyle.cs
- TreePrinter.cs
- QuaternionRotation3D.cs
- GacUtil.cs
- URLBuilder.cs
- PlatformCulture.cs
- XmlProcessingInstruction.cs
- ValidationHelper.cs
- TextSpan.cs
- WsatServiceAddress.cs
- PeerChannelListener.cs
- ControlBuilder.cs
- Stacktrace.cs
- CommonXSendMessage.cs
- ActionMessageFilterTable.cs
- _KerberosClient.cs
- dsa.cs
- ObjectItemCollection.cs
- ServiceReference.cs
- TextTreeUndoUnit.cs
- ScriptControlDescriptor.cs
- LoginCancelEventArgs.cs
- UserInitiatedNavigationPermission.cs
- VisualBasicSettings.cs
- ContentElementCollection.cs
- InfoCardArgumentException.cs
- HtmlGenericControl.cs
- Html32TextWriter.cs
- AnimatedTypeHelpers.cs
- DetailsViewInsertedEventArgs.cs
- ObjectDataSourceChooseTypePanel.cs
- XmlRootAttribute.cs
- SelectionListDesigner.cs
- SecurityManager.cs
- VirtualPathProvider.cs
- DataTableReaderListener.cs
- BulletedListEventArgs.cs
- DynamicQueryStringParameter.cs
- StringSource.cs
- EditorServiceContext.cs
- BamlVersionHeader.cs