I have my main hocon config in app.config file and try to set connection string from code behind using fallback config. but when actor system start it doesn't working. here is my hocon config and C# code as below. Can someone help me please?
Hocon config i have comment out connnection-string to take it from fallback config akka.persistence {
journal {
plugin = "akka.persistence.journal.sql-server"
sql-server {
class = "Akka.Persistence.SqlServer.Journal.SqlServerJournal, Akka.Persistence.SqlServer"
plugin-dispatcher = "akka.actor.default-dispatcher"
# connection string used for database access
# connection-string = "Data Source=ES-NB-046\\MSSQLSERVER_2014;Initial Catalog=PSAkka;User ID=sa;Password=1qaz2wsx@;"
# can alternativly specify: connection-string-name
# default SQL timeout
connection-timeout = 30s
# SQL server schema name
schema-name = dbo
# persistent journal table name
table-name = EventJournal
# initialize journal table automatically
auto-initialize = on
timestamp-provider = "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.Sql.Common"
metadata-table-name = Metadata
}
}
C# code behind file
static void Main(string[] args)
{
var mainConfig = ConfigurationFactory.Load();
string connectionString = @"akka.persistence.journal.sql-server.connection-string = ""Data Source=Data Source=ES-NB-046\\MSSQLSERVER_2014;Initial Catalog=PSAkka;User ID=sa;Password=1qaz2wsx@;""";
//string text1 = @"akka.persistence.journal.sql-server.abc = ""Data Source=Data Source=ES-NB-046\\MSSQLSERVER_2014;Initial Catalog=PSAkka;User ID=sa;Password=1qaz2wsx@;""";
var conStringConfig = ConfigurationFactory.ParseString(connectionString);
mainConfig = mainConfig.WithFallback(conStringConfig);
System = ActorSystem.Create("Game", mainConfig);
PlayerCoordinator = System.ActorOf<PlayerCoordinatorActor>("PlayerCoordinator");