Working on tenants and config

This commit is contained in:
Janus Knudsen 2025-01-21 17:40:23 +01:00
parent c10de11bbe
commit f3352318f5
12 changed files with 309 additions and 19 deletions

View file

@ -1,13 +1,16 @@
using Autofac;
using System.Data;
using Insight.Database;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Extensions.Configuration;
using Core.Configurations.PostgresqlConfigurationBuilder;
namespace Tests
{
[TestClass]
public class UnitTest1 : TestFixture
{
[TestMethod]
public void MyTestMethod()
public void TestDefaultConnection()
{
var conn = Container.Resolve<IDbConnection>();
//https://www.reddit.com/r/dotnet/comments/6wdoyn/how_to_properly_register_dapper_on_net_core_2_di/
@ -16,8 +19,28 @@ namespace Tests
conn.ExecuteSql("SELECT 1 as p");
var sql = "SELECT * FROM public.Foo";
var sql = "SELECT * FROM swp.foo";
var customers = conn.Query(sql, commandType:CommandType.Text);
}
[TestMethod]
public void TryTenantSetupService()
{
var conn = Container.Resolve<IDbConnection>();
}
[TestMethod]
public void MyTestMethod()
{
var builder = new ConfigurationBuilder()
.AddPostgresConfiguration(options =>
{
options.ConnectionString = "Host=192.168.1.57;Database=ptdb01;Username=postgres;Password=3911";
options.Channel = "config_changes";
options.ConfigurationQuery = @"select * from dev.app_configuration";
});
}
}
}

View file

@ -1,7 +1,7 @@
{
"AllowedHosts": "*",
"ConnectionStrings": {
"ptdb": "Host=localhost;Port=5433;Database=ptdb01;User Id=postgres;Password=3911;"
"ptdb": "Host=192.168.1.57;Port=5432;Database=ptdb01;User Id=sathumper;Password=3911;"
},
"ApplicationInsights": {
"ConnectionString": "InstrumentationKey=6d2e76ee-5343-4691-a5e3-81add43cb584;IngestionEndpoint=https://northeurope-0.in.applicationinsights.azure.com/"