Skip to content

Commit

Permalink
Merge pull request #133 from PHOENIXCONTACT/remove/ITracing
Browse files Browse the repository at this point in the history
Remove tracing interface
  • Loading branch information
dbeuchler authored Dec 2, 2021
2 parents c9f2915 + 2268d7b commit 942fd0c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 73 deletions.
4 changes: 2 additions & 2 deletions src/Moryx.AbstractionLayer/Activities/Activity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public abstract class Activity : IActivity
public IProcess Process { get; set; }

///
public IActivityTracing Tracing { get; set; }
public Tracing Tracing { get; set; }

///
public ActivityResult Result { get; set; }
Expand Down Expand Up @@ -103,7 +103,7 @@ public override string ToString()
/// <typeparam name="TTracing">Type of the tracing object.</typeparam>
public abstract class Activity<TParam, TTracing> : Activity, IActivity<TParam>
where TParam : IParameters
where TTracing : IActivityTracing, new()
where TTracing : Tracing, new()
{
/// <summary>
/// Creates a new instance of <see cref="Activity{TParam,TTracing}"/>
Expand Down
2 changes: 1 addition & 1 deletion src/Moryx.AbstractionLayer/Activities/IActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface IActivity : IDisposable
/// <summary>
/// All activity trace information
/// </summary>
IActivityTracing Tracing { get; }
Tracing Tracing { get; }

/// <summary>
/// Specifies the special process requirements of this type
Expand Down
16 changes: 0 additions & 16 deletions src/Moryx.AbstractionLayer/Activities/IActivityProgress.cs

This file was deleted.

42 changes: 0 additions & 42 deletions src/Moryx.AbstractionLayer/Activities/IActivityTracing.cs

This file was deleted.

20 changes: 14 additions & 6 deletions src/Moryx.AbstractionLayer/Activities/Tracing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,26 @@ namespace Moryx.AbstractionLayer
/// Activity trace information
/// </summary>
[DataContract]
public class Tracing : IActivityTracing
public class Tracing
{
/// <inheritdoc />
/// <summary>
/// The time when this activity was started.
/// </summary>
public DateTime? Started { get; set; }

/// <inheritdoc />
/// <summary>
/// The time when this activity was finished.
/// </summary>
public DateTime? Completed { get; set; }

/// <inheritdoc />
/// <summary>
/// Optional tracing text for errors or information
/// </summary>
public string Text { get; set; }

/// <inheritdoc />
/// <summary>
/// Contains the error code that is associated with the error that caused e.g. an activity failure
/// </summary>
public int ErrorCode { get; set; }

/// <summary>
Expand All @@ -33,7 +41,7 @@ public class Tracing : IActivityTracing
///
// ReSharper disable once InconsistentNaming <-- too cool to rename :P
public Sparta Transform<Sparta>() where Sparta
: class, IActivityTracing, new()
: Tracing, new()
{
if (this is Sparta)
return this as Sparta;
Expand Down
4 changes: 2 additions & 2 deletions src/Moryx.AbstractionLayer/Activities/TracingExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class TracingExtension
/// <summary>
/// Transform tracing type on activity
/// </summary>
public static T TransformTracing<T>(this IActivity activity) where T : class, IActivityTracing, new()
public static T TransformTracing<T>(this IActivity activity) where T : Tracing, new()
{
var baseType = (Activity) activity;
var tracing = baseType.Tracing.Transform<T>();
Expand All @@ -23,7 +23,7 @@ public static class TracingExtension
/// </summary>
/// <param name="activityTracing">Tracing to add information to</param>
/// <param name="setter">Setter delegate</param>
public static T Trace<T>(this T activityTracing, Action<T> setter) where T : class, IActivityTracing, new()
public static T Trace<T>(this T activityTracing, Action<T> setter) where T : Tracing, new()
{
setter(activityTracing);
return activityTracing;
Expand Down
6 changes: 2 additions & 4 deletions src/Tests/Moryx.AbstractionLayer.Tests/TracingActivityTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,12 @@ private enum FooProgress
Done = 100
}

private class FooTracing : Tracing, IActivityProgress
private class FooTracing : Tracing
{
public string FooName { get; set; }

public int FooNumber { get; set; }

public double Relative => base.Progress;


public new FooProgress Progress
{
get { return (FooProgress) base.Progress; }
Expand Down

0 comments on commit 942fd0c

Please sign in to comment.