I have another question not sure if it belongs here or EntityDeveloper section.
I just converted an application that was using EntityDeveloper with LinqToSql to use EnityDeveloper and DotConnect for PostgreSQL.
My app stores the connection string enrypted in the web.config and it was retrieving it and decrypting it and setting the base Connection objects connect string to this value in the DataContext OnCreated() method, I created my own partial class to do this so that when the model regenerated I don't lose this code. Problem is this Connection in old code was of type Devart.Data.Linq.DataContext.Connection this now needs to be PgSqlConnection but I don't see where this is created so that I can do the same as before.
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Configuration;
using Stauer.Utilities.Encryption;
namespace DigitalPaperOrderContext
{
public partial class DigitalPaperOrderDataContext
{
partial void OnCreated()
{
//Decrypt the connection string here and set the base connection string to this value.
string pwd = "somePassword";
string connString = WebConfigurationManager.ConnectionStrings["DigitalPaperOrderEncrypted"].ConnectionString;
connString = AESGCM.SimpleDecryptWithPassword(connString, pwd);
Connection.ConnectionString = connString;
this.CommandTimeout = 120;
}
}
}