This project is read-only.


There are three install modes for NSQLObjects:
1. Install NSQLObjects as an extension to VS 2010
2. Install sources as well so that you can compile NSQLObjects yourself and optionally run unit tests.
3. Run NSQLObjects in VS 2010 experimental hive mode

There are also two different cases when you might want to use NSQLObjects
A. Use NSQLObjects by adding a new project to your solution
B. Use NSQLObjects by adding dbmodel files to an existing project (for example, adding dbmodel files to the Models folder in an MVC project)

Install mode?

1. Install a VS 2010 Extension to use NSQLObjecs

This VSIX file adds the project type NSQLObjects to available project types. When you create a new project, the csproj file is automatically modified to include the steps to compile dbmodel files (which has to bee done manually for existing projects, see below for case B).

Even if you install the source files, you still should run the VSIX file as the VSIX adds
  • intellisense to dbmodel files
  • the new project type (NSQLObjects project) for creating a new data access layer project

2.Install and compile sources to use NSQLObjects

  • Install Visual Studio 2010 SDK
  • Download NSQLObjects solution files
  • Rebuild NSQLObjects solution.
  • Install the NSQLObjects VSIX (which can be found in the bin\debug directory of NSQLObjects.VSIXSetup project)
  • Set the NSQLObjectsPath environment variable to point to the NSQLObjects.Generator.Support\bin\Debug directory

3. Run NSQLObjects in experimental hive

If you wish to execute / debug NSQLObjects on the fly by running the NSQLObjects.VSIXSetup project without installing NSQLObjects VSIX, you can do so by
  • setting the NSQLObjects.VSIXSetup project as the StartUp Project
  • setting the Start Action as Start external program (C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe) at the Debug page in the property pages of the NSQLObjects.VSIXSetup project.
  • and entering /RegSuffix Exp into Command line arguments in Start Options at the same page.
  • In addition to this you must set the NSQLObjectsPath environment variable to $(LOCALAPPDATA)\Microsoft\VisualStudio\10.0Exp\Extensions\Nolics\NSQLObjects\1.0\
After setting these values, you can run the NSQLObjects.VSIXSetup project by simply pressing F5. This will start a new instance of VS2010 in an experimental hive with NSQLObjects installed.

New / old project?

A. New projects

Create a new NSQLObjects project. The defaults.dbmodel file is added automatically. Modify the connection string and the namespace:
  • Defaults.dbmodel needs the connection string as database connection is used during the compile time to check the validity of database definitions:
connection "Data Source=...;Initial Catalog=...;Integrated Security=True"; 
  • Defaults.dbmodel also needs the namespace for the compiled classes:
namespace MyNameSpace; 

B.Existing projects

The following changes must be made to the project using NSQLObjects
  • add the NSQLObjects as a project reference. NSQLObjects can be found either in
    • 1. Installed VSIX only: the directory $(LOCALAPPDATA)\Microsoft\VisualStudio\10.0\Extensions\Nolics\Nolics\NSQLObjects\1.0\
    • 2. Installed sources: the directory bin\debug of the NSQLObjects.Generator.Support project
  • Add the defaults.dbmodel file into the project. You also need to add the connection and the namespace as in case A above. Change the BuildAction of defaults.dbmodel to DBModel.
  • Add the following lines into the csproj file of the project, as a child of the <PropertyGroup> section:
    <NSQLObjects Condition="'$(NSQLObjectsPath)' == ''" >$(LOCALAPPDATA)\Microsoft\VisualStudio\10.0\Extensions\Nolics\NSQLObjects\1.0\</NSQLObjects>
    <NSQLObjects Condition="'$(NSQLObjectsPath)' != ''" >$(NSQLObjectsPath)</NSQLObjects>
  • Add the following line as the last import, as a child of the <Project> section:
<Import Project="$(NSQLObjects)\" />
  • In addition, using the NSQLObjectsPath environment variable allows you to override the settings of the project file. When overriding, the environment variable must point to a place where the file is found. It can also be found in the NSQLObjects.Generator.Support project bin\debug directory.

Last edited Jun 13, 2011 at 10:32 AM by nolics, version 9


No comments yet.