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
- _HeaderInfoTable.cs
- SqlInfoMessageEvent.cs
- TemplatedMailWebEventProvider.cs
- DataSourceHelper.cs
- InputScope.cs
- Queue.cs
- XmlIncludeAttribute.cs
- DataPagerFieldCommandEventArgs.cs
- ProfilePropertyMetadata.cs
- Stroke2.cs
- SmiMetaData.cs
- SqlFacetAttribute.cs
- HttpResponseWrapper.cs
- MatrixTransform3D.cs
- LineServices.cs
- DateTimeValueSerializer.cs
- PeerObject.cs
- LineGeometry.cs
- Wildcard.cs
- EnumType.cs
- Soap11ServerProtocol.cs
- EncodingStreamWrapper.cs
- FormsAuthentication.cs
- HyperLinkColumn.cs
- EditBehavior.cs
- SharedDp.cs
- IsolatedStorage.cs
- SinglePhaseEnlistment.cs
- DataGridViewUtilities.cs
- EditBehavior.cs
- CompilerError.cs
- TextParaClient.cs
- ImageDrawing.cs
- RequestDescription.cs
- KeyValueSerializer.cs
- DataGridViewCellPaintingEventArgs.cs
- CustomBindingElementCollection.cs
- OptimalBreakSession.cs
- SamlAssertion.cs
- safesecurityhelperavalon.cs
- ModuleBuilder.cs
- SmiRecordBuffer.cs
- HostedElements.cs
- SafeViewOfFileHandle.cs
- DescendantOverDescendantQuery.cs
- HtmlInputFile.cs
- IndentedTextWriter.cs
- ValueSerializerAttribute.cs
- EntityDataReader.cs
- HandlerBase.cs
- StylusTip.cs
- ConstraintEnumerator.cs
- ModelVisual3D.cs
- TableParaClient.cs
- GlyphInfoList.cs
- DbDataAdapter.cs
- ImageListImageEditor.cs
- UserPreferenceChangedEventArgs.cs
- CodeIterationStatement.cs
- ExpandSegment.cs
- UnmanagedMarshal.cs
- MessageBuffer.cs
- WindowsListViewItemCheckBox.cs
- Splitter.cs
- ContainerActivationHelper.cs
- MatrixTransform3D.cs
- _ChunkParse.cs
- CryptoHandle.cs
- OdbcCommand.cs
- InitializationEventAttribute.cs
- PrimitiveSchema.cs
- AppSettingsReader.cs
- ObjectAnimationUsingKeyFrames.cs
- Update.cs
- SimpleHandlerFactory.cs
- DateTimeValueSerializerContext.cs
- CodeDirectoryCompiler.cs
- WebPartsSection.cs
- ImpersonateTokenRef.cs
- ImageButton.cs
- SecurityToken.cs
- ParserContext.cs
- PublisherMembershipCondition.cs
- IdentityManager.cs
- SimpleWorkerRequest.cs
- TypeBuilder.cs
- Base64Decoder.cs
- HeaderPanel.cs
- WorkflowRequestContext.cs
- webeventbuffer.cs
- ContentPlaceHolder.cs
- XmlQueryRuntime.cs
- ArgumentOutOfRangeException.cs
- DocumentGridContextMenu.cs
- HttpProfileGroupBase.cs
- SpellerInterop.cs
- XmlSchemaInferenceException.cs
- FaultPropagationQuery.cs
- ThicknessAnimationUsingKeyFrames.cs
- HwndSource.cs