|
@@ -26,7 +26,7 @@ using CSScriptLib;
|
|
|
|
|
|
namespace WingCloudServer
|
|
|
{
|
|
|
- internal class WingServer
|
|
|
+ public class WingServer
|
|
|
{
|
|
|
private JsonRpcServer _rpcHttpServer;
|
|
|
private JsonRpcServer _rpcInProcessServer;
|
|
@@ -34,7 +34,7 @@ namespace WingCloudServer
|
|
|
private JsonRpcHttpServerEngine _jsonRpcHttpServerEngine;
|
|
|
private Dictionary<Type, object> _rpcServices;
|
|
|
private static JsonRpcClientPool _rpcClientPool;
|
|
|
- private static Dictionary<string, object> _remoteServices;
|
|
|
+ private static Dictionary<string, object> _remoteServices = new Dictionary<string, object>();
|
|
|
|
|
|
|
|
|
public WingServer(string host)
|
|
@@ -83,7 +83,7 @@ namespace WingCloudServer
|
|
|
/// </summary>
|
|
|
/// <param name="serviceName"></param>
|
|
|
/// <param name="url"></param>
|
|
|
- internal static void AddRemoteService<T>(string serviceName, string url)
|
|
|
+ public static void AddRemoteService<T>(string serviceName, string url)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -107,7 +107,7 @@ namespace WingCloudServer
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- internal static object WingServerGetProxy(string serviceName)
|
|
|
+ public static object WingServerGetProxy(string serviceName)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -245,7 +245,7 @@ namespace WingCloudServer
|
|
|
slaveInteractionCenterService.Load(rpcClientPool);
|
|
|
|
|
|
var eval = CSScript.Evaluator.ReferenceDomainAssemblies(DomainAssemblies.AllStaticNonGAC);
|
|
|
- var str = @"
|
|
|
+ var str = @$"
|
|
|
using System;
|
|
|
using System.Threading.Tasks;
|
|
|
using WingServerCommon.Service;
|
|
@@ -255,32 +255,32 @@ namespace WingCloudServer
|
|
|
using WingInterfaceLibrary.Interface.DBInterface;
|
|
|
using WingInterfaceLibrary.DB.Request;
|
|
|
|
|
|
- public interface IDynamicSlaveService" + serverID + @"
|
|
|
- {
|
|
|
+ public interface IDynamicSlaveService{serverID}
|
|
|
+ {{
|
|
|
Task<bool> DynamicSlaveAsync(SyncReceiveServiceDataRequest request);
|
|
|
- }
|
|
|
- public class DynamicSlaveService : JsonRpcService,IDynamicSlaveService" + serverID + @"
|
|
|
- {
|
|
|
+ }}
|
|
|
+ public class DynamicSlaveService : JsonRpcService,IDynamicSlaveService{serverID}
|
|
|
+ {{
|
|
|
protected ISlaveInteractionCenterService _slaveInteractionCenterService;
|
|
|
public override void Load(JsonRpcClientPool jsonRpcClientPool)
|
|
|
- {
|
|
|
+ {{
|
|
|
base.Load(jsonRpcClientPool);
|
|
|
_slaveInteractionCenterService = GetProxy<ISlaveInteractionCenterService>();
|
|
|
- }
|
|
|
+ }}
|
|
|
public async Task<bool> DynamicSlaveAsync(SyncReceiveServiceDataRequest request)
|
|
|
- {
|
|
|
+ {{
|
|
|
await _slaveInteractionCenterService.SyncReceiveMasterServiceDataAsync(request);
|
|
|
return true;
|
|
|
- }
|
|
|
- }
|
|
|
+ }}
|
|
|
+ }}
|
|
|
public class DynamicMethodClass
|
|
|
- {
|
|
|
- public void DynamicMethod(JsonRpcClientPool rpcClientPool,JsonRpcServer _rpcHttpServer){
|
|
|
+ {{
|
|
|
+ public void DynamicMethod(JsonRpcClientPool rpcClientPool,JsonRpcServer _rpcHttpServer) {{
|
|
|
var DynamicSlaveService = new DynamicSlaveService();
|
|
|
- _rpcHttpServer.RegisterService(typeof(IDynamicSlaveService" + serverID + @"), DynamicSlaveService);
|
|
|
+ _rpcHttpServer.RegisterService(typeof(IDynamicSlaveService{serverID}), DynamicSlaveService);
|
|
|
DynamicSlaveService.Load(rpcClientPool);
|
|
|
- }
|
|
|
- }
|
|
|
+ }}
|
|
|
+ }}
|
|
|
";
|
|
|
Assembly compilecode = eval.CompileCode(str);
|
|
|
var ps = compilecode.GetType("css_root+DynamicMethodClass");
|