Now support for dynamic connection strings ;)

Data Access Application Blocks Forum

Now support for dynamic connection strings ;)

Postby HardBit on Tue Feb 12, 2008 10:20 pm

Now you can use ConnectionString into EntityObject

Look next examples

Code: Select all
Employees emp = new Employees();

//Example 1 -> Complete connection string
emp.ConnectionString = \"server=nameServer;database=Northwind;Integrated Security=true\";

//Example 2 -> With integrated security
emp.ConnectionServer = \"nameServer\";
emp.ConnectionDatabase = \"Northwind\";
emp.UseIntegratedSecurity = true;

//Example 3 -> Without integrated security
emp.ConnectionServer = \"HYP3834\";
emp.ConnectionDatabase = \"Northwind\";
emp.UseIntegratedSecurity = false;
emp.ConnectionUserID = \"sa\";
emp.ConnectionPassword = \"passwordsa\";

emp.ProviderFactoryDb = System.Data.SqlClient.SqlClientFactory.Instance;


The EntityObject need a DbProviderFactory, you can use next options:
Code: Select all
     System.Data.Odbc.OdbcFactory //ODBC
     System.Data.OleDb.OleDbFactory //OleDB
     System.Data.OracleClient.OracleClientFactory //SQL Server
     System.Data.SqlClient.SqlClientFactory //Oracle


Now, load data :wink:
emp.LoadAll()

Code: Select all
// Support for IEnumerator  :D
foreach (Employees employee in emp) {
        Console.WriteLine(employee.LastName);
}

All comments are welcome here or my email djnavi <a-t> gmail <dot> com

Change of SourceCode here
Binary here
HardBit
Lurker
 
Posts: 5
Joined: Thu Jan 17, 2008 7:21 pm

Return to EasyObjects.NET (Microsoft Enterprise Library)

Who is online

Users browsing this forum: No registered users and 1 guest

cron