mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
26 lines
742 B
C#
26 lines
742 B
C#
using Autofac;
|
|
|
|
namespace Orchard.Tests.Stubs {
|
|
public class StubWorkContextScope : IWorkContextScope {
|
|
private readonly ILifetimeScope _lifetimeScope;
|
|
|
|
public StubWorkContextScope(WorkContext workContext, ILifetimeScope lifetimeScope) {
|
|
_lifetimeScope = lifetimeScope;
|
|
WorkContext = workContext;
|
|
}
|
|
|
|
public WorkContext WorkContext { get; private set; }
|
|
|
|
public void Dispose() {
|
|
_lifetimeScope.Dispose();
|
|
}
|
|
|
|
public TService Resolve<TService>() {
|
|
return WorkContext.Resolve<TService>();
|
|
}
|
|
|
|
public bool TryResolve<TService>(out TService service) {
|
|
return WorkContext.TryResolve(out service);
|
|
}
|
|
}
|
|
} |