D
Dean Slindee
VS2008, .NetFramework 3.5 SP1:
I have built a LINQ data access layer project. When the LINQ data context
was built over an existing SQL2005 database, the connection string for that
database was correctly, automatically, placed into the Settings for the LINQ
project. It works, but it's a "static" connection string.
I would like to be able to use this one LINQ data access layer against both
test and production databases without having to manually change and
recompile the project's connection string each time. Since this is a data
access layer project, the functions within it are called by the User
application project. The User application project has the test or
production connection string within it's settings.
Is there a way to pass the User connection string to the LINQ data access
layer? I would even consider passing the connection string on each function
call to the LINQ project, but my first attempt was unsuccessful, because the
LINQ connection string is ReadOnly.
Public Shared Function GetModuleRowsActiveBoot(ByVal strConnectionString
As String) As DataTable
Dim dt As New DataTable
Try
Dim dc As New dcSecurityDataContext
Global.SecurityLinq.My.MySettings.Default.SecurityConnectionString
= strConnectionString
The last statement above is in error because
Global..SecurityConnectionString is ReadOnly.
Anyone tried doing this?
I have built a LINQ data access layer project. When the LINQ data context
was built over an existing SQL2005 database, the connection string for that
database was correctly, automatically, placed into the Settings for the LINQ
project. It works, but it's a "static" connection string.
I would like to be able to use this one LINQ data access layer against both
test and production databases without having to manually change and
recompile the project's connection string each time. Since this is a data
access layer project, the functions within it are called by the User
application project. The User application project has the test or
production connection string within it's settings.
Is there a way to pass the User connection string to the LINQ data access
layer? I would even consider passing the connection string on each function
call to the LINQ project, but my first attempt was unsuccessful, because the
LINQ connection string is ReadOnly.
Public Shared Function GetModuleRowsActiveBoot(ByVal strConnectionString
As String) As DataTable
Dim dt As New DataTable
Try
Dim dc As New dcSecurityDataContext
Global.SecurityLinq.My.MySettings.Default.SecurityConnectionString
= strConnectionString
The last statement above is in error because
Global..SecurityConnectionString is ReadOnly.
Anyone tried doing this?