Ejemplo n.º 1
0
        /// <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);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 /// <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);
 }