本文整理汇总了C#中DbContextOptionsBuilder.UseNpgsql方法的典型用法代码示例。如果您正苦于以下问题:C# DbContextOptionsBuilder.UseNpgsql方法的具体用法?C# DbContextOptionsBuilder.UseNpgsql怎么用?C# DbContextOptionsBuilder.UseNpgsql使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbContextOptionsBuilder
的用法示例。
在下文中一共展示了DbContextOptionsBuilder.UseNpgsql方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnConfiguring
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseNpgsql("server=localhost;user id=chris;password=chris123;database=RpcMonitor");
//optionsBuilder.UseSqlite("Data Source=rpclite.db;Version=3;");
//optionsBuilder.UseSqlServer("server=localhost;user id=chris;password=chris123;database=RpcLite");
//optionsBuilder.UseSqlServer("Data Source=.;Initial Catalog=RpcLite;Integrated Security=True");
base.OnConfiguring(optionsBuilder);
}
示例2: CreateMasterConnection
public virtual INpgsqlEFConnection CreateMasterConnection()
{
var builder = new NpgsqlConnectionStringBuilder { ConnectionString = ConnectionString };
// TODO: See #566
builder.Database = "postgres";
// TODO use clone connection method once implimented see #1406
var optionsBuilder = new DbContextOptionsBuilder();
optionsBuilder.UseNpgsql(builder.ConnectionString).CommandTimeout(CommandTimeout);
return new NpgsqlRelationalConnection(optionsBuilder.Options, _loggerFactory);
}
示例3: OnConfiguring
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (_appSettings.Database == DatabaseServer.PostgreSql)
{
optionsBuilder.UseNpgsql(_appSettings.ConnectionString);
}
else
{
var extension = GetOrCreateExtension(optionsBuilder);
extension.ConnectionString = _appSettings.ConnectionString;
((IDbContextOptionsBuilderInfrastructure)optionsBuilder).AddOrUpdateExtension(extension);
}
}
示例4: OnConfiguring
protected override void OnConfiguring(DbContextOptionsBuilder optionBuilder)
{
optionBuilder.UseNpgsql("User ID=phihuynh;Password=hvn123;Host=localhost;Port=5432;Database=TestEF;Pooling=true;");
}
示例5: NorthwindQueryNpgsqlFixture
public NorthwindQueryNpgsqlFixture()
{
_testStore = NpgsqlNorthwindContext.GetSharedStore();
_serviceProvider = new ServiceCollection()
.AddEntityFramework()
.AddNpgsql()
.ServiceCollection()
.AddSingleton(TestNpgsqlModelSource.GetFactory(OnModelCreating))
.AddInstance<ILoggerFactory>(new TestSqlLoggerFactory())
.BuildServiceProvider();
var optionsBuilder = new DbContextOptionsBuilder();
optionsBuilder.UseNpgsql(_testStore.Connection.ConnectionString);
_options = optionsBuilder.Options;
_serviceProvider.GetRequiredService<ILoggerFactory>()
.MinimumLevel = LogLevel.Debug;
}
示例6: OnConfiguring
protected override void OnConfiguring(DbContextOptionsBuilder builder)
{
builder.UseNpgsql(config["Data:DefaultConnection:ConnectionString"]);
}
示例7: OnConfiguring
protected override void OnConfiguring(DbContextOptionsBuilder builder)
{
var connectionString = @"Server=localhost;User ID=romiller;Database=Work";
builder.UseNpgsql(connectionString);
}
示例8: OnConfiguring
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
var Path = PlatformServices.Default.Application.ApplicationBasePath;
optionsBuilder.UseNpgsql("Host=localhost;Username=dotnet_test;Password=dotnet;Database=dotnet_test");
}
示例9: OnConfiguring
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseNpgsql(connectionString);
}
示例10: OnConfiguring
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
options.UseNpgsql(@"Server=sebastiankoall.de;Database=infointe;userid=infointe;password=InfoInte1516%");
}
示例11: OnConfiguring
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
options.UseNpgsql("Server=localhost;User ID=josh;Database=todo");
base.OnConfiguring(options);
}
示例12: EventContextFactory
public EventContextFactory (string connectionString)
{
var optionsBuilder = new DbContextOptionsBuilder<EventContext>();
optionsBuilder.UseNpgsql(connectionString);
_options = optionsBuilder.Options;
}
示例13: OnConfiguring
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseNpgsql("Server=localhost;Port=5432;User Id=postgres;Password=;Database=testdb");
}
示例14: OnConfiguring
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
var connectionString = SettingsAccessor.GetSetting<string>("DBConnectionString");
optionsBuilder.UseNpgsql(connectionString);
}
示例15: OnConfiguring
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseNpgsql("Server=spaceshiptracker-dev-1.glenngbg.cont.tutum.io; " +
"User Id=postgres;Password=Crep123!;Database=spaceshiptracker-dev2;");
}