Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- RadioButtonFlatAdapter.cs
- UpdateException.cs
- EnumConverter.cs
- SqlMetaData.cs
- TempEnvironment.cs
- DesigntimeLicenseContextSerializer.cs
- updatecommandorderer.cs
- EnterpriseServicesHelper.cs
- RequestCachePolicyConverter.cs
- WindowsPen.cs
- SafeEventHandle.cs
- CodeDelegateCreateExpression.cs
- _OverlappedAsyncResult.cs
- RootAction.cs
- AppSettingsReader.cs
- BinaryWriter.cs
- IgnoreDeviceFilterElement.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- messageonlyhwndwrapper.cs
- SqlMethods.cs
- BindingNavigator.cs
- EmptyEnumerator.cs
- ListViewContainer.cs
- LineBreakRecord.cs
- RankException.cs
- WorkflowViewManager.cs
- EncodingTable.cs
- BaseTemplatedMobileComponentEditor.cs
- Vector3DCollection.cs
- DeferrableContentConverter.cs
- RegistrySecurity.cs
- base64Transforms.cs
- ClientTarget.cs
- CqlLexer.cs
- XmlSubtreeReader.cs
- SourceFileInfo.cs
- GACMembershipCondition.cs
- Bezier.cs
- CollectionBase.cs
- DesignerUtility.cs
- Message.cs
- BindingWorker.cs
- UnmanagedMemoryStream.cs
- util.cs
- StringUtil.cs
- ImpersonateTokenRef.cs
- ThicknessAnimationUsingKeyFrames.cs
- DataPagerCommandEventArgs.cs
- ThreadAbortException.cs
- DefaultTypeArgumentAttribute.cs
- FormsAuthenticationTicket.cs
- BindingElementCollection.cs
- IntSecurity.cs
- ContentDisposition.cs
- _StreamFramer.cs
- FrameworkObject.cs
- DuplicateWaitObjectException.cs
- validationstate.cs
- WebBaseEventKeyComparer.cs
- BackStopAuthenticationModule.cs
- RemoteEndpointMessageProperty.cs
- XmlSignatureManifest.cs
- AsymmetricSignatureDeformatter.cs
- XPathNodeInfoAtom.cs
- SevenBitStream.cs
- CollectionType.cs
- AuthenticationManager.cs
- DataMemberFieldEditor.cs
- TreeNode.cs
- ModifiableIteratorCollection.cs
- RegexRunnerFactory.cs
- InternalSafeNativeMethods.cs
- StretchValidation.cs
- StringToken.cs
- TypeElement.cs
- SettingsPropertyCollection.cs
- OleAutBinder.cs
- ProviderBase.cs
- DelimitedListTraceListener.cs
- PasswordRecoveryAutoFormat.cs
- WebPartDisplayModeEventArgs.cs
- IDataContractSurrogate.cs
- X509Certificate2Collection.cs
- EntityException.cs
- AutomationPropertyInfo.cs
- MultiView.cs
- IndexedString.cs
- StrokeNodeEnumerator.cs
- ObjectHandle.cs
- XmlException.cs
- FilteredReadOnlyMetadataCollection.cs
- OleDbTransaction.cs
- DnsElement.cs
- SignedPkcs7.cs
- ViewGenResults.cs
- LocatorPartList.cs
- HtmlInputText.cs
- SecurityTokenSerializer.cs
- CodeLabeledStatement.cs
- FuncCompletionCallbackWrapper.cs