Skip to content

Instantly share code, notes, and snippets.

@denza
Created April 3, 2014 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denza/9954239 to your computer and use it in GitHub Desktop.
Save denza/9954239 to your computer and use it in GitHub Desktop.
public interface IMyCustomProvider:IDependecy
{
object DoSomething(object param);
}
public class MyService
{
private readonly IMyCustomProvider _myProvider;
private readonly IWorkContextAccessor _workContextAccessor;
public IMyCustomProvider MyProvider
{
if(_myProvider == null)
_myProvider = _workContextAccessor.GetContext().Resolve<IMyCustomProvider>();
return _myProvider;
}
public MyService(IWorkContextAccessor workContextAccessor)
{
_workContextAccessor = workContextAccessor
}
public object MyServiceMethod(object param)
{
return MyProvider.DoSomething(param);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment