Exemplo n.º 1
0
        private static void RegisterImplementationServices <TAppSettings>(
            IServiceCollection services,
            SignServiceOptions <TAppSettings> options,
            IReloadingManager <TAppSettings> settings)

            where TAppSettings : BaseSignServiceSettings
        {
            services.AddTransient(s => options.AddressGeneratorFactory(new ServiceFactoryContext <TAppSettings>(s, settings)));
            services.AddTransient(s => options.TransactionSignerFactory(new ServiceFactoryContext <TAppSettings>(s, settings)));
        }
Exemplo n.º 2
0
        private static SignServiceOptions <TAppSettings> GetOptions <TAppSettings>(Action <SignServiceOptions <TAppSettings> > configureOptions)
            where TAppSettings : BaseSignServiceSettings
        {
            var options = new SignServiceOptions <TAppSettings>();

            configureOptions(options);

            if (string.IsNullOrWhiteSpace(options.IntegrationName))
            {
                throw new InvalidOperationException($"{nameof(options)}.{nameof(options.IntegrationName)} is required.");
            }
            if (options.TransactionSignerFactory == null)
            {
                throw new InvalidOperationException($"{nameof(options)}.{nameof(options.TransactionSignerFactory)} is required.");
            }
            if (options.AddressGeneratorFactory == null)
            {
                throw new InvalidOperationException($"{nameof(options)}.{nameof(options.AddressGeneratorFactory)} is required.");
            }

            return(options);
        }