优化autofac注入方式,Controller使用属性注入

This commit is contained in:
yubaolee
2017-03-24 15:35:52 +08:00
parent 9122bec093
commit 96a9ee6bd2
20 changed files with 1948 additions and 2029 deletions

View File

@@ -12,19 +12,14 @@ namespace OpenAuth.Mvc.Controllers
{
public class RelevanceManagerController : BaseController
{
private RevelanceManagerApp _app;
public RelevanceManagerController()
{
_app = AutofacExt.GetFromFac<RevelanceManagerApp>();
}
public RevelanceManagerApp App { get; set; }
[HttpPost]
public string Assign(string type, Guid firstId, Guid[] secIds)
{
try
{
_app.Assign(type, firstId, secIds);
App.Assign(type, firstId, secIds);
}
catch (Exception ex)
{
@@ -38,7 +33,7 @@ namespace OpenAuth.Mvc.Controllers
{
try
{
_app.UnAssign(type, firstId, secIds);
App.UnAssign(type, firstId, secIds);
}
catch (Exception ex)
{