Пример #1
0
        public static EncryptionServicesBuilder AddDataProtector <TOptions>(
            this EncryptionServicesBuilder builder, Type dataProtector,
            Type implementation, Action <TOptions> configure = null)
            where TOptions : class
        {
            builder
            .ServiceCollection
            .AddSingleton(dataProtector, implementation);

            if (configure != null)
            {
                builder.ServiceCollection.Configure(configure);
            }

            return(builder);
        }
Пример #2
0
        public static EncryptionServicesBuilder AddEfEncryption(this IServiceCollection services,
                                                                Action <EncryptionServicesOptions> configure = null)
        {
            services.AddSingleton <ValueConverterResolver>();
            services.AddSingleton <IModelCustomizer, EncryptedModelCustomizer>();

            var builder = new EncryptionServicesBuilder(services);

            if (configure != null)
            {
                services.Configure(configure);
            }

            services.ConfigureOptions <EncryptionsServicesOptionsPostConfigure>();

            return(builder);
        }
Пример #3
0
 public static EncryptionServicesBuilder AddDataHasher <TImplementation, TOptions>(
     this EncryptionServicesBuilder builder, Action <TOptions> configure = null)
     where TImplementation : IDataHasher
     where TOptions : class =>
 builder.AddDataProtector(typeof(IDataHasher), typeof(TImplementation), configure);