Ejemplo n.º 1
0
        public static T GetService <T>()
        {
            var temp = _container.Resolve <T>();

            if (!(temp is IAop))
            {
                return(temp);
            }

            var enableLogFunctionData = false;

            bool.TryParse(ConfigurationManager.AppSettings["EnableLogFunctionData"], out enableLogFunctionData);

            var enableCustomCache = false;

            bool.TryParse(ConfigurationManager.AppSettings["EnableCustomCache"], out enableCustomCache);

            if (!enableLogFunctionData && !enableCustomCache)
            {
                return(temp);
            }

            var tempProxy    = new AopProxy <T>(temp);
            var proxyService = (T)tempProxy.GetTransparentProxy();

            return(proxyService);
        }
Ejemplo n.º 2
0
        public override MarshalByRefObject CreateInstance(Type serverType)
        {
            var target       = base.CreateInstance(serverType);
            var aopRealProxy = new AopProxy(serverType, target);

            aopRealProxy.InjectInterception(_interception, _enablePreInterception, _enableAfterInterception,
                                            _enableArroundInterception);
            return(aopRealProxy.GetTransparentProxy() as MarshalByRefObject);
        }