forked from dotnetcore/AspectCore-Framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScopeAspectContext.cs
More file actions
85 lines (67 loc) · 2.93 KB
/
Copy pathScopeAspectContext.cs
File metadata and controls
85 lines (67 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using AspectCore.DynamicProxy;
namespace AspectCore.Extensions.AspectScope
{
//[NonAspect]
//internal sealed class ScopeAspectContext : AspectContext, IDisposable
//{
// private static readonly AsyncLocal<AspectContext> CurrentRuntimeContext = new AsyncLocal<AspectContext>();
// private readonly IAspectScheduler _aspectContextScheduler;
// private readonly AspectContext _runtimeContext;
// internal int Id { get; set; }
// internal AspectContext RuntimeContext
// {
// get => CurrentRuntimeContext.Value;
// private set => CurrentRuntimeContext.Value = value;
// }
// public override IServiceProvider ServiceProvider => _runtimeContext.ServiceProvider;
// public override IDictionary<string, object> AdditionalData => _runtimeContext.AdditionalData;
// public override object ReturnValue { get => _runtimeContext.ReturnValue; set => _runtimeContext.ReturnValue = value; }
// public override MethodInfo ServiceMethod => _runtimeContext.ServiceMethod;
// public override object[] Parameters => _runtimeContext.Parameters;
// public override MethodInfo ProxyMethod => _runtimeContext.ProxyMethod;
// public override object Implementation => _runtimeContext.Implementation;
// public override MethodInfo ImplementationMethod => _runtimeContext.ImplementationMethod;
// public override object Proxy => _runtimeContext.Proxy;
// internal ScopeAspectContext(AspectContext runtimeContext, IAspectScheduler aspectContextScheduler)
// {
// _aspectContextScheduler = aspectContextScheduler;
// if (!_aspectContextScheduler.TryEnter(this))
// {
// throw new InvalidOperationException("Error occurred in the schedule AspectContext.");
// }
// RuntimeContext = _runtimeContext = runtimeContext;
// var trace = new System.Diagnostics.StackTrace();
// var frames = trace.GetFrames();
// }
// //protected override void Dispose(bool disposing)
// //{
// // _runtimeContext.Dispose();
// // _aspectContextScheduler.Release(this);
// // RuntimeContext = null;
// //}
// public override Task Break()
// {
// return _runtimeContext.Break();
// }
// public override Task Complete()
// {
// return _runtimeContext.Complete();
// }
// public override Task Invoke(AspectDelegate next)
// {
// return _runtimeContext.Invoke(next);
// }
// public void Dispose()
// {
// (_runtimeContext as
// IDisposable).Dispose();
// _aspectContextScheduler.Release(this);
// RuntimeContext = null;
// }
//}
}