当前位置: 首页>>代码示例>>C#>>正文


C# DbContextOptionsBuilder.EnableSensitiveDataLogging方法代码示例

本文整理汇总了C#中DbContextOptionsBuilder.EnableSensitiveDataLogging方法的典型用法代码示例。如果您正苦于以下问题:C# DbContextOptionsBuilder.EnableSensitiveDataLogging方法的具体用法?C# DbContextOptionsBuilder.EnableSensitiveDataLogging怎么用?C# DbContextOptionsBuilder.EnableSensitiveDataLogging使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DbContextOptionsBuilder的用法示例。


在下文中一共展示了DbContextOptionsBuilder.EnableSensitiveDataLogging方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnConfiguring

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            base.OnConfiguring(optionsBuilder);

            optionsBuilder.UseSqlite($"Data Source={databaseFile};");
            optionsBuilder.EnableSensitiveDataLogging();
        }
开发者ID:kswoll,项目名称:restless,代码行数:7,代码来源:RestlessDb.cs

示例2: CreateOptions

        public static IDbContextOptions CreateOptions(
            FakeRelationalOptionsExtension optionsExtension = null, bool logParameters = false)
        {
            var optionsBuilder = new DbContextOptionsBuilder();

            if (logParameters)
            {
                optionsBuilder.EnableSensitiveDataLogging();
            }

            ((IDbContextOptionsBuilderInfrastructure)optionsBuilder)
                .AddOrUpdateExtension(optionsExtension ?? new FakeRelationalOptionsExtension { ConnectionString = ConnectionString });

            return optionsBuilder.Options;
        }
开发者ID:adwardliu,项目名称:EntityFramework,代码行数:15,代码来源:RelationalCommandTest.cs

示例3: InheritanceSqlServerFixture

        public InheritanceSqlServerFixture()
        {
            _serviceProvider
                = new ServiceCollection()
                    .AddEntityFramework()
                    .AddSqlServer()
                    .ServiceCollection()
                    .AddSingleton(TestSqlServerModelSource.GetFactory(OnModelCreating))
                    .AddInstance<ILoggerFactory>(new TestSqlLoggerFactory())
                    .BuildServiceProvider();

            var testStore = SqlServerTestStore.CreateScratch();

            var optionsBuilder = new DbContextOptionsBuilder();

            optionsBuilder
                .EnableSensitiveDataLogging()
                .UseSqlServer(testStore.Connection);

            _options = optionsBuilder.Options;

            // TODO: Do this via migrations

            testStore.ExecuteNonQuery(@"
                CREATE TABLE Country (
                    Id int NOT NULL PRIMARY KEY,
                    Name nvarchar(100) NOT NULL
                );

                CREATE TABLE Animal (
                    Species nvarchar(100) NOT NULL PRIMARY KEY,
                    Name nvarchar(100) NOT NULL,
                    CountryId int NOT NULL FOREIGN KEY REFERENCES Country (Id),
                    IsFlightless bit NOT NULL,
                    EagleId nvarchar(100) FOREIGN KEY REFERENCES Animal (Species),
                    [Group] int,
                    FoundOn tinyint,
                    Discriminator nvarchar(255) NOT NULL
                );

                CREATE TABLE Plant(
                    Genus int NOT NULL,
                    Species nvarchar(100) NOT NULL PRIMARY KEY,
                    Name nvarchar(100) NOT NULL,
                    CountryId int FOREIGN KEY REFERENCES Country (Id),
                    HasThorns bit
                );");

            using (var context = CreateContext())
            {
                SeedData(context);
            }
        }
开发者ID:adwardliu,项目名称:EntityFramework,代码行数:53,代码来源:InheritanceSqlServerFixture.cs

示例4: BuildOptions

        protected DbContextOptions BuildOptions()
        {
            var optionsBuilder = new DbContextOptionsBuilder();

            var sqlServerDbContextOptionsBuilder
                = optionsBuilder
                    .EnableSensitiveDataLogging()
                    .UseSqlServer(_testStore.Connection.ConnectionString);

            ConfigureOptions(sqlServerDbContextOptionsBuilder);

            sqlServerDbContextOptionsBuilder.ApplyConfiguration();

            return optionsBuilder.Options;
        }
开发者ID:adwardliu,项目名称:EntityFramework,代码行数:15,代码来源:NorthwindQuerySqlServerFixture.cs

示例5: NorthwindSprocQuerySqlServerFixture

        public NorthwindSprocQuerySqlServerFixture()
        {
            _testStore = SqlServerNorthwindContext.GetSharedStore();

            _serviceProvider = new ServiceCollection()
                .AddEntityFramework()
                .AddSqlServer()
                .ServiceCollection()
                .AddSingleton(TestSqlServerModelSource.GetFactory(OnModelCreating))
                .AddInstance<ILoggerFactory>(new TestSqlLoggerFactory())
                .BuildServiceProvider();

            var optionsBuilder = new DbContextOptionsBuilder();

            optionsBuilder
                .EnableSensitiveDataLogging()
                .UseSqlServer(_testStore.Connection.ConnectionString);

            _options = optionsBuilder.Options;

            _serviceProvider.GetRequiredService<ILoggerFactory>()
                .MinimumLevel = LogLevel.Debug;
        }
开发者ID:adwardliu,项目名称:EntityFramework,代码行数:23,代码来源:NorthwindSprocQuerySqlServerFixture.cs

示例6: OnConfiguring

  protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  {
      optionsBuilder.UseSqlite($"Filename=Blogging.db");
      optionsBuilder.EnableSensitiveDataLogging();
 }
开发者ID:ShiroYacha,项目名称:OneSync,代码行数:5,代码来源:Model.cs

示例7: OnConfiguring

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            base.OnConfiguring(optionsBuilder);

            optionsBuilder.EnableSensitiveDataLogging();
        }
开发者ID:olliholliday,项目名称:TvList,代码行数:6,代码来源:TvDataContext.cs


注:本文中的DbContextOptionsBuilder.EnableSensitiveDataLogging方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。