When using static codegen from command line - something like ./MyApp.exe codegen write and app was built in Release configuration Marten requires that any connection string is provided. Otherwise it throws exception.
And I can't understand why.
This connection string can be anything out of the blue like server=google.or.anything.you.can.think.of.com;user id=postgres;password=not_a password;database=sth;Pooling=true;Persist Security Info=true and codegen works.
With empty connection string in appsettings it throws - tested with 7.27.0
$ ./MyApp.exe codegen write
Searching 'JasperFx.CodeGeneration.Commands, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' for commands
Searching 'Weasel.CommandLine, Version=7.5.0.0, Culture=neutral, PublicKeyToken=null' for commands
Searching 'Marten.CommandLine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' for commands
[red]ERROR:[/]System.ArgumentException: Host can't be null
at void Npgsql.NpgsqlConnectionStringBuilder.PostProcessAndValidate()
at NpgsqlDataSourceConfiguration Npgsql.NpgsqlSlimDataSourceBuilder.PrepareConfiguration()
at NpgsqlDataSource Npgsql.NpgsqlSlimDataSourceBuilder.Build()
at NpgsqlDataSource Npgsql.NpgsqlDataSourceBuilder.Build()
at NpgsqlDataSource Weasel.Postgresql.Connections.DefaultNpgsqlDataSourceFactory.<.ctor>b__2_0(string connectionString
)
at TValue JasperFx.Core.Cache`2.get_Item(TKey key)
at NpgsqlDataSource Weasel.Postgresql.Connections.DefaultNpgsqlDataSourceFactory.Create(string connectionString)
at ITenancy Marten.StoreOptions.<>c__DisplayClass129_0.<Connection>b__0()
at void System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at void System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, bool useDefaultConstructor)
at T System.Lazy`1.CreateValue()
at ITenancy Marten.StoreOptions.get_Tenancy()
at void Marten.StoreOptions.Validate()
at Marten.DocumentStore..ctor(StoreOptions options)
(and so on)
When using static codegen from command line - something like
./MyApp.exe codegen write
and app was built inRelease
configuration Marten requires that any connection string is provided. Otherwise it throws exception. And I can't understand why.This connection string can be anything out of the blue like
server=google.or.anything.you.can.think.of.com;user id=postgres;password=not_a password;database=sth;Pooling=true;Persist Security Info=true
and codegen works.With empty connection string in appsettings it throws - tested with 7.27.0