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


C# DbContextOptionsBuilder.UseNpgsql方法代码示例

本文整理汇总了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);
 }
开发者ID:chrishaly,项目名称:RpcLite,代码行数:8,代码来源:ServiceDataContext.cs

示例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);
        }
开发者ID:ru-sh,项目名称:npgsql,代码行数:13,代码来源:NpgsqlRelationalConnection.cs

示例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);
     }
 }
开发者ID:nathana1,项目名称:FrameworkBenchmarks,代码行数:13,代码来源:ApplicationDbContext.cs

示例4: OnConfiguring

 protected override void OnConfiguring(DbContextOptionsBuilder optionBuilder)
 {
     optionBuilder.UseNpgsql("User ID=phihuynh;Password=hvn123;Host=localhost;Port=5432;Database=TestEF;Pooling=true;");
 }
开发者ID:trumhemcut,项目名称:dotnet-ef-postgresql,代码行数:4,代码来源:Model.cs

示例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;
        }
开发者ID:Emill,项目名称:Npgsql,代码行数:19,代码来源:NorthwindQueryNpgsqlFixture.cs

示例6: OnConfiguring

 protected override void OnConfiguring(DbContextOptionsBuilder builder)
 {
     builder.UseNpgsql(config["Data:DefaultConnection:ConnectionString"]);
 }
开发者ID:jimfim,项目名称:DockerDemo,代码行数:4,代码来源:DBContext.cs

示例7: OnConfiguring

		protected override void OnConfiguring(DbContextOptionsBuilder builder)
		{
			var connectionString = @"Server=localhost;User ID=romiller;Database=Work";
			builder.UseNpgsql(connectionString);
		}
开发者ID:rexebin,项目名称:UnicornStore,代码行数:5,代码来源:WorkContext.cs

示例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");
 }
开发者ID:juicemia,项目名称:dotnet-core-example,代码行数:5,代码来源:Contexts.cs

示例9: OnConfiguring

 protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 {
     optionsBuilder.UseNpgsql(connectionString);
 }
开发者ID:trumhemcut,项目名称:ef7firstlook,代码行数:4,代码来源:Model.cs

示例10: OnConfiguring

 protected override void OnConfiguring(DbContextOptionsBuilder options)
 {
     options.UseNpgsql(@"Server=sebastiankoall.de;Database=infointe;userid=infointe;password=InfoInte1516%");
 }
开发者ID:greyes5,项目名称:InformationIntegration,代码行数:4,代码来源:infointeContext.cs

示例11: OnConfiguring

 protected override void OnConfiguring(DbContextOptionsBuilder options)
 {
     options.UseNpgsql("Server=localhost;User ID=josh;Database=todo");
     base.OnConfiguring(options);
 }
开发者ID:okusnadi,项目名称:todo,代码行数:5,代码来源:TodoStorage.cs

示例12: EventContextFactory

 public EventContextFactory (string connectionString)
 {
     var optionsBuilder = new DbContextOptionsBuilder<EventContext>();
     optionsBuilder.UseNpgsql(connectionString);
     _options = optionsBuilder.Options;
 }
开发者ID:tradsim,项目名称:TradSim.EventAggregation.Service,代码行数:6,代码来源:EventContextFactory.cs

示例13: OnConfiguring

 protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 {
     optionsBuilder.UseNpgsql("Server=localhost;Port=5432;User Id=postgres;Password=;Database=testdb");
 }
开发者ID:wki,项目名称:EfDemo,代码行数:4,代码来源:DB.cs

示例14: OnConfiguring

 protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 {
     var connectionString = SettingsAccessor.GetSetting<string>("DBConnectionString");
     optionsBuilder.UseNpgsql(connectionString);
 }
开发者ID:SO-Close-Vote-Reviewers,项目名称:socvr-slack-beef-bot,代码行数:5,代码来源:DatabaseContext.cs

示例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;");
 }
开发者ID:tobiasterstad,项目名称:space,代码行数:5,代码来源:SpaceshipTrackerContext.cs


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