Beispiel #1
0
        private static ICS_RefCode GetDataConfig()
        {
            string className, profilePath;

            string dataBaseType = ConfigurationManager.AppSettings["DataBaseType"] as string;

            switch (dataBaseType)
            {
            case "ORACLE":
                className   = "SinoSZRefTableDC.OraRefTableFactory";
                profilePath = "SinoSZRefTableDC";
                return((ICS_RefCode)Assembly.Load(profilePath).CreateInstance(className));

            case "SQLSERVER":
                className   = "SinoSZRefTableDC.SqlRefTableFactory";
                profilePath = "SinoSZRefTableDC";
                return((ICS_RefCode)Assembly.Load(profilePath).CreateInstance(className));

            case "REMOTING":
                IServiceFactory _serviceFactory = (IServiceFactory)RemotingClientSvc.GetAppSvrObj(typeof(IServiceFactory));
                RemotingClientSvc.BindTicketToCallContext(SessionClass.CurrentTicket);
                ICS_RefCode _ret = _serviceFactory.GetInterFace("RefTableServerPlugin") as ICS_RefCode;
                return(_ret);
            }

            return(null);
        }
        /// <summary>
        /// 通过Remoting 接口创建远程接口对象
        /// </summary>
        virtual protected void CreateObject()
        {
            IServiceFactory _serviceFactory = (IServiceFactory)RemotingClientSvc.GetAppSvrObj(typeof(IServiceFactory));

            RemotingClientSvc.BindTicketToCallContext(SessionClass.CurrentTicket);
            MarshalByRefObject _ret = _serviceFactory.GetInterFace(InterfaceName) as MarshalByRefObject;

            ILease clease = (ILease)_ret.GetLifetimeService();

            sponsor = new SinoSZClientSponsor();
            clease.Register(sponsor);            //为自己注册生存期租约主办方
            remoteObject = _ret;
        }
Beispiel #3
0
        public static ISinoMenu GetMenuInterface()
        {
            string className, profilePath;

            string dataBaseType = ConfigurationManager.AppSettings["DataBaseType"] as string;

            switch (dataBaseType)
            {
            case "ORACLE":
                return(null);

            case "SQLSERVER":
                return(null);

            case "REMOTING":
                IServiceFactory _serviceFactory = (IServiceFactory)RemotingClientSvc.GetAppSvrObj(typeof(IServiceFactory));
                RemotingClientSvc.BindTicketToCallContext(SessionClass.CurrentTicket);
                ISinoMenu _ret = _serviceFactory.GetInterFace("MenuServerPlugin") as ISinoMenu;
                return(_ret);
            }

            return(null);
        }