コード例 #1
0
        public ICrypt GetCrypt(string storageName, EncryptionSettings encryptionSettings)
        {
            ICrypt result = null;

            using var scope = Container.BeginLifetimeScope();
            if (scope != null)
            {
                result = scope.Resolve <ICrypt>();
            }

            result ??= new FakeCrypt();
            result.Init(storageName, encryptionSettings);
            return(result);
        }
コード例 #2
0
        public ICrypt GetCrypt(string storageName, EncryptionSettings encryptionSettings)
        {
            ICrypt result = null;

            using var scope = ServiceProvider.CreateScope();
            if (scope != null)
            {
                result = scope.ServiceProvider.GetService <ICrypt>();
            }

            result ??= new FakeCrypt();
            result.Init(storageName, encryptionSettings);
            return(result);
        }