public object Create(object parent, object configContext, System.Xml.XmlNode section) { CastleFactoryConfiguration config = new CastleFactoryConfiguration(); config.LoadValuesFromConfigurationXml(section); return(config); }
/// <summary> /// 获取远程对象配置 /// </summary> /// <returns></returns> public static CastleFactoryConfiguration GetConfig() { string key = "mysoft.framework/castleFactory"; CastleFactoryConfiguration obj = CacheHelper.Get <CastleFactoryConfiguration>(key); if (obj == null) { var tmp = ConfigurationManager.GetSection(key); obj = tmp as CastleFactoryConfiguration; CacheHelper.Permanent(key, obj); } return(obj); }
/// <summary> /// Initializes a new instance of the <see cref="ServiceInvocationHandler"/> class. /// </summary> /// <param name="config"></param> /// <param name="container"></param> /// <param name="service"></param> /// <param name="serviceType"></param> /// <param name="cache"></param> public ServiceInvocationHandler(CastleFactoryConfiguration config, IServiceContainer container, IService service, Type serviceType, ICacheStrategy cache, IServiceLog logger) { this.config = config; this.container = container; this.serviceType = serviceType; this.service = service; this.cache = cache; this.logger = logger; this.hostName = DnsHelper.GetHostName(); this.ipAddress = DnsHelper.GetIPAddress(); this.cacheTimes = new Dictionary<string, int>(); var methods = CoreHelper.GetMethodsFromType(serviceType); foreach (var method in methods) { var contract = CoreHelper.GetMemberAttribute<OperationContractAttribute>(method); if (contract != null && contract.CacheTime > 0) cacheTimes[method.ToString()] = contract.CacheTime; } }
public object Create(object parent, object configContext, System.Xml.XmlNode section) { CastleFactoryConfiguration config = new CastleFactoryConfiguration(); config.LoadValuesFromConfigurationXml(section); return config; }
/// <summary> /// Initializes a new instance of the <see cref="ServiceInvocationHandler"/> class. /// </summary> /// <param name="config"></param> /// <param name="container"></param> /// <param name="service"></param> /// <param name="serviceType"></param> /// <param name="cache"></param> public LocalInvocationHandler(CastleFactoryConfiguration config, IServiceContainer container, IService service, Type serviceType, ICacheStrategy cache, IServiceLog logger) : base(config, container, service, serviceType, cache, logger) { this.container = container; //TO DO }