G
Guest
Hi there.
First of all let me apologise for this is a somewhat general question to
which I would be interested in any opinions.
As far as I can see when I create a web application the recommended location
for the database is the app_data folder. The recommended location for code
files and datasets/table adapters appears to be the app_code folder. This set
up appears to work reasonably well although it results in the all the code
files being published with the web application.
A better solution appears to be to create a separate Class Library with a
reference to that Library from the web applications. After a build the dll is
copied into the bin folder and any of the code can be accessed just fine.
With this set up I only then need to publish the dll in the bin folder which
seems a better option.
With the second option everything is fine just so long as I use SQL Server
as the location of the database is not critical to the connection string.
However if I want to use an Access Database (well I don’t want to but
sometimes this is the only option) the access database is located in the
app_data folder which isn’t naturally accessible from the Class Library. If I
create a dataset with table adapters within the class library when I compile
the project the connection string appears to be wrong as the dll copied to
the web application doesn’t look for the string details in the web.config.
Previously it was using the connection string from the application settings.
The conclusion I have drawn is that using table adapters in an external
Class Library to create a data layer doesn’t work so well with an Access
database.
Is this correct or am I missing something?
Any good articles covering the above would be of interest.
First of all let me apologise for this is a somewhat general question to
which I would be interested in any opinions.
As far as I can see when I create a web application the recommended location
for the database is the app_data folder. The recommended location for code
files and datasets/table adapters appears to be the app_code folder. This set
up appears to work reasonably well although it results in the all the code
files being published with the web application.
A better solution appears to be to create a separate Class Library with a
reference to that Library from the web applications. After a build the dll is
copied into the bin folder and any of the code can be accessed just fine.
With this set up I only then need to publish the dll in the bin folder which
seems a better option.
With the second option everything is fine just so long as I use SQL Server
as the location of the database is not critical to the connection string.
However if I want to use an Access Database (well I don’t want to but
sometimes this is the only option) the access database is located in the
app_data folder which isn’t naturally accessible from the Class Library. If I
create a dataset with table adapters within the class library when I compile
the project the connection string appears to be wrong as the dll copied to
the web application doesn’t look for the string details in the web.config.
Previously it was using the connection string from the application settings.
The conclusion I have drawn is that using table adapters in an external
Class Library to create a data layer doesn’t work so well with an Access
database.
Is this correct or am I missing something?
Any good articles covering the above would be of interest.