Esempio n. 1
0
 static void AddMessageFilter <TModel, TFilter>(MessageType msgType)
     where TFilter : IMessageFilter
 {
     _tcpServer.AddFilter((ushort)msgType, new MessageFilterInfo
     {
         Type   = typeof(TModel),
         Filter = NinjectCommon.Resolve <TFilter>()
     });
 }
Esempio n. 2
0
        static void InitNinject()
        {
            NinjectCommon.Start(bindingRoot =>
            {
                bindingRoot.Bind <IDbFactory>().ToConstant(DbFactory.Instance);

                bindingRoot.Bind <IUserDal>().To <UserDal>();
                bindingRoot.Bind <IUserBll>().To <UserBll>();

                bindingRoot.Bind <IShopDal>().To <ShopDal>();
                bindingRoot.Bind <IShopBll>().To <ShopBll>();

                bindingRoot.Bind <IUserSubAccountDal>().To <UserSubAccountDal>();
                bindingRoot.Bind <IUserSubAccountBll>().To <UserSubAccountBll>();

                bindingRoot.Bind <IOrderRecordDal>().To <OrderRecordDal>();
                bindingRoot.Bind <IOrderRecordBll>().To <OrderRecordBll>();

                bindingRoot.Bind <IOrderTypeDal>().To <OrderTypeDal>();
                bindingRoot.Bind <IOrderTypeBll>().To <OrderTypeBll>();

                bindingRoot.Bind <IHangUpTimeDal>().To <HangUpTimeDal>();
                bindingRoot.Bind <IHangUpTimeBll>().To <HangUpTimeBll>();

                bindingRoot.Bind <IUserSubAccountUsageInfoDal>().To <UserSubAccountUsageInfoDal>();
                bindingRoot.Bind <IUserSubAccountUsageInfoBll>().To <UserSubAccountUsageInfoBll>();

                bindingRoot.Bind <IUserSubAccountOrderTypeInfoDal>().To <UserSubAccountOrderTypeInfoDal>();
                bindingRoot.Bind <IUserSubAccountOrderTypeInfoBll>().To <UserSubAccountOrderTypeInfoBll>();

                bindingRoot.Bind <IUpdateInfoDal>().To <UpdateInfoDal>();
                bindingRoot.Bind <IUpdateInfoBll>().To <UpdateInfoBll>();

                bindingRoot.Bind <GoldCalculator>().ToSelf().InSingletonScope();

                bindingRoot.Bind <UserMessageFilter>().ToSelf().InSingletonScope();
                bindingRoot.Bind <ShopMessageFilter>().ToSelf().InSingletonScope();
                bindingRoot.Bind <UserSubAccountMessageFilter>().ToSelf().InSingletonScope();
                bindingRoot.Bind <RemoteOperationMessageFilter>().ToSelf().InSingletonScope();
                bindingRoot.Bind <OrderRecordMessageFilter>().ToSelf().InSingletonScope();
                bindingRoot.Bind <OrderTypeMessageFilter>().ToSelf().InSingletonScope();
            });
        }
Esempio n. 3
0
 internal static T Resolve <T>(string name)
 {
     return(NinjectCommon.Resolve <T>(name));
 }
Esempio n. 4
0
 internal static T Resolve <T>()
 {
     return(NinjectCommon.Resolve <T>());
 }
Esempio n. 5
0
 internal static void UnInit()
 {
     _tcpServer.Close();
     Resolve <GoldCalculator>().Dispose();
     NinjectCommon.Stop();
 }