/// <summary> /// Register exist services which marked with RpcService attribute. /// </summary> private void RegisterRpcServices() { var types = Assembly.GetEntryAssembly()?.GetTypes(); if (types != null) { foreach (var type in types) { var serviceAttributes = type.GetCustomAttributes(typeof(RpcServiceAttribute), false); if (serviceAttributes.Length > 0) { var service = type.New(); JsonRpcCallManager.RegisterService(service); } } } }
/// <summary> /// Register a service with its interface. /// </summary> /// <typeparam name="T">The interface of the service.</typeparam> /// <param name="service">The service to register.</param> public void RegisterService <T>(T service) { JsonRpcCallManager.RegisterService(service); }