I'm trying to create settings for a system. I thought of a class similar to the example:
Class:
public static class Configuracoes
{
[DisplayName("Casas Decimais")]
[Description("Informa o número de casas decimais que o sistema irá trabalhar")]
public static int CasasDecimais {get;set;}
[DisplayName("Opção A")]
[Description("Determina o Valor da opção A dentro do sistema")]
public static int OpcaoA {get;set;}
//...
public static int OpcaoX {get;set;}
//...
public static string OpcaoY {get;set;}
//...entre outras, apenas exemplo
}
Obviously, there will only be one setup for the system. So I opted for the static class.
Now, to store this information, I would like to put a table with the following structure:
Table: Settings
id | nome | descricao | valor
"CasasDecimais" | "Casas Decimais" | "Informa o número de casas ... trabalhar" | 2
...
Goal: (Example)
//...
decimal pagamento = x+y;
Console.WriteLine("O pagamento foi de: "+ pagamento.ToString("C"+Configuracoes.CasasDecimais);
Questions:
entityframework 6
? If so, how? Note: This is not a constant configuration as Carlos suggested, and it is necessary to save it as it may be different for each client.
I've done this setting as an object, and each option as a column in the database. In this way, the table is left with only one row. I do not see a problem with that, I'm just trying to see if it's possible to do it this way.
Thank you