I’m having a hard time figuring out how to use OrmLite AppSettings.
I have registered the following:
container.Register(c =>
new OrmLiteAppSettings(c.Resolve<IDbConnectionFactory>()));
//Create the ConfigSettings table if it doesn't exist
container.Resolve<OrmLiteAppSettings>().InitSchema();
This created a table called config_setting in the database with id and value columns.
I am then trying to use it from within a Service, which is the part I’m not understanding. The provided example at https://docs.servicestack.net/appsettings#usage shows:
var config = appSettings.Get("config",
new MyConfig { Key = "DefaultValue" });
From within the Service I have added
public IAppSettings AppSettings { get; set; }
I have a class defined as:
public class AppConfig
{
public int MaxFailedAccessAttempts { get; set; }
public bool RequireEmailConfirmation { get; set; }
}
This is where I’m getting stuck. How do I modify
var config = appSettings.Get("config",
new MyConfig { Key = "DefaultValue" });
to populate my AppConfig class from within the service using AppSettings?