0
jsluong created
I have ITaskAppService & TaskAppService.
I'm planing to use TaskAppService in my _Layout.cshtml view, but doesn't know how to create an instant of it.
Should I use ITaskAppService task = new TaskAppService()?
Please help me out.
Thank you!
2 Answer(s)
-
0
Hi,
There must be a [*ViewBase] class in your Web project under Views folder. Add a property to it like this.
public ITaskAppService TaskAppService { get; private set; }
then set it in the constructor of your ViewBase's constructor like this.
TaskAppService = IocManager.Instance.Resolve<ITaskAppService>();
Then you should be able to use @TaskAppService in your cshtml files.
-
0
Thank you for your help!!!