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
- SmtpCommands.cs
- CqlErrorHelper.cs
- Int32Rect.cs
- EncoderBestFitFallback.cs
- CrossAppDomainChannel.cs
- MonitoringDescriptionAttribute.cs
- Point4DConverter.cs
- ByteAnimationUsingKeyFrames.cs
- MultiSelector.cs
- SchemaElement.cs
- MachineKeyConverter.cs
- M3DUtil.cs
- ElementNotEnabledException.cs
- UInt32.cs
- EntityDataSourceQueryBuilder.cs
- NonParentingControl.cs
- TypeBuilderInstantiation.cs
- TextAction.cs
- InputManager.cs
- HelpProvider.cs
- RequestCachePolicyConverter.cs
- ScriptingScriptResourceHandlerSection.cs
- FormViewCommandEventArgs.cs
- WindowInteropHelper.cs
- DBAsyncResult.cs
- SQLDouble.cs
- GACIdentityPermission.cs
- TypeNameConverter.cs
- FunctionImportElement.cs
- jithelpers.cs
- UriTemplatePathSegment.cs
- PassportAuthenticationEventArgs.cs
- followingquery.cs
- TextBox.cs
- CommonGetThemePartSize.cs
- SqlLiftIndependentRowExpressions.cs
- SQLBinary.cs
- ObjectAnimationBase.cs
- AggregateException.cs
- ZipIOLocalFileBlock.cs
- Configuration.cs
- WebPartAuthorizationEventArgs.cs
- Utils.cs
- DefaultBinder.cs
- ServiceControllerDesigner.cs
- StylusPointPropertyInfo.cs
- TriggerCollection.cs
- UnhandledExceptionEventArgs.cs
- PrintPreviewControl.cs
- SerializationHelper.cs
- TraceSection.cs
- NullableDecimalAverageAggregationOperator.cs
- EntityContainerEntitySet.cs
- TrustSection.cs
- PointKeyFrameCollection.cs
- ToolStripSettings.cs
- BlurBitmapEffect.cs
- COM2ExtendedBrowsingHandler.cs
- WebPartAuthorizationEventArgs.cs
- MeasureItemEvent.cs
- BitArray.cs
- Range.cs
- OpenTypeLayout.cs
- ToolBarPanel.cs
- DataRecordInfo.cs
- OutputWindow.cs
- FontCacheUtil.cs
- RtfToXamlReader.cs
- ObjectDisposedException.cs
- BitmapCodecInfoInternal.cs
- DeviceContext2.cs
- DBParameter.cs
- SizeAnimationClockResource.cs
- XmlSchemaSimpleContent.cs
- SystemColorTracker.cs
- DoubleAnimation.cs
- precedingsibling.cs
- ResXDataNode.cs
- DataGridTable.cs
- Clause.cs
- AppSettingsReader.cs
- Line.cs
- KeySpline.cs
- GridViewSelectEventArgs.cs
- SecurityContext.cs
- SqlCacheDependencyDatabase.cs
- UxThemeWrapper.cs
- DictionarySectionHandler.cs
- dbenumerator.cs
- OdbcDataAdapter.cs
- ReferenceSchema.cs
- UnionExpr.cs
- RuntimeEnvironment.cs
- ListControl.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- ConfigXmlReader.cs
- SelectionPattern.cs
- TypeLibConverter.cs
- FieldBuilder.cs
- TextEvent.cs