You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@@ -0,0 +1,51 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.DurableInstancing
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime;
|
||||
using System.Runtime.Collections;
|
||||
using System.Runtime.DurableInstancing;
|
||||
using System.Xml.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
[Fx.Tag.XamlVisible(false)]
|
||||
public sealed class ActivatableWorkflowsQueryResult : InstanceStoreQueryResult
|
||||
{
|
||||
static readonly ReadOnlyDictionaryInternal<XName, object> emptyDictionary = new ReadOnlyDictionaryInternal<XName, object>(new Dictionary<XName, object>(0));
|
||||
|
||||
public ActivatableWorkflowsQueryResult()
|
||||
{
|
||||
ActivationParameters = new List<IDictionary<XName, object>>(0);
|
||||
}
|
||||
|
||||
public ActivatableWorkflowsQueryResult(IDictionary<XName, object> parameters)
|
||||
{
|
||||
ActivationParameters = new List<IDictionary<XName, object>>
|
||||
{ parameters == null ? ActivatableWorkflowsQueryResult.emptyDictionary : new ReadOnlyDictionaryInternal<XName, object>(new Dictionary<XName, object>(parameters)) };
|
||||
}
|
||||
|
||||
public ActivatableWorkflowsQueryResult(IEnumerable<IDictionary<XName, object>> parameters)
|
||||
{
|
||||
if (parameters == null)
|
||||
{
|
||||
ActivationParameters = new List<IDictionary<XName, object>>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ActivationParameters = new List<IDictionary<XName, object>>(parameters.Select(dictionary =>
|
||||
dictionary == null ? ActivatableWorkflowsQueryResult.emptyDictionary : new ReadOnlyDictionaryInternal<XName, object>(new Dictionary<XName, object>(dictionary))));
|
||||
}
|
||||
}
|
||||
|
||||
public List<IDictionary<XName, object>> ActivationParameters
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.DurableInstancing
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime;
|
||||
using System.Runtime.DurableInstancing;
|
||||
using System.Xml.Linq;
|
||||
|
||||
[Fx.Tag.XamlVisible(false)]
|
||||
public sealed class CreateWorkflowOwnerCommand : InstancePersistenceCommand
|
||||
{
|
||||
Dictionary<XName, InstanceValue> instanceOwnerMetadata;
|
||||
|
||||
public CreateWorkflowOwnerCommand()
|
||||
: base(InstancePersistence.ActivitiesCommandNamespace.GetName("CreateWorkflowOwner"))
|
||||
{
|
||||
}
|
||||
|
||||
public IDictionary<XName, InstanceValue> InstanceOwnerMetadata
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.instanceOwnerMetadata == null)
|
||||
{
|
||||
this.instanceOwnerMetadata = new Dictionary<XName, InstanceValue>();
|
||||
}
|
||||
return this.instanceOwnerMetadata;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override bool IsTransactionEnlistmentOptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.instanceOwnerMetadata == null || this.instanceOwnerMetadata.Count == 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override void Validate(InstanceView view)
|
||||
{
|
||||
if (view.IsBoundToInstanceOwner)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.AlreadyBoundToOwner));
|
||||
}
|
||||
InstancePersistence.ValidatePropertyBag(this.instanceOwnerMetadata);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
// <copyright>
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace System.Activities.DurableInstancing
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime;
|
||||
using System.Runtime.DurableInstancing;
|
||||
using System.Xml.Linq;
|
||||
|
||||
[Fx.Tag.XamlVisible(false)]
|
||||
public sealed class CreateWorkflowOwnerWithIdentityCommand : InstancePersistenceCommand
|
||||
{
|
||||
Dictionary<XName, InstanceValue> instanceOwnerMetadata;
|
||||
|
||||
public CreateWorkflowOwnerWithIdentityCommand()
|
||||
: base(InstancePersistence.ActivitiesCommandNamespace.GetName("CreateWorkflowOwnerWithIdentity"))
|
||||
{
|
||||
}
|
||||
|
||||
public IDictionary<XName, InstanceValue> InstanceOwnerMetadata
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.instanceOwnerMetadata == null)
|
||||
{
|
||||
this.instanceOwnerMetadata = new Dictionary<XName, InstanceValue>();
|
||||
}
|
||||
|
||||
return this.instanceOwnerMetadata;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override bool IsTransactionEnlistmentOptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.instanceOwnerMetadata == null || this.instanceOwnerMetadata.Count == 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override void Validate(InstanceView view)
|
||||
{
|
||||
if (view.IsBoundToInstanceOwner)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.AlreadyBoundToOwner));
|
||||
}
|
||||
|
||||
InstancePersistence.ValidatePropertyBag(this.instanceOwnerMetadata);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.DurableInstancing
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime;
|
||||
using System.Runtime.DurableInstancing;
|
||||
using System.Xml.Linq;
|
||||
|
||||
[Fx.Tag.XamlVisible(false)]
|
||||
public sealed class DeleteWorkflowOwnerCommand : InstancePersistenceCommand
|
||||
{
|
||||
public DeleteWorkflowOwnerCommand()
|
||||
: base(InstancePersistence.ActivitiesCommandNamespace.GetName("DeleteWorkflowOwner"))
|
||||
{
|
||||
}
|
||||
|
||||
protected internal override bool IsTransactionEnlistmentOptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override void Validate(InstanceView view)
|
||||
{
|
||||
if (!view.IsBoundToInstanceOwner)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.OwnerRequired));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.DurableInstancing
|
||||
{
|
||||
using System.Runtime;
|
||||
using System.Runtime.DurableInstancing;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[Fx.Tag.XamlVisible(false)]
|
||||
public sealed class HasActivatableWorkflowEvent : InstancePersistenceEvent<HasActivatableWorkflowEvent>
|
||||
{
|
||||
public HasActivatableWorkflowEvent()
|
||||
: base(InstancePersistence.ActivitiesEventNamespace.GetName("HasActivatableWorkflow"))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.DurableInstancing
|
||||
{
|
||||
using System.Runtime;
|
||||
using System.Runtime.DurableInstancing;
|
||||
|
||||
[Fx.Tag.XamlVisible(false)]
|
||||
public sealed class HasRunnableWorkflowEvent : InstancePersistenceEvent<HasRunnableWorkflowEvent>
|
||||
{
|
||||
public HasRunnableWorkflowEvent()
|
||||
: base(InstancePersistence.ActivitiesEventNamespace.GetName("HasRunnableWorkflow"))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,97 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.DurableInstancing
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime;
|
||||
using System.Runtime.DurableInstancing;
|
||||
using System.Xml.Linq;
|
||||
|
||||
[Fx.Tag.XamlVisible(false)]
|
||||
public sealed class LoadWorkflowByInstanceKeyCommand : InstancePersistenceCommand
|
||||
{
|
||||
Dictionary<Guid, IDictionary<XName, InstanceValue>> keysToAssociate;
|
||||
|
||||
public LoadWorkflowByInstanceKeyCommand()
|
||||
: base(InstancePersistence.ActivitiesCommandNamespace.GetName("LoadWorkflowByInstanceKey"))
|
||||
{
|
||||
}
|
||||
|
||||
public bool AcceptUninitializedInstance { get; set; }
|
||||
|
||||
public Guid LookupInstanceKey { get; set; }
|
||||
public Guid AssociateInstanceKeyToInstanceId { get; set; }
|
||||
|
||||
public IDictionary<Guid, IDictionary<XName, InstanceValue>> InstanceKeysToAssociate
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.keysToAssociate == null)
|
||||
{
|
||||
this.keysToAssociate = new Dictionary<Guid, IDictionary<XName, InstanceValue>>();
|
||||
}
|
||||
return this.keysToAssociate;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override bool IsTransactionEnlistmentOptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this.keysToAssociate == null || this.keysToAssociate.Count == 0) && AssociateInstanceKeyToInstanceId == Guid.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override bool AutomaticallyAcquiringLock
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override void Validate(InstanceView view)
|
||||
{
|
||||
if (!view.IsBoundToInstanceOwner)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.OwnerRequired));
|
||||
}
|
||||
if (view.IsBoundToInstance)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.AlreadyBoundToInstance));
|
||||
}
|
||||
|
||||
if (LookupInstanceKey == Guid.Empty)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.LoadOpKeyMustBeValid));
|
||||
}
|
||||
|
||||
if (AssociateInstanceKeyToInstanceId == Guid.Empty)
|
||||
{
|
||||
if (InstanceKeysToAssociate.ContainsKey(LookupInstanceKey))
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.LoadOpAssociateKeysCannotContainLookupKey));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!AcceptUninitializedInstance)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.LoadOpFreeKeyRequiresAcceptUninitialized));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.keysToAssociate != null)
|
||||
{
|
||||
foreach (KeyValuePair<Guid, IDictionary<XName, InstanceValue>> key in this.keysToAssociate)
|
||||
{
|
||||
InstancePersistence.ValidatePropertyBag(key.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.DurableInstancing
|
||||
{
|
||||
using System;
|
||||
using System.Runtime;
|
||||
using System.Runtime.DurableInstancing;
|
||||
using System.Xml.Linq;
|
||||
|
||||
[Fx.Tag.XamlVisible(false)]
|
||||
public sealed class LoadWorkflowCommand : InstancePersistenceCommand
|
||||
{
|
||||
public LoadWorkflowCommand()
|
||||
: base(InstancePersistence.ActivitiesCommandNamespace.GetName("LoadWorkflow"))
|
||||
{
|
||||
}
|
||||
|
||||
public bool AcceptUninitializedInstance { get; set; }
|
||||
|
||||
protected internal override bool IsTransactionEnlistmentOptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override bool AutomaticallyAcquiringLock
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override void Validate(InstanceView view)
|
||||
{
|
||||
if (!view.IsBoundToInstance)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.InstanceRequired));
|
||||
}
|
||||
|
||||
if (!view.IsBoundToInstanceOwner)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.OwnerRequired));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,75 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.Persistence
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime;
|
||||
using System.Transactions;
|
||||
using System.Xml.Linq;
|
||||
|
||||
public abstract class PersistenceIOParticipant : PersistenceParticipant
|
||||
{
|
||||
protected PersistenceIOParticipant(bool isSaveTransactionRequired, bool isLoadTransactionRequired)
|
||||
: base(isSaveTransactionRequired, isLoadTransactionRequired)
|
||||
{
|
||||
}
|
||||
|
||||
// Passed-in dictionaries are read-only.
|
||||
[Fx.Tag.Throws.Timeout("The operation could not be completed before the timeout. The transaction should be rolled back and the pipeline aborted.")]
|
||||
[Fx.Tag.Throws(typeof(OperationCanceledException), "The operation has been aborted. The transaction should be rolled back and the pipeline aborted.")]
|
||||
[Fx.Tag.Throws(typeof(TransactionException), "The transaction associated with the operation has failed. The pipeline should be aborted.")]
|
||||
protected virtual IAsyncResult BeginOnSave(IDictionary<XName, object> readWriteValues, IDictionary<XName, object> writeOnlyValues, TimeSpan timeout, AsyncCallback callback, object state)
|
||||
{
|
||||
return new CompletedAsyncResult(callback, state);
|
||||
}
|
||||
|
||||
[Fx.Tag.InheritThrows(From = "BeginOnSave")]
|
||||
protected virtual void EndOnSave(IAsyncResult result)
|
||||
{
|
||||
CompletedAsyncResult.End(result);
|
||||
}
|
||||
|
||||
// Passed-in dictionary is read-only.
|
||||
[Fx.Tag.InheritThrows(From = "BeginOnSave")]
|
||||
protected virtual IAsyncResult BeginOnLoad(IDictionary<XName, object> readWriteValues, TimeSpan timeout, AsyncCallback callback, object state)
|
||||
{
|
||||
return new CompletedAsyncResult(callback, state);
|
||||
}
|
||||
|
||||
[Fx.Tag.InheritThrows(From = "BeginOnLoad")]
|
||||
protected virtual void EndOnLoad(IAsyncResult result)
|
||||
{
|
||||
CompletedAsyncResult.End(result);
|
||||
}
|
||||
|
||||
protected abstract void Abort();
|
||||
|
||||
internal override IAsyncResult InternalBeginOnSave(IDictionary<XName, object> readWriteValues, IDictionary<XName, object> writeOnlyValues, TimeSpan timeout, AsyncCallback callback, object state)
|
||||
{
|
||||
return BeginOnSave(readWriteValues, writeOnlyValues, timeout, callback, state);
|
||||
}
|
||||
|
||||
internal override void InternalEndOnSave(IAsyncResult result)
|
||||
{
|
||||
EndOnSave(result);
|
||||
}
|
||||
|
||||
internal override IAsyncResult InternalBeginOnLoad(IDictionary<XName, object> readWriteValues, TimeSpan timeout, AsyncCallback callback, object state)
|
||||
{
|
||||
return BeginOnLoad(readWriteValues, timeout, callback, state);
|
||||
}
|
||||
|
||||
internal override void InternalEndOnLoad(IAsyncResult result)
|
||||
{
|
||||
EndOnLoad(result);
|
||||
}
|
||||
|
||||
internal override void InternalAbort()
|
||||
{
|
||||
Abort();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,137 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.Persistence
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime;
|
||||
using System.Xml.Linq;
|
||||
|
||||
public abstract class PersistenceParticipant : IPersistencePipelineModule
|
||||
{
|
||||
bool isSaveTransactionRequired;
|
||||
bool isLoadTransactionRequired;
|
||||
bool isIOParticipant;
|
||||
|
||||
protected PersistenceParticipant()
|
||||
{
|
||||
}
|
||||
|
||||
internal PersistenceParticipant(bool isSaveTransactionRequired, bool isLoadTransactionRequired)
|
||||
{
|
||||
this.isIOParticipant = true;
|
||||
this.isSaveTransactionRequired = isSaveTransactionRequired;
|
||||
this.isLoadTransactionRequired = isLoadTransactionRequired;
|
||||
}
|
||||
|
||||
[SuppressMessage(FxCop.Category.Design, FxCop.Rule.AvoidOutParameters,
|
||||
Justification = "arch approved design. requires the two out dictionaries to avoid complex structures")]
|
||||
protected virtual void CollectValues(out IDictionary<XName, object> readWriteValues, out IDictionary<XName, object> writeOnlyValues)
|
||||
{
|
||||
readWriteValues = null;
|
||||
writeOnlyValues = null;
|
||||
}
|
||||
|
||||
// Passed-in dictionaries are read-only.
|
||||
protected virtual IDictionary<XName, object> MapValues(IDictionary<XName, object> readWriteValues, IDictionary<XName, object> writeOnlyValues)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Passed-in dictionary is read-only.
|
||||
protected virtual void PublishValues(IDictionary<XName, object> readWriteValues)
|
||||
{
|
||||
}
|
||||
|
||||
void IPersistencePipelineModule.CollectValues(out IDictionary<XName, object> readWriteValues, out IDictionary<XName, object> writeOnlyValues)
|
||||
{
|
||||
CollectValues(out readWriteValues, out writeOnlyValues);
|
||||
}
|
||||
|
||||
IDictionary<XName, object> IPersistencePipelineModule.MapValues(IDictionary<XName, object> readWriteValues, IDictionary<XName, object> writeOnlyValues)
|
||||
{
|
||||
return MapValues(readWriteValues, writeOnlyValues);
|
||||
}
|
||||
|
||||
void IPersistencePipelineModule.PublishValues(IDictionary<XName, object> readWriteValues)
|
||||
{
|
||||
PublishValues(readWriteValues);
|
||||
}
|
||||
|
||||
bool IPersistencePipelineModule.IsIOParticipant
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isIOParticipant;
|
||||
}
|
||||
}
|
||||
|
||||
bool IPersistencePipelineModule.IsSaveTransactionRequired
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isSaveTransactionRequired;
|
||||
}
|
||||
}
|
||||
|
||||
bool IPersistencePipelineModule.IsLoadTransactionRequired
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isLoadTransactionRequired;
|
||||
}
|
||||
}
|
||||
|
||||
IAsyncResult IPersistencePipelineModule.BeginOnSave(IDictionary<XName, object> readWriteValues, IDictionary<XName, object> writeOnlyValues, TimeSpan timeout, AsyncCallback callback, object state)
|
||||
{
|
||||
return InternalBeginOnSave(readWriteValues, writeOnlyValues, timeout, callback, state);
|
||||
}
|
||||
|
||||
void IPersistencePipelineModule.EndOnSave(IAsyncResult result)
|
||||
{
|
||||
InternalEndOnSave(result);
|
||||
}
|
||||
|
||||
IAsyncResult IPersistencePipelineModule.BeginOnLoad(IDictionary<XName, object> readWriteValues, TimeSpan timeout, AsyncCallback callback, object state)
|
||||
{
|
||||
return InternalBeginOnLoad(readWriteValues, timeout, callback, state);
|
||||
}
|
||||
|
||||
void IPersistencePipelineModule.EndOnLoad(IAsyncResult result)
|
||||
{
|
||||
InternalEndOnLoad(result);
|
||||
}
|
||||
|
||||
void IPersistencePipelineModule.Abort()
|
||||
{
|
||||
InternalAbort();
|
||||
}
|
||||
|
||||
internal virtual IAsyncResult InternalBeginOnSave(IDictionary<XName, object> readWriteValues, IDictionary<XName, object> writeOnlyValues, TimeSpan timeout, AsyncCallback callback, object state)
|
||||
{
|
||||
throw Fx.AssertAndThrow("BeginOnSave should not be called on PersistenceParticipant.");
|
||||
}
|
||||
|
||||
internal virtual void InternalEndOnSave(IAsyncResult result)
|
||||
{
|
||||
Fx.Assert("EndOnSave should not be called on PersistenceParticipant.");
|
||||
}
|
||||
|
||||
internal virtual IAsyncResult InternalBeginOnLoad(IDictionary<XName, object> readWriteValues, TimeSpan timeout, AsyncCallback callback, object state)
|
||||
{
|
||||
throw Fx.AssertAndThrow("BeginOnLoad should not be called on PersistenceParticipant.");
|
||||
}
|
||||
|
||||
internal virtual void InternalEndOnLoad(IAsyncResult result)
|
||||
{
|
||||
Fx.Assert("EndOnLoad should not be called on PersistenceParticipant.");
|
||||
}
|
||||
|
||||
internal virtual void InternalAbort()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.DurableInstancing
|
||||
{
|
||||
using System;
|
||||
using System.Runtime;
|
||||
using System.Runtime.DurableInstancing;
|
||||
using System.Xml.Linq;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[Fx.Tag.XamlVisible(false)]
|
||||
public sealed class QueryActivatableWorkflowsCommand : InstancePersistenceCommand
|
||||
{
|
||||
public QueryActivatableWorkflowsCommand()
|
||||
: base(InstancePersistence.ActivitiesCommandNamespace.GetName("QueryActivatableWorkflows"))
|
||||
{
|
||||
}
|
||||
|
||||
protected internal override bool IsTransactionEnlistmentOptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override void Validate(InstanceView view)
|
||||
{
|
||||
if (!view.IsBoundToInstanceOwner)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.OwnerRequired));
|
||||
}
|
||||
|
||||
if (view.IsBoundToInstance)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.AlreadyBoundToInstance));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,165 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.DurableInstancing
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime;
|
||||
using System.Runtime.DurableInstancing;
|
||||
using System.Xml.Linq;
|
||||
|
||||
[Fx.Tag.XamlVisible(false)]
|
||||
public sealed class SaveWorkflowCommand : InstancePersistenceCommand
|
||||
{
|
||||
Dictionary<Guid, IDictionary<XName, InstanceValue>> keysToAssociate;
|
||||
Collection<Guid> keysToComplete;
|
||||
Collection<Guid> keysToFree;
|
||||
|
||||
Dictionary<XName, InstanceValue> instanceData;
|
||||
|
||||
Dictionary<XName, InstanceValue> instanceMetadataChanges;
|
||||
Dictionary<Guid, IDictionary<XName, InstanceValue>> keyMetadataChanges;
|
||||
|
||||
public SaveWorkflowCommand()
|
||||
: base(InstancePersistence.ActivitiesCommandNamespace.GetName("SaveWorkflow"))
|
||||
{
|
||||
}
|
||||
|
||||
public bool UnlockInstance { get; set; }
|
||||
public bool CompleteInstance { get; set; }
|
||||
|
||||
public IDictionary<Guid, IDictionary<XName, InstanceValue>> InstanceKeysToAssociate
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.keysToAssociate == null)
|
||||
{
|
||||
this.keysToAssociate = new Dictionary<Guid, IDictionary<XName, InstanceValue>>();
|
||||
}
|
||||
return this.keysToAssociate;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Guid> InstanceKeysToComplete
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.keysToComplete == null)
|
||||
{
|
||||
this.keysToComplete = new Collection<Guid>();
|
||||
}
|
||||
return this.keysToComplete;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Guid> InstanceKeysToFree
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.keysToFree == null)
|
||||
{
|
||||
this.keysToFree = new Collection<Guid>();
|
||||
}
|
||||
return this.keysToFree;
|
||||
}
|
||||
}
|
||||
|
||||
public IDictionary<XName, InstanceValue> InstanceMetadataChanges
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.instanceMetadataChanges == null)
|
||||
{
|
||||
this.instanceMetadataChanges = new Dictionary<XName, InstanceValue>();
|
||||
}
|
||||
return this.instanceMetadataChanges;
|
||||
}
|
||||
}
|
||||
|
||||
public IDictionary<Guid, IDictionary<XName, InstanceValue>> InstanceKeyMetadataChanges
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.keyMetadataChanges == null)
|
||||
{
|
||||
this.keyMetadataChanges = new Dictionary<Guid, IDictionary<XName, InstanceValue>>();
|
||||
}
|
||||
return this.keyMetadataChanges;
|
||||
}
|
||||
}
|
||||
|
||||
public IDictionary<XName, InstanceValue> InstanceData
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.instanceData == null)
|
||||
{
|
||||
this.instanceData = new Dictionary<XName, InstanceValue>();
|
||||
}
|
||||
return this.instanceData;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override bool IsTransactionEnlistmentOptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return !CompleteInstance &&
|
||||
(this.instanceData == null || this.instanceData.Count == 0) &&
|
||||
(this.keyMetadataChanges == null || this.keyMetadataChanges.Count == 0) &&
|
||||
(this.instanceMetadataChanges == null || this.instanceMetadataChanges.Count == 0) &&
|
||||
(this.keysToFree == null || this.keysToFree.Count == 0) &&
|
||||
(this.keysToComplete == null || this.keysToComplete.Count == 0) &&
|
||||
(this.keysToAssociate == null || this.keysToAssociate.Count == 0);
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override bool AutomaticallyAcquiringLock
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override void Validate(InstanceView view)
|
||||
{
|
||||
if (!view.IsBoundToInstance)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.InstanceRequired));
|
||||
}
|
||||
|
||||
if (!view.IsBoundToInstanceOwner)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.OwnerRequired));
|
||||
}
|
||||
|
||||
if (this.keysToAssociate != null)
|
||||
{
|
||||
foreach (KeyValuePair<Guid, IDictionary<XName, InstanceValue>> key in this.keysToAssociate)
|
||||
{
|
||||
InstancePersistence.ValidatePropertyBag(key.Value);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.keyMetadataChanges != null)
|
||||
{
|
||||
foreach (KeyValuePair<Guid, IDictionary<XName, InstanceValue>> key in this.keyMetadataChanges)
|
||||
{
|
||||
InstancePersistence.ValidatePropertyBag(key.Value, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.CompleteInstance && !this.UnlockInstance)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.ValidateUnlockInstance));
|
||||
}
|
||||
|
||||
InstancePersistence.ValidatePropertyBag(this.instanceMetadataChanges, true);
|
||||
InstancePersistence.ValidatePropertyBag(this.instanceData);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
//----------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------
|
||||
|
||||
namespace System.Activities.DurableInstancing
|
||||
{
|
||||
using System.Runtime;
|
||||
using System.Runtime.DurableInstancing;
|
||||
|
||||
[Fx.Tag.XamlVisible(false)]
|
||||
public sealed class TryLoadRunnableWorkflowCommand : InstancePersistenceCommand
|
||||
{
|
||||
public TryLoadRunnableWorkflowCommand()
|
||||
: base(InstancePersistence.ActivitiesCommandNamespace.GetName("TryLoadRunnableWorkflow"))
|
||||
{
|
||||
}
|
||||
|
||||
protected internal override bool IsTransactionEnlistmentOptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override bool AutomaticallyAcquiringLock
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override void Validate(InstanceView view)
|
||||
{
|
||||
if (!view.IsBoundToInstanceOwner)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.OwnerRequired));
|
||||
}
|
||||
if (view.IsBoundToInstance)
|
||||
{
|
||||
throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.AlreadyBoundToInstance));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user