后台管理_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 .

 

posted @ 2018-06-12 11:09  sujingnuli  阅读(383)  评论(0编辑  收藏  举报