ConnectionStringLightPT – to be updated
It generates connection string in C# instead of using configuration file.
Connection string can be generated in two formats:
- Only with the server name – useful when database creation is invoked.
- With the server name and the database name – can be use as replacement for connection string placed in application configuration file.
Examples: "Data Source=localhost;Integrated Security=True" "Data Source=localhost;Initial Catalog=dbName;Integrated Security=True"
There are simple methods and it is simple to use them:
var x=ConnectionStringLight.GetSqlDataSourceConnectionString("localhost"); var y = ConnectionStringLight.GetSqlServerConnectionString("localhost", "dbName");
If you want to use connection string for Entity Framework please check out ConnectionStringPT page.