Telerik OpenAccess Classic

Telerik OpenAccess ORM Send comments on this topic.
How to: Use a Data Model Defined in a Class Library
See Also
Programmer's Guide > OpenAccess ORM Classic (Old API) > OpenAccess Tasks > Defining a Data Model > How to: Use a Data Model Defined in a Class Library

Glossary Item Box

This documentation article is a legacy resource describing the functionality of the deprecated OpenAccess Classic only. The contemporary documentation of Telerik OpenAccess ORM is available here.

This topic describes how to use Telerik OpenAccess ORM persistent classes in a project when the data model is defined in a Visual Studio Class Library project.

Telerik OpenAccess ORM Q1 2010 Release comes with several new or renamed assemblies:

  • Telerik.OpenAccess.Query.dll is renamed to Telerik.OpenAccess.35.Extensions.dll
  • Telerik.OpenAccess.40.dll is renamed to Telerik.OpenAcces.40.Extensions.dll
  • There is separation of the Win and Web UI into separate assemblies out of Telerik.OpenAccess.dll. These are Telerik.OpenAccess.Web.dll and Telerik.OpenAccess.Windows.dll assemblies.

The first procedure in this topic describes how to use the Telerik OpenAccess ORM persistent classes that is defined in a Class Library from projects other than ASP.NET Website projects. The second procedure describes how to use the Telerik OpenAccess ORM persistent classes  that is defined in a Class Library from an ASP.NET Website project.

To use Telerik OpenAccess ORM persistent classes defined in a Class Library from projects other than ASP.NET Website projects

  1. In Visual Studio, create a Visual C# or Visual Basic Class Library project.
          For information about creating projects in Visual Studio, see How to: Create Solutions and Projects.
      
  2. Add the persistent classes to the Class Library project.
          For information about creating a new data model and adding the persistent classes to a project, see How to: Create a New Data Model With Telerik OpenAccess ORM.
      
  3. Add a new project that is not an ASP.NET Website project to your existing solution.
          For information about adding a project to an existing solution, see How to: Create Multi-Project Solutions.
      
  4. Right-click the newly added project (not the Class Library project) and select Add Reference.
        The Add Reference dialog box appears.
      
  5. Click the Projects tab of the Add Reference dialog box and select your Class Library project. Click OK.
      

You can now write code in the newly added project that will use the persistent classes that are defined in the Class Library project.

You might have to set the newly added project as the startup project before building the solution. To do this, right click the project in Solution Explorer and select Set as StartUp Project.

To use an Data Model defined in a Class Library from an ASP.NET Website project

  1. In Visual Studio, create a Visual C# or Visual Basic Class Library project.
          For information about creating projects in Visual Studio, see How to: Create Solutions and Projects.
      
  2. Add the persistent classes (Data Model) to the Class Library project.  
       For information about creating a new data model and adding the persistent classes to a project, see How to: Create a New Data Model With Telerik OpenAccess ORM.
  3. Add a an ASP.NET Website project to your existing solution.
          For information about adding a project to an existing solution, see How to: Create Multi-Project Solutions.
  4. Right-click the ASP.NET Website project and select Add Reference.
          The Add Reference dialog box appears.
  5. Click the .NET tab of the Add Reference dialog box and select Telerik.OpenAccess.dll and the Telerik.OpenAccess.Query.dll. Click OK.
    You can find complete information regarding the required assemblies in the Operations and Versioning topic.
  6. The next step is to reference the Class Library project from the ASP.NET Website project. There are two ways you can do this:
            
    • Right-click the ASP.NET Website project in Solution Explorer and select Add Reference.
                  The Add Reference dialog box appears.
    • Click the Projects tab of the Add Reference dialog box and select your Class Library project. Click OK.
          -OR-

    • In Solution Explorer, right-click the Class Library project and select Build.
                  The Class Library assembly is added to the bin\Debug folder of the project.
    • Right-click the ASP.NET Website project and select Add ASP.NET Folder. Select Bin.
                  The Bin folder is added to the project.
    • In Windows Explorer, navigate to the bin\Debug folder of the Class Library project. Right-click the project assembly (the <project_name>.dll file) and select Copy.
    • In Solution Explorer, right-click the Bin folder under the ASP.NET Website project and select Paste.
If the project does not contain a Bin folder, you can add one by right-clicking the project in Solution Explorer, pointing to Add ASP.NET Folder, and selecting Bin.
You might have to set the newly added project as the startup project before building the solution. To do this, right click the project in Solution Explorer and select Set as StartUp Project.

You can now write code in the ASP.NET Website project that will use the persistent classes that are defined in the Class Library project. 

See Also