Created
April 3, 2014 13:22
-
-
Save denza/9954239 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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