Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / System.Runtime.DurableInstancing / System / Runtime / DurableInstancing / InstanceKeyNotReadyException.cs / 1305376 / InstanceKeyNotReadyException.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
namespace System.Runtime.DurableInstancing
{
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Serialization;
using System.Security;
using System.Xml.Linq;
[Serializable]
public class InstanceKeyNotReadyException : InstancePersistenceCommandException
{
const string InstanceKeyName = "instancePersistenceInstanceKey";
public InstanceKeyNotReadyException()
: this(SRCore.KeyNotReadyDefault, null)
{
}
public InstanceKeyNotReadyException(string message)
: this(message, null)
{
}
public InstanceKeyNotReadyException(string message, Exception innerException)
: base(message, innerException)
{
}
public InstanceKeyNotReadyException(XName commandName, InstanceKey instanceKey)
: this(commandName, instanceKey, null)
{
}
public InstanceKeyNotReadyException(XName commandName, InstanceKey instanceKey, Exception innerException)
: this(commandName, Guid.Empty, instanceKey, ToMessage(instanceKey), innerException)
{
}
public InstanceKeyNotReadyException(XName commandName, Guid instanceId, InstanceKey instanceKey, string message, Exception innerException)
: base(commandName, instanceId, message, innerException)
{
InstanceKey = instanceKey;
}
[SecurityCritical]
protected InstanceKeyNotReadyException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Guid guid = (Guid) info.GetValue(InstanceKeyName, typeof(Guid));
InstanceKey = guid == Guid.Empty ? null : new InstanceKey(guid);
}
public InstanceKey InstanceKey { 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(InstanceKeyName, (InstanceKey != null && InstanceKey.IsValid) ? InstanceKey.Value : Guid.Empty, typeof(Guid));
}
static string ToMessage(InstanceKey instanceKey)
{
if (instanceKey != null && instanceKey.IsValid)
{
return SRCore.KeyNotReadySpecific(instanceKey.Value);
}
return SRCore.KeyNotReadyDefault;
}
}
}
// 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
- FlowDocumentScrollViewer.cs
- TextEditorSpelling.cs
- Addressing.cs
- ConfigurationElement.cs
- WindowsStatusBar.cs
- DataGridViewEditingControlShowingEventArgs.cs
- NetDataContractSerializer.cs
- ApplicationActivator.cs
- ComplexObject.cs
- FusionWrap.cs
- ScriptingProfileServiceSection.cs
- SqlCacheDependencySection.cs
- ResponseBodyWriter.cs
- DateTimeOffsetConverter.cs
- ConfigurationManagerHelperFactory.cs
- ReadOnlyDataSource.cs
- XMLUtil.cs
- WindowsButton.cs
- StyleBamlTreeBuilder.cs
- PopOutPanel.cs
- StronglyTypedResourceBuilder.cs
- XamlWrapperReaders.cs
- StructuredProperty.cs
- ChangeDirector.cs
- TextBox.cs
- ActiveDocumentEvent.cs
- CaseStatement.cs
- Gdiplus.cs
- XmlUnspecifiedAttribute.cs
- PathGradientBrush.cs
- Converter.cs
- AvTraceFormat.cs
- HttpWebRequest.cs
- WebServicesDescriptionAttribute.cs
- TypeSystem.cs
- URL.cs
- MimeTypePropertyAttribute.cs
- InputReferenceExpression.cs
- TracedNativeMethods.cs
- WebBrowserNavigatedEventHandler.cs
- Section.cs
- StringUtil.cs
- DataGridPageChangedEventArgs.cs
- EpmSyndicationContentSerializer.cs
- BuildProvidersCompiler.cs
- BuildProvider.cs
- OleDbFactory.cs
- CallbackHandler.cs
- ListBindingConverter.cs
- VarInfo.cs
- formatter.cs
- NameTable.cs
- CreateUserWizardStep.cs
- PropertyNames.cs
- TreeViewAutomationPeer.cs
- WebPartExportVerb.cs
- FileStream.cs
- GlyphRunDrawing.cs
- PopupEventArgs.cs
- ParameterBuilder.cs
- DecoderFallback.cs
- UserControlBuildProvider.cs
- InvalidEnumArgumentException.cs
- EventMappingSettingsCollection.cs
- ProcessStartInfo.cs
- Clipboard.cs
- BitmapCache.cs
- XmlDigitalSignatureProcessor.cs
- WinFormsSecurity.cs
- SimpleExpression.cs
- ParallelTimeline.cs
- CompilationSection.cs
- FormClosingEvent.cs
- OletxTransactionManager.cs
- ObjectDataSourceView.cs
- ClientUrlResolverWrapper.cs
- ReadOnlyDataSource.cs
- MetadataUtilsSmi.cs
- TdsParserSessionPool.cs
- TTSEngineTypes.cs
- GrammarBuilderDictation.cs
- GlyphRun.cs
- _UriSyntax.cs
- GridViewRowEventArgs.cs
- SqlMethodAttribute.cs
- ModelToObjectValueConverter.cs
- UrlMappingsModule.cs
- WriteableBitmap.cs
- SolidBrush.cs
- ParallelTimeline.cs
- TextRangeBase.cs
- RtfToken.cs
- PerformanceCounterPermission.cs
- StylusLogic.cs
- ElementHostPropertyMap.cs
- ZoneLinkButton.cs
- ConcurrencyMode.cs
- Internal.cs
- DataGridViewColumnConverter.cs
- SourceFileInfo.cs