Пример #1
0
        public static void AddRpc(this IServiceCollection services, Action <RpcServerConfiguration> configure)
        {
            var configuration = new RpcServerConfiguration();

            configure(configuration);
            services.AddSingleton(new RpcService(configuration));
        }
Пример #2
0
        internal static string GetFunctionName(string route, RpcServerConfiguration configuration)
        {
            route = RemoveLeadingSlash(route);
            var tokens = route.Split('/');

            return(tokens[2]);
        }
Пример #3
0
        internal static bool IsValidRpcRoute(string route, RpcServerConfiguration configuration)
        {
            if (route == null)
            {
                return(false);
            }

            route = RemoveLeadingSlash(route);
            if (!route.StartsWith(configuration.FunctionNamePrefix))
            {
                return(false);
            }

            var tokens = route.Split('/');

            if (tokens.Length < 3)
            {
                return(false);
            }

            return(true);
        }
Пример #4
0
 public FunctionsAnalyzer(RpcServerConfiguration rpcServerConfiguration)
 {
     this.rpcServerConfiguration = rpcServerConfiguration;
 }
Пример #5
0
 public static void AddRpc(this IServiceCollection services, RpcServerConfiguration configuration = null)
 {
     services.AddSingleton(new RpcService(configuration ?? new RpcServerConfiguration()));
 }
Пример #6
0
 internal RpcService(RpcServerConfiguration configuration)
 {
     Configuration = configuration;
     AnalyzeFunctions();
 }
Пример #7
0
 internal RpcService()
 {
     Configuration = new RpcServerConfiguration();
     AnalyzeFunctions();
 }