Skip to content

Commit

Permalink
Update resolver scope interface
Browse files Browse the repository at this point in the history
  • Loading branch information
usausa committed Jan 28, 2019
1 parent c61a708 commit 6dfbf39
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 15 deletions.
12 changes: 12 additions & 0 deletions Smart.Resolver/Resolver/ResolverScopeStorage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Smart.Resolver.Components
{
using System;

internal sealed class ResolverScopeStorage : IDisposable
{
public void Dispose()
{
// TODO
}
}
}
7 changes: 7 additions & 0 deletions Smart.Resolver/Resolver/ResolverScopeStorageAccessor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Smart.Resolver.Components
{
internal sealed class ResolverScopeStorageAccessor
{
// TODO AsyncLocal
}
}
6 changes: 0 additions & 6 deletions Smart.Resolver/Resolver/Scopes/ResolverScopeAccessor.cs

This file was deleted.

122 changes: 113 additions & 9 deletions Smart.Resolver/Resolver/SmartResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/// <summary>
///
/// </summary>
public sealed class SmartResolver : DisposableObject, IKernel, IScopeResolverSupport
public sealed class SmartResolver : IKernel, IScopeResolverSupport, IDisposable
{
private sealed class FactoryEntry
{
Expand Down Expand Up @@ -74,15 +74,9 @@ public SmartResolver(IResolverConfig config)
/// <summary>
///
/// </summary>
/// <param name="disposing"></param>
protected override void Dispose(bool disposing)
public void Dispose()
{
if (disposing)
{
Components.Dispose();
}

base.Dispose(disposing);
Components.Dispose();
}

// ------------------------------------------------------------
Expand Down Expand Up @@ -292,5 +286,115 @@ private Action<object>[] CreateTypeInjectors(Type type)
.Where(x => x != null)
.ToArray();
}

// ------------------------------------------------------------
// Scope
// ------------------------------------------------------------

public IResolver CreateScopeResolver()
{
return new ScopeResolver(this);
}

private sealed class ScopeResolver : IResolver, IDisposable
{
private readonly SmartResolver resolver;

public ScopeResolver(SmartResolver resolver)
{
this.resolver = resolver;
}

public bool CanGet<T>()
{
// TODO
return resolver.CanGet<T>();
}

public bool CanGet<T>(IConstraint constraint)
{
throw new NotImplementedException();
}

public bool CanGet(Type type)
{
throw new NotImplementedException();
}

public bool CanGet(Type type, IConstraint constraint)
{
throw new NotImplementedException();
}

public bool TryGet<T>(out T obj)
{
throw new NotImplementedException();
}

public bool TryGet<T>(IConstraint constraint, out T obj)
{
throw new NotImplementedException();
}

public bool TryGet(Type type, out object obj)
{
throw new NotImplementedException();
}

public bool TryGet(Type type, IConstraint constraint, out object obj)
{
throw new NotImplementedException();
}

public T Get<T>()
{
throw new NotImplementedException();
}

public T Get<T>(IConstraint constraint)
{
throw new NotImplementedException();
}

public object Get(Type type)
{
throw new NotImplementedException();
}

public object Get(Type type, IConstraint constraint)
{
throw new NotImplementedException();
}

public IEnumerable<T> GetAll<T>()
{
throw new NotImplementedException();
}

public IEnumerable<T> GetAll<T>(IConstraint constraint)
{
throw new NotImplementedException();
}

public IEnumerable<object> GetAll(Type type)
{
throw new NotImplementedException();
}

public IEnumerable<object> GetAll(Type type, IConstraint constraint)
{
throw new NotImplementedException();
}

public void Inject(object instance)
{
throw new NotImplementedException();
}

public void Dispose()
{
// TODO
}
}
}
}

0 comments on commit 6dfbf39

Please sign in to comment.