Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / System.Runtime.DurableInstancing / System / Runtime / DurableInstancing / InstanceLockedException.cs / 1305376 / InstanceLockedException.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.Runtime.DurableInstancing { using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Runtime.Serialization; using System.Security; using System.Xml.Linq; [Serializable] public class InstanceLockedException : InstancePersistenceCommandException { const string InstanceOwnerIdName = "instancePersistenceInstanceOwnerId"; const string SerializableInstanceOwnerMetadataName = "instancePersistenceSerializableInstanceOwnerMetadata"; public InstanceLockedException() : this(SRCore.CannotAcquireLockDefault, null) { } public InstanceLockedException(string message) : this(message, null) { } public InstanceLockedException(string message, Exception innerException) : base(message, innerException) { } public InstanceLockedException(XName commandName, Guid instanceId) : this(commandName, instanceId, null) { } public InstanceLockedException(XName commandName, Guid instanceId, Exception innerException) : this(commandName, instanceId, ToMessage(instanceId), innerException) { } public InstanceLockedException(XName commandName, Guid instanceId, string message, Exception innerException) : this(commandName, instanceId, Guid.Empty, null, message, innerException) { } public InstanceLockedException(XName commandName, Guid instanceId, Guid instanceOwnerId, IDictionaryserializableInstanceOwnerMetadata) : this(commandName, instanceId, instanceOwnerId, serializableInstanceOwnerMetadata, null) { } public InstanceLockedException(XName commandName, Guid instanceId, Guid instanceOwnerId, IDictionary serializableInstanceOwnerMetadata, Exception innerException) : this(commandName, instanceId, instanceOwnerId, serializableInstanceOwnerMetadata, ToMessage(instanceId, instanceOwnerId), innerException) { } // Copying the dictionary snapshots it and makes sure the IDictionary implementation is serializable. public InstanceLockedException(XName commandName, Guid instanceId, Guid instanceOwnerId, IDictionary serializableInstanceOwnerMetadata, string message, Exception innerException) : base(commandName, instanceId, message, innerException) { InstanceOwnerId = instanceOwnerId; if (serializableInstanceOwnerMetadata != null) { SerializableInstanceOwnerMetadata = new ReadOnlyDictionary (serializableInstanceOwnerMetadata); } } [SecurityCritical] protected InstanceLockedException(SerializationInfo info, StreamingContext context) : base(info, context) { InstanceOwnerId = (Guid) info.GetValue(InstanceOwnerIdName, typeof(Guid)); SerializableInstanceOwnerMetadata = (ReadOnlyDictionary ) info.GetValue(SerializableInstanceOwnerMetadataName, typeof(ReadOnlyDictionary )); } public Guid InstanceOwnerId { get; private set; } public IDictionary SerializableInstanceOwnerMetadata { get; private set; } [Fx.Tag.SecurityNote(Critical = "Overrides critical inherited method")] [SecurityCritical] [SuppressMessage(FxCop.Category.Security, FxCop.Rule.SecureGetObjectDataOverrides, Justification = "Method is SecurityCritical")] public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue(InstanceOwnerIdName, InstanceOwnerId, typeof(Guid)); info.AddValue(SerializableInstanceOwnerMetadataName, SerializableInstanceOwnerMetadata, typeof(ReadOnlyDictionary )); } static string ToMessage(Guid instanceId) { if (instanceId == Guid.Empty) { return SRCore.CannotAcquireLockDefault; } return SRCore.CannotAcquireLockSpecific(instanceId); } static string ToMessage(Guid instanceId, Guid instanceOwnerId) { if (instanceId == Guid.Empty) { return SRCore.CannotAcquireLockDefault; } if (instanceOwnerId == Guid.Empty) { return SRCore.CannotAcquireLockSpecific(instanceId); } return SRCore.CannotAcquireLockSpecificWithOwner(instanceId, instanceOwnerId); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.Runtime.DurableInstancing { using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Runtime.Serialization; using System.Security; using System.Xml.Linq; [Serializable] public class InstanceLockedException : InstancePersistenceCommandException { const string InstanceOwnerIdName = "instancePersistenceInstanceOwnerId"; const string SerializableInstanceOwnerMetadataName = "instancePersistenceSerializableInstanceOwnerMetadata"; public InstanceLockedException() : this(SRCore.CannotAcquireLockDefault, null) { } public InstanceLockedException(string message) : this(message, null) { } public InstanceLockedException(string message, Exception innerException) : base(message, innerException) { } public InstanceLockedException(XName commandName, Guid instanceId) : this(commandName, instanceId, null) { } public InstanceLockedException(XName commandName, Guid instanceId, Exception innerException) : this(commandName, instanceId, ToMessage(instanceId), innerException) { } public InstanceLockedException(XName commandName, Guid instanceId, string message, Exception innerException) : this(commandName, instanceId, Guid.Empty, null, message, innerException) { } public InstanceLockedException(XName commandName, Guid instanceId, Guid instanceOwnerId, IDictionary serializableInstanceOwnerMetadata) : this(commandName, instanceId, instanceOwnerId, serializableInstanceOwnerMetadata, null) { } public InstanceLockedException(XName commandName, Guid instanceId, Guid instanceOwnerId, IDictionary serializableInstanceOwnerMetadata, Exception innerException) : this(commandName, instanceId, instanceOwnerId, serializableInstanceOwnerMetadata, ToMessage(instanceId, instanceOwnerId), innerException) { } // Copying the dictionary snapshots it and makes sure the IDictionary implementation is serializable. public InstanceLockedException(XName commandName, Guid instanceId, Guid instanceOwnerId, IDictionary serializableInstanceOwnerMetadata, string message, Exception innerException) : base(commandName, instanceId, message, innerException) { InstanceOwnerId = instanceOwnerId; if (serializableInstanceOwnerMetadata != null) { SerializableInstanceOwnerMetadata = new ReadOnlyDictionary (serializableInstanceOwnerMetadata); } } [SecurityCritical] protected InstanceLockedException(SerializationInfo info, StreamingContext context) : base(info, context) { InstanceOwnerId = (Guid) info.GetValue(InstanceOwnerIdName, typeof(Guid)); SerializableInstanceOwnerMetadata = (ReadOnlyDictionary ) info.GetValue(SerializableInstanceOwnerMetadataName, typeof(ReadOnlyDictionary )); } public Guid InstanceOwnerId { get; private set; } public IDictionary SerializableInstanceOwnerMetadata { get; private set; } [Fx.Tag.SecurityNote(Critical = "Overrides critical inherited method")] [SecurityCritical] [SuppressMessage(FxCop.Category.Security, FxCop.Rule.SecureGetObjectDataOverrides, Justification = "Method is SecurityCritical")] public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue(InstanceOwnerIdName, InstanceOwnerId, typeof(Guid)); info.AddValue(SerializableInstanceOwnerMetadataName, SerializableInstanceOwnerMetadata, typeof(ReadOnlyDictionary )); } static string ToMessage(Guid instanceId) { if (instanceId == Guid.Empty) { return SRCore.CannotAcquireLockDefault; } return SRCore.CannotAcquireLockSpecific(instanceId); } static string ToMessage(Guid instanceId, Guid instanceOwnerId) { if (instanceId == Guid.Empty) { return SRCore.CannotAcquireLockDefault; } if (instanceOwnerId == Guid.Empty) { return SRCore.CannotAcquireLockSpecific(instanceId); } return SRCore.CannotAcquireLockSpecificWithOwner(instanceId, instanceOwnerId); } } } // 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
- AlternateView.cs
- MD5HashHelper.cs
- EntityCommandCompilationException.cs
- PeerResolverElement.cs
- IntegerValidator.cs
- xml.cs
- XmlKeywords.cs
- SqlCommand.cs
- SqlDataSourceStatusEventArgs.cs
- Int64Converter.cs
- HierarchicalDataBoundControl.cs
- DummyDataSource.cs
- RangeValuePattern.cs
- UserMapPath.cs
- NativeMethodsOther.cs
- RIPEMD160Managed.cs
- HttpWriter.cs
- ValidatingPropertiesEventArgs.cs
- Drawing.cs
- DesignSurfaceCollection.cs
- NotFiniteNumberException.cs
- CapabilitiesState.cs
- Clipboard.cs
- SoapMessage.cs
- ComplusEndpointConfigContainer.cs
- SystemIcmpV4Statistics.cs
- ButtonStandardAdapter.cs
- _LocalDataStoreMgr.cs
- VisualTarget.cs
- ActivationWorker.cs
- TemplateManager.cs
- PassportPrincipal.cs
- TemplateBamlRecordReader.cs
- Operator.cs
- _StreamFramer.cs
- ReadOnlyCollectionBase.cs
- CodeStatementCollection.cs
- RawStylusSystemGestureInputReport.cs
- CommandConverter.cs
- CryptoKeySecurity.cs
- WebPartActionVerb.cs
- isolationinterop.cs
- DependencyPropertyConverter.cs
- EventListenerClientSide.cs
- TraceEventCache.cs
- LoginViewDesigner.cs
- EntityWrapperFactory.cs
- XPathAncestorIterator.cs
- SoapIgnoreAttribute.cs
- StylusSystemGestureEventArgs.cs
- DataSourceControlBuilder.cs
- ButtonStandardAdapter.cs
- Int64Animation.cs
- ObjectRef.cs
- Operators.cs
- FileSystemEventArgs.cs
- TreeNodeClickEventArgs.cs
- ISAPIApplicationHost.cs
- SelectedGridItemChangedEvent.cs
- TextAnchor.cs
- DataGridHeaderBorder.cs
- IDictionary.cs
- RenderTargetBitmap.cs
- DoubleUtil.cs
- SerializationUtility.cs
- RectAnimationUsingKeyFrames.cs
- TextElement.cs
- Timer.cs
- RuntimeArgumentHandle.cs
- ObjectDataSourceEventArgs.cs
- Base64Stream.cs
- FixedHyperLink.cs
- QueryValue.cs
- DependencyObjectCodeDomSerializer.cs
- Rect3D.cs
- DeflateInput.cs
- KeyConverter.cs
- GrammarBuilderDictation.cs
- HttpClientCertificate.cs
- BuiltInExpr.cs
- EntityDataSourceChangingEventArgs.cs
- Separator.cs
- Table.cs
- SvcMapFileSerializer.cs
- WindowsProgressbar.cs
- CodeConstructor.cs
- BookmarkManager.cs
- ClientBuildManager.cs
- Point3DValueSerializer.cs
- SimpleWorkerRequest.cs
- ColumnMapCopier.cs
- CodeDOMProvider.cs
- PenLineCapValidation.cs
- LongValidator.cs
- DeclaredTypeValidator.cs
- ComplexTypeEmitter.cs
- Point3D.cs
- DataGridViewAutoSizeModeEventArgs.cs
- SystemIPGlobalStatistics.cs
- SettingsPropertyCollection.cs