本文整理汇总了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();
}
示例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;
}
示例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);
}
}
示例4: BuildOptions
protected DbContextOptions BuildOptions()
{
var optionsBuilder = new DbContextOptionsBuilder();
var sqlServerDbContextOptionsBuilder
= optionsBuilder
.EnableSensitiveDataLogging()
.UseSqlServer(_testStore.Connection.ConnectionString);
ConfigureOptions(sqlServerDbContextOptionsBuilder);
sqlServerDbContextOptionsBuilder.ApplyConfiguration();
return optionsBuilder.Options;
}
示例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;
}
示例6: OnConfiguring
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite($"Filename=Blogging.db");
optionsBuilder.EnableSensitiveDataLogging();
}
示例7: OnConfiguring
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
optionsBuilder.EnableSensitiveDataLogging();
}