Setting a Data Layer Reference in Visual Studio

As of 2010-07-19, there is no need to change the data layer reference as described below on this page. Using conditional configuration in the Visual Studio Project files, you can now just choose the build profile for a given data layer and it will automatically reference the correct data layer. So you just choose the build profile from the list and rebuild the entire solution to use a database other than MS SQL. The standard Debug and Release configurations target MS SQL.

screen shot showing build configuration choices

Note that if you build for SqlCe, you may need to copy the folders _libs\sqlce\x86 and _libs\sqlce\amd64 to the Web/bin folder because Visual Studio won't resolve the dependencies for those native dlls.

Legacy Info for older versions of the mojoPortal Source Code

Open the mojoportal.sln file in Visual Studio

Branch down the references node under the mojoPortal.Business project and make sure it has a reference to the correct data layer for your needs. I usually check it in configured for mojoPortal.Data.MSSQL (Microsoft SQL Server) but you can easily change this. Delete the reference for mojoPortal.Data.MSSQL, then right click the References node and choose Add Reference. In the dialog,click the Projects tab and choose either mojoPortal.Data.Firebird, mojoPortal.Data.pgsql, mojoPortal.Data.MySql or mojoPortal.Data.SQLite  and click OK

Then do the same thing for the mojoPortal.Features.Business project, branch down the references node and remove the reference to mojoPortal.Features.Data.MSSQL and add a Project Referance to mojoPortal.Features.Data.Firebird, mojoPortal.Features.Data.MySql, mojoPortal.Features.Data.pgsql, or mojoPortal.Features.Data.SQLite

Then, optionally if using MySql, do the same for WebStore.Business, remove the reference to WebStore.Data.MSSQL and add a project reference to WebStore.Data.MySql. Currently only MS SQL and MySql are supported for WebStore.

If using SQLite, you need to copy the sqlite3.dll from the /Data/sqlitedb folder into the Web/bin folder.

After changing all the references you must rebuild the entire solution before using it.

Rate this Content 2 Votes