/// <summary> /// 这个是每个服务调用的最终出口 /// </summary> /// <param name="SqlStr">过程名称</param> /// <param name="parames">字符串拼接的参数</param> /// <param name="split">参数的分隔符</param> /// <returns></returns> public string executeSql(string SqlStr, string parames, string split) { if (!string.IsNullOrEmpty(SqlStr)) { this.sqlStr = SqlStr; } this.parames = parames; this.split = split; //根据配置文件决定调用哪个接口 string callService = ConfigUtil.getConfigService(this.sqlStr); if (callService == "Update_Data_String") { return(this.executeResult = ServiceInvoke.Update_Data_String(this.sqlStr, parames, split)); } if (callService == "Execute_Sql") { return(this.executeResult = ServiceInvoke.Execute_Sql(this.sqlStr, parames, split)); } return(""); }
/// <summary> /// 同步所有孩子节点的数据 /// </summary> public void SyncChildrenData() { if (HasChildren) { foreach (var n in _node.Children) { if (!string.IsNullOrEmpty(n.Url)) { int max = int.Parse(AppSettingCache.Instance["SyncFileNum"]); for (int i = 1; i <= max; i++) { var path = string.Format("{0}/Config/Buffer/{1}", AppDomain.CurrentDomain.BaseDirectory, AppSettingCache.Instance[i.ToString()]); using (var file = new FileStream(path, FileMode.Open)) { var binding = new NetTcpBinding("SyncBinding"); var service = ServiceInvoke <ISyncService> .CreateContract(binding, n.Url); ServiceInvoke <ISyncService> .Invoke(service, proxy => proxy.Excute(file)); } } _logger.Info(string.Format("成功同步孩子节点{0}的数据", n.Url)); } } } }
/// <summary> /// Initialization information for gateway service. ///</summary> public TestGatewayService(MemberInfo memberInfo) { MemberInfo = memberInfo; HttpHandler = new HttpHandlerHelper(MemberInfo.UriString); TokenResponse = ServiceInvoke.InitAsync(MemberInfo, HttpHandler); if (TokenResponse.StatusCode == 200) { LockerManager = new LockerManager(MemberInfo.ConfigurationPath); } if (LockerManager != null) { ScannerInit = ScannerServiceHelper.Start(LockerManager); } }