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,47 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Globalization;
|
||||
|
||||
//using System.Workflow.Activities;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.Runtime;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
using Hosting = System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
/// <summary>
|
||||
/// Used by TrackPoint to hold Extracts.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public class ExtractCollection : List<TrackingExtract>
|
||||
{
|
||||
public ExtractCollection()
|
||||
{
|
||||
}
|
||||
|
||||
public ExtractCollection(IEnumerable<TrackingExtract> extracts)
|
||||
{
|
||||
//
|
||||
// Not using the IEnumerable<T> constructor on the base List<T> so that we can check for null.
|
||||
// The code behind AddRange doesn't appear to have a significant perf
|
||||
// overhead compared to the IEnumerable<T> constructor if the list is empty
|
||||
// (which it will always be at this point).
|
||||
if (null == extracts)
|
||||
throw new ArgumentNullException("extracts");
|
||||
|
||||
AddRange(extracts);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for tracking services that provide notifications when a new version of a profile is availabe.
|
||||
/// The tracking runtime subscribes to the UpdateProfile and RemoveProfile events and updates its cache as events are raised.
|
||||
/// This decreases the number of requests for profiles that are made to a tracking service. The GetProfiles methods
|
||||
/// are still in use but they are not called as frequently.
|
||||
/// </summary>
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public interface IProfileNotification
|
||||
{
|
||||
/// <summary>
|
||||
/// Use this event to inform the tracking runtime that a new profile version is available for a given workflow type.
|
||||
/// </summary>
|
||||
event EventHandler<ProfileUpdatedEventArgs> ProfileUpdated;
|
||||
/// <summary>
|
||||
/// Use this event to inform the tracking runtime that new instances of the specified workflow type should not have a profile.
|
||||
/// </summary>
|
||||
event EventHandler<ProfileRemovedEventArgs> ProfileRemoved;
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Copyright (C) 2005 Microsoft Corporation All Rights Reserved
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public sealed class PreviousTrackingServiceAttribute : Attribute
|
||||
{
|
||||
string assemblyQualifiedName;
|
||||
|
||||
public string AssemblyQualifiedName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.assemblyQualifiedName;
|
||||
}
|
||||
}
|
||||
|
||||
// The parameter must be the exact TypeOfPreviousTrackingService.AssemblyQualifiedTypeName.
|
||||
public PreviousTrackingServiceAttribute(string assemblyQualifiedName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(assemblyQualifiedName))
|
||||
throw new ArgumentNullException(assemblyQualifiedName);
|
||||
|
||||
this.assemblyQualifiedName = assemblyQualifiedName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
/// <summary>
|
||||
/// EventArgs for IProfileNotification.ProfileUpdated event.
|
||||
/// </summary>
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public sealed class ProfileUpdatedEventArgs : EventArgs
|
||||
{
|
||||
private TrackingProfile _profile = null;
|
||||
private Type _workflowType = null;
|
||||
|
||||
public ProfileUpdatedEventArgs() { }
|
||||
|
||||
public ProfileUpdatedEventArgs(Type workflowType, TrackingProfile profile)
|
||||
{
|
||||
_workflowType = workflowType;
|
||||
_profile = profile;
|
||||
}
|
||||
|
||||
public TrackingProfile TrackingProfile
|
||||
{
|
||||
get { return _profile; }
|
||||
set { _profile = value; }
|
||||
}
|
||||
|
||||
public Type WorkflowType
|
||||
{
|
||||
get { return _workflowType; }
|
||||
set { _workflowType = value; }
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// EventArgs for IProfileNotification.ProfileRemoved event.
|
||||
/// </summary>
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public sealed class ProfileRemovedEventArgs : EventArgs
|
||||
{
|
||||
private Type _workflowType = null;
|
||||
|
||||
public ProfileRemovedEventArgs() { }
|
||||
|
||||
public ProfileRemovedEventArgs(Type workflowType)
|
||||
{
|
||||
_workflowType = workflowType;
|
||||
}
|
||||
|
||||
public Type WorkflowType
|
||||
{
|
||||
get { return _workflowType; }
|
||||
set { _workflowType = value; }
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,309 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Globalization;
|
||||
|
||||
//using System.Workflow.Activities;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.Runtime;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
using Hosting = System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
|
||||
internal sealed class PropertyHelper
|
||||
{
|
||||
private PropertyHelper() { }
|
||||
|
||||
#region Internal Static Methods
|
||||
|
||||
internal static void GetProperty(string name, Activity activity, TrackingAnnotationCollection annotations, out TrackingDataItem item)
|
||||
{
|
||||
item = null;
|
||||
object tmp = PropertyHelper.GetProperty(name, activity);
|
||||
|
||||
item = new TrackingDataItem();
|
||||
item.FieldName = name;
|
||||
item.Data = tmp;
|
||||
foreach (string s in annotations)
|
||||
item.Annotations.Add(s);
|
||||
}
|
||||
|
||||
internal static object GetProperty(string name, object obj)
|
||||
{
|
||||
if (null == name)
|
||||
throw new ArgumentNullException("name");
|
||||
|
||||
if (null == obj)
|
||||
throw new ArgumentNullException("obj");
|
||||
//
|
||||
// Split the names
|
||||
string[] names = name.Split(new char[] { '.' });
|
||||
|
||||
object currObj = obj;
|
||||
for (int i = 0; i < names.Length; i++)
|
||||
{
|
||||
if ((null == names[i]) || (0 == names[i].Length))
|
||||
throw new InvalidOperationException(ExecutionStringManager.TrackingProfileInvalidMember);
|
||||
|
||||
object tmp = null;
|
||||
PropertyHelper.GetPropertyOrField(names[i], currObj, out tmp);
|
||||
//
|
||||
// Attempt to resolve runtime values (ParameterBinding, ParameterDeclaration and Bind)
|
||||
if (currObj is Activity)
|
||||
currObj = GetRuntimeValue(tmp, (Activity)currObj);
|
||||
else
|
||||
currObj = tmp;
|
||||
}
|
||||
|
||||
return currObj;
|
||||
}
|
||||
|
||||
internal static void GetPropertyOrField(string name, object o, out object obj)
|
||||
{
|
||||
obj = null;
|
||||
|
||||
if (null == name)
|
||||
throw new ArgumentNullException("name");
|
||||
|
||||
if (null == o)
|
||||
throw new ArgumentNullException("o");
|
||||
|
||||
Type t = o.GetType();
|
||||
|
||||
string tmp = null, realName = null;
|
||||
bool isCollection = false;
|
||||
int index = -1;
|
||||
|
||||
if (TryParseIndex(name, out tmp, out index))
|
||||
isCollection = true;
|
||||
else
|
||||
tmp = name;
|
||||
|
||||
object val = null;
|
||||
if ((null != tmp) && (tmp.Length > 0))
|
||||
{
|
||||
if (!NameIsDefined(tmp, o, out realName))
|
||||
throw new MissingMemberException(o.GetType().Name, tmp);
|
||||
//
|
||||
// Attempt to match default, no parameter (if overloaded)
|
||||
// Indexer accesses will fail - we do not handle indexers
|
||||
// Do case sensitive here because we have the real name of the matching member
|
||||
val = t.InvokeMember(realName,
|
||||
BindingFlags.Public |
|
||||
BindingFlags.NonPublic |
|
||||
BindingFlags.GetProperty |
|
||||
BindingFlags.GetField |
|
||||
BindingFlags.Instance |
|
||||
BindingFlags.Static,
|
||||
null,
|
||||
o,
|
||||
null,
|
||||
System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
else
|
||||
val = o; // root object is a collection - all that is passed for name is "[1]"
|
||||
|
||||
if (isCollection)
|
||||
{
|
||||
IEnumerable collection = val as IEnumerable;
|
||||
if (null != collection)
|
||||
GetEnumerationMember(collection, index, out obj);
|
||||
}
|
||||
else
|
||||
obj = val;
|
||||
}
|
||||
|
||||
internal static void GetEnumerationMember(IEnumerable collection, int index, out object obj)
|
||||
{
|
||||
obj = null;
|
||||
|
||||
if (null == collection)
|
||||
throw new ArgumentNullException("collection");
|
||||
|
||||
IEnumerator e = collection.GetEnumerator();
|
||||
int i = 0;
|
||||
while (e.MoveNext())
|
||||
{
|
||||
if (i++ == index)
|
||||
{
|
||||
obj = e.Current;
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
|
||||
internal static object GetRuntimeValue(object o, Activity activity)
|
||||
{
|
||||
if (null == o)
|
||||
return o;
|
||||
|
||||
object tmp = o;
|
||||
if (o is ActivityBind)
|
||||
{
|
||||
if (null == activity)
|
||||
throw new ArgumentNullException("activity");
|
||||
|
||||
tmp = ((ActivityBind)o).GetRuntimeValue(activity);
|
||||
}
|
||||
else if (o is WorkflowParameterBinding)
|
||||
{
|
||||
tmp = ((WorkflowParameterBinding)o).Value;
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
internal static void GetAllMembers(Activity activity, IList<TrackingDataItem> items, TrackingAnnotationCollection annotations)
|
||||
{
|
||||
Type t = activity.GetType();
|
||||
//
|
||||
// Get all fields
|
||||
FieldInfo[] fields = t.GetFields(BindingFlags.Public |
|
||||
BindingFlags.NonPublic |
|
||||
BindingFlags.Instance |
|
||||
BindingFlags.Static |
|
||||
BindingFlags.GetField);
|
||||
|
||||
foreach (FieldInfo f in fields)
|
||||
{
|
||||
if (!PropertyHelper.IsInternalVariable(f.Name))
|
||||
{
|
||||
TrackingDataItem data = new TrackingDataItem();
|
||||
data.FieldName = f.Name;
|
||||
data.Data = GetRuntimeValue(f.GetValue(activity), activity);
|
||||
foreach (string s in annotations)
|
||||
data.Annotations.Add(s);
|
||||
items.Add(data);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Get all properties (except indexers)
|
||||
PropertyInfo[] properties = t.GetProperties(BindingFlags.Public |
|
||||
BindingFlags.NonPublic |
|
||||
BindingFlags.Instance |
|
||||
BindingFlags.Static |
|
||||
BindingFlags.GetProperty);
|
||||
|
||||
foreach (PropertyInfo p in properties)
|
||||
{
|
||||
if (!IsInternalVariable(p.Name))
|
||||
{
|
||||
//
|
||||
// Skip indexers, since private data members
|
||||
// are exposed the data is still available.
|
||||
if (p.GetIndexParameters().Length > 0)
|
||||
continue;
|
||||
|
||||
TrackingDataItem data = new TrackingDataItem();
|
||||
data.FieldName = p.Name;
|
||||
data.Data = GetRuntimeValue(p.GetValue(activity, null), activity);
|
||||
foreach (string s in annotations)
|
||||
data.Annotations.Add(s);
|
||||
items.Add(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private static bool IsInternalVariable(string name)
|
||||
{
|
||||
string[] vars = { "__winoe_ActivityLocks_", "__winoe_StaticActivityLocks_", "__winoe_MethodLocks_" };
|
||||
|
||||
foreach (string s in vars)
|
||||
{
|
||||
if (0 == string.Compare(s, name, StringComparison.Ordinal))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool NameIsDefined(string name, object o, out string realName)
|
||||
{
|
||||
realName = null;
|
||||
Type t = o.GetType();
|
||||
//
|
||||
// Get the member with the requested name
|
||||
// Do case specific first
|
||||
MemberInfo[] members = t.GetMember(name,
|
||||
BindingFlags.Public |
|
||||
BindingFlags.NonPublic |
|
||||
BindingFlags.GetProperty |
|
||||
BindingFlags.GetField |
|
||||
BindingFlags.Instance |
|
||||
BindingFlags.Static);
|
||||
|
||||
//
|
||||
// Not found
|
||||
if ((null == members) || (0 == members.Length))
|
||||
{
|
||||
//
|
||||
// Do case insensitive
|
||||
members = t.GetMember(name,
|
||||
BindingFlags.Public |
|
||||
BindingFlags.NonPublic |
|
||||
BindingFlags.GetProperty |
|
||||
BindingFlags.GetField |
|
||||
BindingFlags.Instance |
|
||||
BindingFlags.Static |
|
||||
BindingFlags.IgnoreCase);
|
||||
//
|
||||
// Not found
|
||||
if ((null == members) || (0 == members.Length))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((null == members) || (0 == members.Length) || (null == members[0].Name) || (0 == members[0].Name.Length))
|
||||
return false;
|
||||
|
||||
realName = members[0].Name;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool TryParseIndex(string fullName, out string name, out int index)
|
||||
{
|
||||
name = null;
|
||||
index = -1;
|
||||
|
||||
int endPos = -1, startPos = -1;
|
||||
for (int i = fullName.Length - 1; i > 0; i--)
|
||||
{
|
||||
if ((']' == fullName[i]) && (-1 == endPos))
|
||||
{
|
||||
endPos = i;
|
||||
}
|
||||
else if (('[' == fullName[i]) && (-1 == startPos))
|
||||
{
|
||||
startPos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((-1 == endPos) || (-1 == startPos))
|
||||
return false;
|
||||
|
||||
string idx = fullName.Substring(startPos + 1, endPos - 1 - startPos);
|
||||
name = fullName.Substring(0, startPos);
|
||||
|
||||
return int.TryParse(idx, out index);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,325 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.ComponentModel.Design.Serialization;
|
||||
|
||||
using System.Workflow.Runtime;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Serialization;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public sealed class SqlTrackingQuery
|
||||
{
|
||||
string _connectionString = null;
|
||||
|
||||
public SqlTrackingQuery()
|
||||
{
|
||||
}
|
||||
|
||||
public SqlTrackingQuery(string connectionString)
|
||||
{
|
||||
if (null == connectionString)
|
||||
throw new ArgumentNullException("connectionString");
|
||||
_connectionString = connectionString;
|
||||
}
|
||||
|
||||
public string ConnectionString
|
||||
{
|
||||
get { return _connectionString; }
|
||||
set
|
||||
{
|
||||
if (null == value)
|
||||
throw new ArgumentNullException("value");
|
||||
_connectionString = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetWorkflow(Guid workflowInstanceId, out SqlTrackingWorkflowInstance workflowInstance)
|
||||
{
|
||||
SqlCommand cmd = BuildCommand(workflowInstanceId);
|
||||
SqlDataReader reader = null;
|
||||
workflowInstance = null;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
cmd.Connection = GetConnection();
|
||||
reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
|
||||
//
|
||||
// There will only be 1 row
|
||||
if (reader.Read())
|
||||
{
|
||||
workflowInstance = BuildInstance(reader);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (null != reader)
|
||||
reader.Close();
|
||||
|
||||
if (null != cmd && null != cmd.Connection && ConnectionState.Closed != cmd.Connection.State)
|
||||
cmd.Connection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public IList<SqlTrackingWorkflowInstance> GetWorkflows(SqlTrackingQueryOptions options)
|
||||
{
|
||||
if (null == options)
|
||||
throw new ArgumentNullException("options");
|
||||
|
||||
if (null != options.TrackingDataItems)
|
||||
{
|
||||
foreach (TrackingDataItemValue val in options.TrackingDataItems)
|
||||
{
|
||||
if (null == val.QualifiedName)
|
||||
throw new ArgumentNullException("options.TrackingDataItems.QualifiedName");
|
||||
if (null == val.FieldName)
|
||||
throw new ArgumentNullException("options.TrackingDataItems.FieldName");
|
||||
}
|
||||
}
|
||||
|
||||
SqlCommand cmd = BuildCommand(options);
|
||||
SqlDataReader reader = null;
|
||||
List<SqlTrackingWorkflowInstance> inst = new List<SqlTrackingWorkflowInstance>();
|
||||
|
||||
try
|
||||
{
|
||||
cmd.Connection = GetConnection();
|
||||
reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
|
||||
//
|
||||
// There will only be 1 row
|
||||
while (reader.Read())
|
||||
{
|
||||
inst.Add(BuildInstance(reader));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (null != reader)
|
||||
reader.Close();
|
||||
|
||||
if (null != cmd && null != cmd.Connection && ConnectionState.Closed != cmd.Connection.State)
|
||||
cmd.Connection.Close();
|
||||
}
|
||||
|
||||
return inst;
|
||||
}
|
||||
|
||||
private SqlTrackingWorkflowInstance BuildInstance(SqlDataReader reader)
|
||||
{
|
||||
return SqlTrackingQuery.BuildInstance(reader, _connectionString);
|
||||
}
|
||||
|
||||
internal static SqlTrackingWorkflowInstance BuildInstance(SqlDataReader reader, string connectionString)
|
||||
{
|
||||
if (null == reader)
|
||||
throw new ArgumentNullException("reader");
|
||||
if (reader.IsClosed)
|
||||
throw new ArgumentException(ExecutionStringManager.InvalidSqlDataReader, "reader");
|
||||
|
||||
SqlTrackingWorkflowInstance inst = new SqlTrackingWorkflowInstance(connectionString);
|
||||
inst.WorkflowInstanceId = reader.GetGuid(1);
|
||||
inst.WorkflowInstanceInternalId = reader.GetInt64(2);
|
||||
inst.Initialized = reader.GetDateTime(3);
|
||||
if (DBNull.Value == reader[4])
|
||||
inst.InvokingWorkflowInstanceId = Guid.Empty;
|
||||
else
|
||||
inst.InvokingWorkflowInstanceId = reader.GetGuid(4);
|
||||
inst.Status = (WorkflowStatus)reader.GetInt32(5);
|
||||
//
|
||||
// Xaml only workflows do not have types
|
||||
if (!reader.IsDBNull(6))
|
||||
{
|
||||
string fullName = reader.GetString(6), assemblyName = reader.GetString(7);
|
||||
inst.WorkflowType = Type.GetType(fullName + ", " + assemblyName, true, false);
|
||||
}
|
||||
|
||||
return inst;
|
||||
}
|
||||
|
||||
private SqlConnection GetConnection()
|
||||
{
|
||||
if (null == _connectionString)
|
||||
{
|
||||
throw new InvalidOperationException(ExecutionStringManager.MissingConnectionString);
|
||||
}
|
||||
|
||||
SqlConnection conn = new SqlConnection(_connectionString);
|
||||
conn.Open();
|
||||
|
||||
return conn;
|
||||
}
|
||||
|
||||
private SqlCommand BuildCommand(Guid workflowInstanceId)
|
||||
{
|
||||
SqlCommand cmd = new SqlCommand("[dbo].[GetWorkflows]");
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
SqlParameter param = new SqlParameter();
|
||||
param.ParameterName = "@WorkflowInstanceId";
|
||||
param.SqlDbType = SqlDbType.UniqueIdentifier;
|
||||
param.Value = workflowInstanceId;
|
||||
cmd.Parameters.Add(param);
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
private SqlCommand BuildCommand(SqlTrackingQueryOptions opt)
|
||||
{
|
||||
SqlCommand cmd = new SqlCommand("[dbo].[GetWorkflows]");
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
SqlParameter param = new SqlParameter();
|
||||
if (opt.WorkflowStatus.HasValue)
|
||||
{
|
||||
param.ParameterName = "@WorkflowStatusId";
|
||||
param.SqlDbType = SqlDbType.TinyInt;
|
||||
param.Value = opt.WorkflowStatus.Value;
|
||||
cmd.Parameters.Add(param);
|
||||
//
|
||||
// If one of the range values is set we have a date range constraint
|
||||
if (DateTime.MinValue != opt.StatusMinDateTime || DateTime.MaxValue != opt.StatusMaxDateTime)
|
||||
{
|
||||
param = new SqlParameter();
|
||||
param.ParameterName = "@StatusMinDateTime";
|
||||
param.SqlDbType = SqlDbType.DateTime;
|
||||
if (opt.StatusMinDateTime < SqlDateTime.MinValue.Value)
|
||||
param.Value = SqlDateTime.MinValue.Value;
|
||||
else
|
||||
param.Value = opt.StatusMinDateTime;
|
||||
|
||||
cmd.Parameters.Add(param);
|
||||
|
||||
param = new SqlParameter();
|
||||
param.ParameterName = "@StatusMaxDateTime";
|
||||
param.SqlDbType = SqlDbType.DateTime;
|
||||
if (opt.StatusMaxDateTime > SqlDateTime.MaxValue.Value)
|
||||
param.Value = SqlDateTime.MaxValue.Value;
|
||||
else
|
||||
param.Value = opt.StatusMaxDateTime;
|
||||
|
||||
cmd.Parameters.Add(param);
|
||||
}
|
||||
}
|
||||
|
||||
if (null != opt.WorkflowType)
|
||||
{
|
||||
param = new SqlParameter("@TypeFullName", opt.WorkflowType.FullName);
|
||||
param.SqlDbType = SqlDbType.NVarChar;
|
||||
param.Size = 128;
|
||||
cmd.Parameters.Add(param);
|
||||
|
||||
param = new SqlParameter("@AssemblyFullName", opt.WorkflowType.Assembly.FullName);
|
||||
param.SqlDbType = SqlDbType.NVarChar;
|
||||
param.Size = 128;
|
||||
cmd.Parameters.Add(param);
|
||||
}
|
||||
|
||||
if (null != opt.TrackingDataItems && opt.TrackingDataItems.Count > 0)
|
||||
BuildArtifactParameters(cmd, opt.TrackingDataItems);
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
private void BuildArtifactParameters(SqlCommand cmd, IList<TrackingDataItemValue> artifacts)
|
||||
{
|
||||
if (null == artifacts || 0 == artifacts.Count)
|
||||
return;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
XmlWriter writer = XmlWriter.Create(sb);
|
||||
|
||||
try
|
||||
{
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("TrackingDataItems");
|
||||
|
||||
foreach (TrackingDataItemValue art in artifacts)
|
||||
{
|
||||
writer.WriteStartElement("TrackingDataItem");
|
||||
writer.WriteElementString("QualifiedName", art.QualifiedName);
|
||||
writer.WriteElementString("FieldName", art.FieldName);
|
||||
//
|
||||
// If data value is null don't write the node as
|
||||
// the proc sees no DataValue node as null and matches null rows.
|
||||
// This allows us to match null, "", and positive length strings
|
||||
if (null != art.DataValue)
|
||||
writer.WriteElementString("DataValue", art.DataValue);
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
writer.WriteEndElement();
|
||||
writer.WriteEndDocument();
|
||||
}
|
||||
finally
|
||||
{
|
||||
writer.Flush();
|
||||
writer.Close();
|
||||
}
|
||||
|
||||
SqlParameter param = new SqlParameter();
|
||||
param.ParameterName = "@TrackingDataItems";
|
||||
param.SqlDbType = SqlDbType.NText;
|
||||
param.Value = sb.ToString();
|
||||
|
||||
cmd.Parameters.Add(param);
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public class SqlTrackingQueryOptions
|
||||
{
|
||||
private DateTime _min = DateTime.MinValue, _max = DateTime.MaxValue;
|
||||
private WorkflowStatus? _status = new Nullable<WorkflowStatus>();
|
||||
private Type _type = null;
|
||||
private List<TrackingDataItemValue> _dataItems = new List<TrackingDataItemValue>();
|
||||
|
||||
public Type WorkflowType
|
||||
{
|
||||
get { return _type; }
|
||||
set { _type = value; }
|
||||
}
|
||||
public WorkflowStatus? WorkflowStatus
|
||||
{
|
||||
get { return _status; }
|
||||
set { _status = value; }
|
||||
}
|
||||
public DateTime StatusMinDateTime
|
||||
{
|
||||
get { return _min; }
|
||||
set { _min = value; }
|
||||
}
|
||||
public DateTime StatusMaxDateTime
|
||||
{
|
||||
get { return _max; }
|
||||
set { _max = value; }
|
||||
}
|
||||
public IList<TrackingDataItemValue> TrackingDataItems
|
||||
{
|
||||
get { return _dataItems; }
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_min = DateTime.MinValue;
|
||||
_max = DateTime.MaxValue;
|
||||
_status = new Nullable<WorkflowStatus>();
|
||||
_type = null;
|
||||
_dataItems = new List<TrackingDataItemValue>();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
a9dee6db241963cc4c44b262f0c7aee223281de8
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,282 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Globalization;
|
||||
|
||||
//using System.Workflow.Activities;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.Runtime;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
using Hosting = System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public sealed class ActivityTrackPoint
|
||||
{
|
||||
#region Private Data Members
|
||||
|
||||
private ActivityTrackingLocationCollection _match = new ActivityTrackingLocationCollection();
|
||||
private ActivityTrackingLocationCollection _exclude = new ActivityTrackingLocationCollection();
|
||||
private TrackingAnnotationCollection _annotations = new TrackingAnnotationCollection();
|
||||
private ExtractCollection _extracts = new ExtractCollection();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public ActivityTrackingLocationCollection MatchingLocations
|
||||
{
|
||||
get { return _match; }
|
||||
}
|
||||
|
||||
public ActivityTrackingLocationCollection ExcludedLocations
|
||||
{
|
||||
get { return _exclude; }
|
||||
}
|
||||
|
||||
public TrackingAnnotationCollection Annotations
|
||||
{
|
||||
get { return _annotations; }
|
||||
}
|
||||
|
||||
public ExtractCollection Extracts
|
||||
{
|
||||
get { return _extracts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Matching Methods
|
||||
|
||||
internal bool IsMatch(Activity activity, out List<ActivityExecutionStatus> status, out bool hasCondition)
|
||||
{
|
||||
hasCondition = false;
|
||||
//
|
||||
// Check if we have any conditions on this track point.
|
||||
// If we do signal that we need to recheck this item for each activity event (can't cache)
|
||||
foreach (ActivityTrackingLocation location in _exclude)
|
||||
{
|
||||
if ((null != location.Conditions) && (location.Conditions.Count > 0))
|
||||
{
|
||||
hasCondition = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (ActivityTrackingLocation location in _match)
|
||||
{
|
||||
if ((null != location.Conditions) && (location.Conditions.Count > 0))
|
||||
{
|
||||
hasCondition = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
status = new List<ActivityExecutionStatus>(9);
|
||||
//
|
||||
// Do matches first
|
||||
foreach (ActivityTrackingLocation location in _match)
|
||||
{
|
||||
if (location.Match(activity, true))
|
||||
{
|
||||
//
|
||||
// Insert all status values for this location
|
||||
foreach (ActivityExecutionStatus s in location.ExecutionStatusEvents)
|
||||
{
|
||||
if (!status.Contains(s))
|
||||
status.Add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// If no includes matched
|
||||
// this trackpoint isn't relevant to this activity
|
||||
if (0 == status.Count)
|
||||
return false;
|
||||
//
|
||||
// Check the excludes but only if there aren't any conditions
|
||||
if (!hasCondition)
|
||||
{
|
||||
foreach (ActivityTrackingLocation location in _exclude)
|
||||
{
|
||||
if (location.Match(activity, true))
|
||||
{
|
||||
//
|
||||
// Remove all status values for this location
|
||||
foreach (ActivityExecutionStatus s in location.ExecutionStatusEvents)
|
||||
status.Remove(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (status.Count > 0);
|
||||
}
|
||||
|
||||
internal bool IsMatch(Activity activity, ActivityExecutionStatus status)
|
||||
{
|
||||
//
|
||||
// Do matches first
|
||||
bool included = false;
|
||||
foreach (ActivityTrackingLocation location in _match)
|
||||
{
|
||||
if (location.Match(activity, false))
|
||||
{
|
||||
if (location.ExecutionStatusEvents.Contains(status))
|
||||
{
|
||||
included = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// If no includes matched this trackpoint
|
||||
// doesn't match this activity
|
||||
if (!included)
|
||||
return false;
|
||||
//
|
||||
// Check the excludes
|
||||
foreach (ActivityTrackingLocation location in _exclude)
|
||||
{
|
||||
//
|
||||
// If any exclude matches this trackpoint
|
||||
// doesn't match this activity
|
||||
if (location.Match(activity, false))
|
||||
{
|
||||
if (location.ExecutionStatusEvents.Contains(status))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return included;
|
||||
}
|
||||
|
||||
internal void Track(Activity activity, IServiceProvider provider, IList<TrackingDataItem> items)
|
||||
{
|
||||
foreach (TrackingExtract e in _extracts)
|
||||
e.GetData(activity, provider, items);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public sealed class UserTrackPoint
|
||||
{
|
||||
#region Private Data Members
|
||||
|
||||
private UserTrackingLocationCollection _match = new UserTrackingLocationCollection();
|
||||
private UserTrackingLocationCollection _exclude = new UserTrackingLocationCollection();
|
||||
private TrackingAnnotationCollection _annotations = new TrackingAnnotationCollection();
|
||||
private ExtractCollection _extracts = new ExtractCollection();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public UserTrackingLocationCollection MatchingLocations
|
||||
{
|
||||
get { return _match; }
|
||||
}
|
||||
|
||||
public UserTrackingLocationCollection ExcludedLocations
|
||||
{
|
||||
get { return _exclude; }
|
||||
}
|
||||
|
||||
public TrackingAnnotationCollection Annotations
|
||||
{
|
||||
get { return _annotations; }
|
||||
}
|
||||
|
||||
public ExtractCollection Extracts
|
||||
{
|
||||
get { return _extracts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Matching Methods
|
||||
|
||||
internal bool IsMatch(Activity activity)
|
||||
{
|
||||
//
|
||||
// Check include, excludes checked at event time
|
||||
foreach (UserTrackingLocation location in _match)
|
||||
if (location.Match(activity))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
internal bool IsMatch(Activity activity, string keyName, object argument)
|
||||
{
|
||||
//
|
||||
// We need to check runtime values here
|
||||
//
|
||||
// Check the excludes - if any exclude matches based on activity, key and arg type we're not a match
|
||||
foreach (UserTrackingLocation location in _exclude)
|
||||
if (location.Match(activity, keyName, argument))
|
||||
return false;
|
||||
//
|
||||
// No excludes match, check includes
|
||||
foreach (UserTrackingLocation location in _match)
|
||||
if (location.Match(activity, keyName, argument))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void Track(Activity activity, object arg, IServiceProvider provider, IList<TrackingDataItem> items)
|
||||
{
|
||||
foreach (TrackingExtract e in _extracts)
|
||||
e.GetData(activity, provider, items);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public sealed class WorkflowTrackPoint
|
||||
{
|
||||
#region Private Data Members
|
||||
|
||||
private WorkflowTrackingLocation _location = new WorkflowTrackingLocation();
|
||||
private TrackingAnnotationCollection _annotations = new TrackingAnnotationCollection();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public WorkflowTrackingLocation MatchingLocation
|
||||
{
|
||||
get { return _location; }
|
||||
set { _location = value; }
|
||||
}
|
||||
|
||||
public TrackingAnnotationCollection Annotations
|
||||
{
|
||||
get { return _annotations; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Matching Methods
|
||||
|
||||
internal bool IsMatch(TrackingWorkflowEvent status)
|
||||
{
|
||||
return _location.Match(status);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Globalization;
|
||||
|
||||
//using System.Workflow.Activities;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.Runtime;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
using Hosting = System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
/// <summary>
|
||||
/// Used by TrackingProfile to hold ActivityTrackPoints.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public class ActivityTrackPointCollection : List<ActivityTrackPoint>
|
||||
{
|
||||
public ActivityTrackPointCollection()
|
||||
{
|
||||
}
|
||||
|
||||
public ActivityTrackPointCollection(IEnumerable<ActivityTrackPoint> points)
|
||||
{
|
||||
//
|
||||
// Not using the IEnumerable<T> constructor on the base List<T> so that we can check for null.
|
||||
// The code behind AddRange doesn't appear to have a significant perf
|
||||
// overhead compared to the IEnumerable<T> constructor if the list is empty
|
||||
// (which it will always be at this point).
|
||||
if (null == points)
|
||||
throw new ArgumentNullException("points");
|
||||
|
||||
AddRange(points);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used by TrackingProfile to hold UserTrackPoints.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public class UserTrackPointCollection : List<UserTrackPoint>
|
||||
{
|
||||
public UserTrackPointCollection()
|
||||
{
|
||||
}
|
||||
|
||||
public UserTrackPointCollection(IEnumerable<UserTrackPoint> points)
|
||||
{
|
||||
//
|
||||
// Not using the IEnumerable<T> constructor on the base List<T> so that we can check for null.
|
||||
// The code behind AddRange doesn't appear to have a significant perf
|
||||
// overhead compared to the IEnumerable<T> constructor if the list is empty
|
||||
// (which it will always be at this point).
|
||||
if (null == points)
|
||||
throw new ArgumentNullException("points");
|
||||
|
||||
AddRange(points);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used by TrackingProfile to hold ActivityTrackPoints.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public class WorkflowTrackPointCollection : List<WorkflowTrackPoint>
|
||||
{
|
||||
public WorkflowTrackPointCollection()
|
||||
{
|
||||
}
|
||||
|
||||
public WorkflowTrackPointCollection(IEnumerable<WorkflowTrackPoint> points)
|
||||
{
|
||||
//
|
||||
// Not using the IEnumerable<T> constructor on the base List<T> so that we can check for null.
|
||||
// The code behind AddRange doesn't appear to have a significant perf
|
||||
// overhead compared to the IEnumerable<T> constructor if the list is empty
|
||||
// (which it will always be at this point).
|
||||
if (null == points)
|
||||
throw new ArgumentNullException("points");
|
||||
|
||||
AddRange(points);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Globalization;
|
||||
|
||||
//using System.Workflow.Activities;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.Runtime;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
using Hosting = System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
/// <summary>
|
||||
/// Used by Location to hold Conditions.
|
||||
/// </summary>
|
||||
|
||||
/// <summary>
|
||||
/// Used by TrackingExtract and TrackPoint to hold annotations.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public class TrackingAnnotationCollection : List<string>
|
||||
{
|
||||
public TrackingAnnotationCollection()
|
||||
{
|
||||
}
|
||||
|
||||
public TrackingAnnotationCollection(IEnumerable<string> annotations)
|
||||
{
|
||||
//
|
||||
// Not using the IEnumerable<T> constructor on the base List<T> so that we can check for null.
|
||||
// The code behind AddRange doesn't appear to have a significant perf
|
||||
// overhead compared to the IEnumerable<T> constructor if the list is empty
|
||||
// (which it will always be at this point).
|
||||
if (null == annotations)
|
||||
throw new ArgumentNullException("annotations");
|
||||
|
||||
AddRange(annotations);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class from which all tracking channels must derive in order to receive tracking data.
|
||||
/// </summary>
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public abstract class TrackingChannel
|
||||
{
|
||||
protected internal abstract void Send(TrackingRecord record);
|
||||
protected internal abstract void InstanceCompletedOrTerminated();
|
||||
}
|
||||
}
|
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Globalization;
|
||||
|
||||
//using System.Workflow.Activities;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.Runtime;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
using Hosting = System.Workflow.Runtime.Hosting;
|
||||
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public abstract class TrackingCondition
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public abstract string Value { get; set; }
|
||||
|
||||
public abstract string Member { get; set; }
|
||||
|
||||
public abstract ComparisonOperator Operator { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Abstract Match Methods
|
||||
|
||||
internal abstract bool Match(object obj);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes critieria that is used constrain locations.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public class ActivityTrackingCondition : TrackingCondition
|
||||
{
|
||||
#region Private Data Members
|
||||
|
||||
private string _property;
|
||||
private string _val;
|
||||
private ComparisonOperator _op = ComparisonOperator.Equals;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public ActivityTrackingCondition()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constuct with a list of property names and a value.
|
||||
/// </summary>
|
||||
/// <param name="propertyName">"." delineated list of property names.</param>
|
||||
/// <param name="value">Value for the condition.</param>
|
||||
/// <remarks>Throws ArgumentNullException, ArgumentException.</remarks>
|
||||
public ActivityTrackingCondition(string member, string value)
|
||||
{
|
||||
//
|
||||
// value can be null but the propery name(s) cannot
|
||||
if (null == member)
|
||||
throw new ArgumentNullException("member");
|
||||
|
||||
_property = member;
|
||||
|
||||
SetValue(value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public override string Value
|
||||
{
|
||||
get { return _val; }
|
||||
set { SetValue(value); }
|
||||
}
|
||||
|
||||
public override string Member
|
||||
{
|
||||
get { return _property; }
|
||||
set { _property = value; }
|
||||
}
|
||||
|
||||
public override ComparisonOperator Operator
|
||||
{
|
||||
get { return _op; }
|
||||
set { _op = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
internal override bool Match(object obj)
|
||||
{
|
||||
if (null == obj)
|
||||
throw new ArgumentNullException("obj");
|
||||
|
||||
object o = PropertyHelper.GetProperty(_property, obj);
|
||||
|
||||
if (ComparisonOperator.Equals == _op)
|
||||
{
|
||||
if (null == o)
|
||||
return (null == _val);
|
||||
else
|
||||
return (0 == string.Compare(o.ToString(), _val, StringComparison.Ordinal));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (null == o)
|
||||
return (null != _val);
|
||||
else
|
||||
return (0 != string.Compare(o.ToString(), _val, StringComparison.Ordinal));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void SetValue(string value)
|
||||
{
|
||||
_val = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public enum ComparisonOperator
|
||||
{
|
||||
Equals = 0,
|
||||
NotEquals = 1,
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Globalization;
|
||||
|
||||
//using System.Workflow.Activities;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.Runtime;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
using Hosting = System.Workflow.Runtime.Hosting;
|
||||
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public class TrackingConditionCollection : List<TrackingCondition>
|
||||
{
|
||||
public TrackingConditionCollection()
|
||||
{
|
||||
}
|
||||
|
||||
public TrackingConditionCollection(IEnumerable<TrackingCondition> conditions)
|
||||
{
|
||||
//
|
||||
// Not using the IEnumerable<T> constructor on the base List<T> so that we can check for null.
|
||||
// The code behind AddRange doesn't appear to have a significant perf
|
||||
// overhead compared to the IEnumerable<T> constructor if the list is empty
|
||||
// (which it will always be at this point).
|
||||
if (null == conditions)
|
||||
throw new ArgumentNullException("conditions");
|
||||
|
||||
AddRange(conditions);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
/// <summary>
|
||||
/// Contain a single piece of tracking data and any associated annotations.
|
||||
/// </summary>
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public class TrackingDataItem
|
||||
{
|
||||
private TrackingAnnotationCollection _annotations = new TrackingAnnotationCollection();
|
||||
private object _data = null;
|
||||
private string _fieldName = null;
|
||||
|
||||
public TrackingDataItem()
|
||||
{
|
||||
}
|
||||
|
||||
public TrackingAnnotationCollection Annotations
|
||||
{
|
||||
get { return _annotations; }
|
||||
//set{ _annotations = value; }
|
||||
}
|
||||
|
||||
public string FieldName
|
||||
{
|
||||
get { return _fieldName; }
|
||||
set { _fieldName = value; }
|
||||
}
|
||||
|
||||
public object Data
|
||||
{
|
||||
get { return _data; }
|
||||
set { _data = value; }
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.ComponentModel.Design.Serialization;
|
||||
|
||||
using System.Workflow.Runtime;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.ComponentModel.Serialization;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public class TrackingDataItemValue
|
||||
{
|
||||
private string _name = null;
|
||||
private string _value = null;
|
||||
private string _id = null;
|
||||
|
||||
public TrackingDataItemValue() { }
|
||||
|
||||
public TrackingDataItemValue(string qualifiedName, string fieldName, string dataValue)
|
||||
{
|
||||
_name = fieldName;
|
||||
_value = dataValue;
|
||||
_id = qualifiedName;
|
||||
}
|
||||
|
||||
public string FieldName
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
public string DataValue
|
||||
{
|
||||
get { return _value; }
|
||||
set { _value = value; }
|
||||
}
|
||||
public string QualifiedName
|
||||
{
|
||||
get { return _id; }
|
||||
set { _id = value; }
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Globalization;
|
||||
|
||||
//using System.Workflow.Activities;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.Runtime;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
using Hosting = System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract base for classes that extract data
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public abstract class TrackingExtract
|
||||
{
|
||||
public abstract TrackingAnnotationCollection Annotations { get; }
|
||||
public abstract string Member { get; set; }
|
||||
internal abstract void GetData(Activity activity, IServiceProvider provider, IList<TrackingDataItem> items);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to extract data members from a workflow's code separation partial class.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public class WorkflowDataTrackingExtract : TrackingExtract
|
||||
{
|
||||
#region Private DataMembers
|
||||
|
||||
private string _name = null;
|
||||
private TrackingAnnotationCollection _annotations = new TrackingAnnotationCollection();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public WorkflowDataTrackingExtract()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Construct with a Member list.
|
||||
/// </summary>
|
||||
/// <param name="member">List of "." delineated property names</param>
|
||||
public WorkflowDataTrackingExtract(string member)
|
||||
{
|
||||
_name = member;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TrackingExtract
|
||||
|
||||
public override string Member
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
|
||||
public override TrackingAnnotationCollection Annotations
|
||||
{
|
||||
get { return _annotations; }
|
||||
}
|
||||
|
||||
internal override void GetData(Activity activity, IServiceProvider provider, IList<TrackingDataItem> items)
|
||||
{
|
||||
Activity root = ContextActivityUtils.RootContextActivity(activity);
|
||||
|
||||
if ((null == _name) || (0 == _name.Trim().Length))
|
||||
{
|
||||
//
|
||||
// If we don't have a name we get everything
|
||||
PropertyHelper.GetAllMembers(root, items, _annotations);
|
||||
}
|
||||
else
|
||||
{
|
||||
TrackingDataItem item = null;
|
||||
PropertyHelper.GetProperty(_name, root, _annotations, out item);
|
||||
if (null != item)
|
||||
items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
/// <summary>
|
||||
/// Used to extract data members from an activity in a workflow instance.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public class ActivityDataTrackingExtract : TrackingExtract
|
||||
{
|
||||
#region Private DataMembers
|
||||
|
||||
private string _name = null;
|
||||
private TrackingAnnotationCollection _annotations = new TrackingAnnotationCollection();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public ActivityDataTrackingExtract()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Construct with a Member list.
|
||||
/// </summary>
|
||||
/// <param name="member">List of "." delineated property names</param>
|
||||
public ActivityDataTrackingExtract(string member)
|
||||
{
|
||||
_name = member;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TrackingExtract
|
||||
|
||||
public override string Member
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
|
||||
public override TrackingAnnotationCollection Annotations
|
||||
{
|
||||
get { return _annotations; }
|
||||
}
|
||||
|
||||
internal override void GetData(Activity activity, IServiceProvider provider, IList<TrackingDataItem> items)
|
||||
{
|
||||
|
||||
if ((null == _name) || (0 == _name.Trim().Length))
|
||||
{
|
||||
//
|
||||
// If we don't have a name we get everything
|
||||
PropertyHelper.GetAllMembers(activity, items, _annotations);
|
||||
}
|
||||
else
|
||||
{
|
||||
TrackingDataItem item = null;
|
||||
PropertyHelper.GetProperty(_name, activity, _annotations, out item);
|
||||
if (null != item)
|
||||
items.Add(item);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,479 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Globalization;
|
||||
|
||||
//using System.Workflow.Activities;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.Runtime;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
using Hosting = System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data that is used to match instance locations.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public sealed class WorkflowTrackingLocation
|
||||
{
|
||||
#region Private Data Members
|
||||
|
||||
private IList<TrackingWorkflowEvent> _events = new List<TrackingWorkflowEvent>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public WorkflowTrackingLocation()
|
||||
{
|
||||
}
|
||||
|
||||
public WorkflowTrackingLocation(IList<TrackingWorkflowEvent> events)
|
||||
{
|
||||
_events = events;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public IList<TrackingWorkflowEvent> Events
|
||||
{
|
||||
get { return _events; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Matching Methods
|
||||
|
||||
internal bool Match(TrackingWorkflowEvent status)
|
||||
{
|
||||
return _events.Contains(status);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contains data that is used to match activity locations.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public sealed class ActivityTrackingLocation
|
||||
{
|
||||
#region Private Data Members
|
||||
|
||||
private TrackingConditionCollection _conditions = new TrackingConditionCollection();
|
||||
private List<ActivityExecutionStatus> _events = new List<ActivityExecutionStatus>();
|
||||
private Type _activityType = null;
|
||||
private string _activityName = null;
|
||||
private bool _trackDerived = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public ActivityTrackingLocation()
|
||||
{
|
||||
}
|
||||
|
||||
public ActivityTrackingLocation(string activityTypeName)
|
||||
{
|
||||
if (null == activityTypeName)
|
||||
throw new ArgumentNullException("activityTypeName");
|
||||
|
||||
_activityName = activityTypeName;
|
||||
}
|
||||
|
||||
public ActivityTrackingLocation(Type activityType)
|
||||
{
|
||||
if (null == activityType)
|
||||
throw new ArgumentNullException("activityType");
|
||||
|
||||
_activityType = activityType;
|
||||
}
|
||||
|
||||
public ActivityTrackingLocation(string activityTypeName, IEnumerable<ActivityExecutionStatus> executionStatusEvents)
|
||||
{
|
||||
if (null == activityTypeName)
|
||||
throw new ArgumentNullException("activityTypeName");
|
||||
|
||||
if (null == executionStatusEvents)
|
||||
throw new ArgumentNullException("executionStatusEvents");
|
||||
|
||||
_activityName = activityTypeName;
|
||||
_events.AddRange(executionStatusEvents);
|
||||
}
|
||||
|
||||
public ActivityTrackingLocation(Type activityType, IEnumerable<ActivityExecutionStatus> executionStatusEvents)
|
||||
{
|
||||
if (null == activityType)
|
||||
throw new ArgumentNullException("activityType");
|
||||
|
||||
if (null == executionStatusEvents)
|
||||
throw new ArgumentNullException("executionStatusEvents");
|
||||
|
||||
_activityType = activityType;
|
||||
_events.AddRange(executionStatusEvents);
|
||||
}
|
||||
|
||||
public ActivityTrackingLocation(string activityTypeName, bool matchDerivedTypes, IEnumerable<ActivityExecutionStatus> executionStatusEvents)
|
||||
{
|
||||
if (null == activityTypeName)
|
||||
throw new ArgumentNullException("activityTypeName");
|
||||
|
||||
if (null == executionStatusEvents)
|
||||
throw new ArgumentNullException("executionStatusEvents");
|
||||
|
||||
_activityName = activityTypeName;
|
||||
_trackDerived = matchDerivedTypes;
|
||||
_events.AddRange(executionStatusEvents);
|
||||
}
|
||||
|
||||
public ActivityTrackingLocation(Type activityType, bool matchDerivedTypes, IEnumerable<ActivityExecutionStatus> executionStatusEvents)
|
||||
{
|
||||
if (null == activityType)
|
||||
throw new ArgumentNullException("activityType");
|
||||
|
||||
if (null == executionStatusEvents)
|
||||
throw new ArgumentNullException("executionStatusEvents");
|
||||
|
||||
_activityType = activityType;
|
||||
_trackDerived = matchDerivedTypes;
|
||||
_events.AddRange(executionStatusEvents);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public Type ActivityType
|
||||
{
|
||||
get { return _activityType; }
|
||||
set { _activityType = value; }
|
||||
}
|
||||
|
||||
public string ActivityTypeName
|
||||
{
|
||||
get { return _activityName; }
|
||||
set { _activityName = value; }
|
||||
}
|
||||
|
||||
public bool MatchDerivedTypes
|
||||
{
|
||||
get { return _trackDerived; }
|
||||
set { _trackDerived = value; }
|
||||
}
|
||||
|
||||
public IList<ActivityExecutionStatus> ExecutionStatusEvents
|
||||
{
|
||||
get { return _events; }
|
||||
}
|
||||
|
||||
public TrackingConditionCollection Conditions
|
||||
{
|
||||
get { return _conditions; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Matching Methods
|
||||
|
||||
internal bool Match(Activity activity, bool typeMatchOnly)
|
||||
{
|
||||
if (null == activity)
|
||||
throw new ArgumentNullException("activity");
|
||||
//
|
||||
// Matching the type is generally going to be cheaper
|
||||
// so do it first and short circuit if we don't match
|
||||
if (!TypeIsMatch(activity))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (typeMatchOnly)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ConditionsAreMatch(activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Matching Methods
|
||||
|
||||
private bool TypeIsMatch(Activity activity)
|
||||
{
|
||||
if (null != _activityType)
|
||||
return TypeMatch.IsMatch(activity, _activityType, _trackDerived);
|
||||
else
|
||||
return TypeMatch.IsMatch(activity, _activityName, _trackDerived);
|
||||
}
|
||||
|
||||
private bool ConditionsAreMatch(object obj)
|
||||
{
|
||||
//
|
||||
// If any condition doesn't match the location doesn't match
|
||||
foreach (TrackingCondition c in _conditions)
|
||||
if (!c.Match(obj))
|
||||
return false;
|
||||
//
|
||||
// All conditions match
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contains data that is used to match code locations.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public sealed class UserTrackingLocation
|
||||
{
|
||||
#region Private Data Members
|
||||
|
||||
private string _keyName = null;
|
||||
|
||||
private Type _argType = null;
|
||||
private string _argName = null;
|
||||
private bool _trackDerivedArgs = false;
|
||||
|
||||
private Type _activityType = null;
|
||||
private string _activityName = null;
|
||||
private bool _trackDerivedActivities = false;
|
||||
|
||||
private TrackingConditionCollection _conditions = new TrackingConditionCollection();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public UserTrackingLocation()
|
||||
{
|
||||
}
|
||||
|
||||
public UserTrackingLocation(Type argumentType)
|
||||
{
|
||||
_argType = argumentType;
|
||||
}
|
||||
|
||||
public UserTrackingLocation(Type argumentType, Type activityType)
|
||||
{
|
||||
_argType = argumentType;
|
||||
_activityType = activityType;
|
||||
}
|
||||
|
||||
public UserTrackingLocation(Type argumentType, string activityTypeName)
|
||||
{
|
||||
_argType = argumentType;
|
||||
_activityName = activityTypeName;
|
||||
}
|
||||
|
||||
public UserTrackingLocation(string argumentTypeName)
|
||||
{
|
||||
_argName = argumentTypeName;
|
||||
}
|
||||
|
||||
public UserTrackingLocation(string argumentTypeName, string activityTypeName)
|
||||
{
|
||||
_argName = argumentTypeName;
|
||||
_activityName = activityTypeName;
|
||||
}
|
||||
|
||||
public UserTrackingLocation(string argumentTypeName, Type activityType)
|
||||
{
|
||||
_argName = argumentTypeName;
|
||||
|
||||
_activityType = activityType;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string KeyName
|
||||
{
|
||||
get { return _keyName; }
|
||||
set { _keyName = value; }
|
||||
}
|
||||
|
||||
public Type ArgumentType
|
||||
{
|
||||
get { return _argType; }
|
||||
set { _argType = value; }
|
||||
}
|
||||
|
||||
public string ArgumentTypeName
|
||||
{
|
||||
get { return _argName; }
|
||||
set { _argName = value; }
|
||||
}
|
||||
|
||||
public bool MatchDerivedArgumentTypes
|
||||
{
|
||||
get { return _trackDerivedArgs; }
|
||||
set { _trackDerivedArgs = value; }
|
||||
}
|
||||
|
||||
public Type ActivityType
|
||||
{
|
||||
get { return _activityType; }
|
||||
set { _activityType = value; }
|
||||
}
|
||||
|
||||
public string ActivityTypeName
|
||||
{
|
||||
get { return _activityName; }
|
||||
set { _activityName = value; }
|
||||
}
|
||||
|
||||
public bool MatchDerivedActivityTypes
|
||||
{
|
||||
get { return _trackDerivedActivities; }
|
||||
set { _trackDerivedActivities = value; }
|
||||
}
|
||||
|
||||
public TrackingConditionCollection Conditions
|
||||
{
|
||||
get { return _conditions; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Matching Methods
|
||||
|
||||
internal bool Match(Activity activity)
|
||||
{
|
||||
if (!ActTypeIsMatch(activity))
|
||||
return false;
|
||||
else
|
||||
return ConditionsAreMatch(activity);
|
||||
}
|
||||
|
||||
internal bool Match(Activity activity, string keyName, object arg)
|
||||
{
|
||||
return RuntimeMatch(activity, keyName, arg);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Matching Methods
|
||||
|
||||
private bool ActTypeIsMatch(Activity activity)
|
||||
{
|
||||
if (null != _activityType)
|
||||
return TypeMatch.IsMatch(activity, _activityType, _trackDerivedActivities);
|
||||
else
|
||||
return TypeMatch.IsMatch(activity, _activityName, _trackDerivedActivities);
|
||||
}
|
||||
|
||||
private bool RuntimeMatch(Activity activity, string keyName, object obj)
|
||||
{
|
||||
//
|
||||
// Check the excludes - if any exclude matches based on activity only we're not a match
|
||||
if (!ActTypeIsMatch(activity))
|
||||
return false;
|
||||
//
|
||||
// Check the name of the key, null means match all
|
||||
if (null != _keyName)
|
||||
{
|
||||
if (0 != String.Compare(_keyName, keyName, StringComparison.Ordinal))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (null != _argType)
|
||||
return TypeMatch.IsMatch(obj, _argType, _trackDerivedArgs);
|
||||
else
|
||||
return TypeMatch.IsMatch(obj, _argName, _trackDerivedArgs);
|
||||
}
|
||||
|
||||
private bool ConditionsAreMatch(object obj)
|
||||
{
|
||||
//
|
||||
// If any condition doesn't match the location doesn't match
|
||||
foreach (TrackingCondition c in _conditions)
|
||||
if (!c.Match(obj))
|
||||
return false;
|
||||
//
|
||||
// All conditions match
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
internal sealed class TypeMatch
|
||||
{
|
||||
private TypeMatch() { }
|
||||
|
||||
internal static bool IsMatch(object obj, string name, bool matchDerived)
|
||||
{
|
||||
Type objType = obj.GetType();
|
||||
if (0 == string.Compare(objType.Name, name, StringComparison.Ordinal))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// If we're not checking base types we're done
|
||||
if (!matchDerived)
|
||||
return false;
|
||||
//
|
||||
// Check interfaces (case sensitive)
|
||||
// This checks all interfaces (including interfaces on base types )
|
||||
if (null != objType.GetInterface(name))
|
||||
return true;
|
||||
//
|
||||
// Walk down the base types and look for a match
|
||||
Type b = objType.BaseType;
|
||||
while (b != null)
|
||||
{
|
||||
if (0 == string.Compare(b.Name, name, StringComparison.Ordinal))
|
||||
return true;
|
||||
|
||||
b = b.BaseType;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
internal static bool IsMatch(object obj, Type matchType, bool matchDerived)
|
||||
{
|
||||
Type objType = obj.GetType();
|
||||
//
|
||||
// First check if the type is a direct match.
|
||||
// Can't just use Type.IsInstanceOfType at this point because that matches bases and interfaces.
|
||||
// If not then use IsInstanceOfType to check bases and interfaces if we are matching derived
|
||||
if (objType == matchType)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
if (matchDerived)
|
||||
return matchType.IsInstanceOfType(obj);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Globalization;
|
||||
|
||||
//using System.Workflow.Activities;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Workflow.Runtime;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
using Hosting = System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
/// <summary>
|
||||
/// Used by TrackingProfile to hold ActivityTrackingLocations.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public class ActivityTrackingLocationCollection : List<ActivityTrackingLocation>
|
||||
{
|
||||
public ActivityTrackingLocationCollection()
|
||||
{
|
||||
}
|
||||
|
||||
public ActivityTrackingLocationCollection(IEnumerable<ActivityTrackingLocation> locations)
|
||||
{
|
||||
//
|
||||
// Not using the IEnumerable<T> constructor on the base List<T> so that we can check for null.
|
||||
// The code behind AddRange doesn't appear to have a significant perf
|
||||
// overhead compared to the IEnumerable<T> constructor if the list is empty
|
||||
// (which it will always be at this point).
|
||||
if (null == locations)
|
||||
throw new ArgumentNullException("locations");
|
||||
|
||||
AddRange(locations);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used by TrackingProfile to hold UserTrackingLocations.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public class UserTrackingLocationCollection : List<UserTrackingLocation>
|
||||
{
|
||||
public UserTrackingLocationCollection()
|
||||
{
|
||||
}
|
||||
|
||||
public UserTrackingLocationCollection(IEnumerable<UserTrackingLocation> locations)
|
||||
{
|
||||
//
|
||||
// Not using the IEnumerable<T> constructor on the base List<T> so that we can check for null.
|
||||
// The code behind AddRange doesn't appear to have a significant perf
|
||||
// overhead compared to the IEnumerable<T> constructor if the list is empty
|
||||
// (which it will always be at this point).
|
||||
if (null == locations)
|
||||
throw new ArgumentNullException("locations");
|
||||
|
||||
AddRange(locations);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Workflow.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
using System.Workflow.Runtime.Hosting;
|
||||
|
||||
namespace System.Workflow.Runtime.Tracking
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data useful when construction tracking channels
|
||||
/// </summary>
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public sealed class TrackingParameters
|
||||
{
|
||||
private Guid _instanceId = Guid.Empty;
|
||||
private Guid _callerInstanceId = Guid.Empty;
|
||||
private Type _workflowType = null;
|
||||
private IList<string> _activityCallPath = null;
|
||||
private Guid _contextGuid = Guid.Empty, _callerContextGuid = Guid.Empty, _callerParentContextGuid = Guid.Empty;
|
||||
private Activity _rootActivity = null;
|
||||
|
||||
private TrackingParameters()
|
||||
{
|
||||
}
|
||||
|
||||
public TrackingParameters(Guid instanceId, Type workflowType, Activity rootActivity, IList<string> callPath, Guid callerInstanceId, Guid contextGuid, Guid callerContextGuid, Guid callerParentContextGuid)
|
||||
{
|
||||
_instanceId = instanceId;
|
||||
_workflowType = workflowType;
|
||||
_activityCallPath = callPath;
|
||||
_callerInstanceId = callerInstanceId;
|
||||
_contextGuid = contextGuid;
|
||||
_callerContextGuid = callerContextGuid;
|
||||
_callerParentContextGuid = callerParentContextGuid;
|
||||
_rootActivity = rootActivity;
|
||||
}
|
||||
|
||||
public Guid InstanceId
|
||||
{
|
||||
get { return _instanceId; }
|
||||
}
|
||||
|
||||
public Type WorkflowType
|
||||
{
|
||||
get { return _workflowType; }
|
||||
}
|
||||
|
||||
public Activity RootActivity
|
||||
{
|
||||
get { return _rootActivity; }
|
||||
}
|
||||
|
||||
public IList<string> CallPath
|
||||
{
|
||||
get { return _activityCallPath; }
|
||||
}
|
||||
|
||||
public Guid CallerInstanceId
|
||||
{
|
||||
get { return _callerInstanceId; }
|
||||
}
|
||||
|
||||
public Guid ContextGuid
|
||||
{
|
||||
get { return _contextGuid; }
|
||||
}
|
||||
|
||||
public Guid CallerContextGuid
|
||||
{
|
||||
get { return _callerContextGuid; }
|
||||
}
|
||||
|
||||
public Guid CallerParentContextGuid
|
||||
{
|
||||
get { return _callerParentContextGuid; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user