后台管理_GMS_1

1.ServiceContext .存在与页面缓存周期 HttpContext.Current.Items.

  //GMS.Web

  public class WebControllerBase:FrameControllerBase{

    public virtual IAccountService AccountService{

      get{

        return ServiceContext.Current.AccountService;

        }

    }

  }

  //GMS.Web

  public class ServiceContext{

    public  static ServiceContext Current{

      get{

          return CacheHelper.GetItem<ServiceContext>("ServiceContext",()=>new ServiceContext());

        }

      }

   }

2.通过ServiceFactory创建Service ,并且增加AOP .

原文地址:https://www.cnblogs.com/sujingnuli/p/9172120.html