mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-20 18:47:55 +08:00
优化autofac注入方式,Controller使用属性注入
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user