Skip to content

ConnectionManager Replacement #3287

Answered by mtavares628
Brad-IMS asked this question in Questions
Discussion options

You must be logged in to vote

I've upgraded to CSLA 6 and took a slightly different approach than Rocky's example that I think is a little closer in use to using connection manager. First I created a class that will take the connection string and return a new opened SQLConnection.

public class DbConnect
    {
        private string ConnectionString { get; set; }

        public DbConnect(string connectionString)
        {
            ConnectionString = connectionString;
        }

        public SqlConnection GetConnection()
        {
            SqlConnection conn = new SqlConnection(ConnectionString);
            conn.Open();
            return conn;
        }
    }

Then in my program.cs I'm adding the class to the …

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@rockfordlhotka
Comment options

Comment options

You must be logged in to vote
1 reply
@Brad-IMS
Comment options

Answer selected by Brad-IMS
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants