Spring.NET read Environment Variable from C# script

25 Views Asked by At

I have this script :

namespace App.api.security
{
    public class EnvVariable
    {
        public static string ENV_CONNECTION_USER => Environment.GetEnvironmentVariable("C_USER");
    }
}

Is it possible to have Spring.NET read it when launching ? I have difficulty to do so because documentation is down and all exemple I found are for java.


<object name="EnvVariable" id="App.api.security.EnvVariable" type="App.api.security.EnvVariable, app-Service" >
        <property name="USER_ENV" value="#{T(App.api.security.EnvVariabl).ENV_CONNECTION_USER}" />

</object>

And finally I want to be able to use variable as a string connection

  <db:provider id="DbProvider" provider="System.Data.SqlClient" connectionString="Data Source=${DB_ENV};Initial Catalog=${CAT_ENV};User ID=${USER_ENV};Password=${PASS_ENV};"/>

0

There are 0 best solutions below