Data Access has been discontinued. Please refer to this page for more information.

How to: Convert Reverse Mapped Project

This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.

This topic discusses how to upgrade a Reverse-mapped project done with previous versions of Telerik Data Access to the new .RLINQ version required for the Visual Designer.

To migrate a Reverse-mapped project, complete the following steps:

  1. Select your Reverse-mapped project (the project containing the persistent classes and reversemapping.config).

  2. From the Telerik > Telerik Data Access menu select Convert Classic Model.

  3. The start page of wizard appears. You should select the type of mapping that your client project uses. Select Reverse Mapping.

    If your model contains a mix of Forward and Reverse mapped classes, please select the 'Forward Mapping' option.

  4. Press Next to continue.

  5. The Upgrade Project wizard page appears.

    The dialog is divided into two main parts. On the left side a treeview presenting all files which will be affected after the upgrade procedure runs is located. When you select a specific file from the treeview, a message on the right side is shown. That message describes what will be the exact change over the file after the procedure finishes.

  6. Click Convert to start the conversion.

  7. Once the migration process is complete, the following changes will be performed:

    1. The reversemapping.config file will be removed from the file system.
    2. The <openaccess/> section will be removed from the app.config file (web.config in cases of web application). The <configSections/> will be removed from the app.config file (web.config in cases of web application). All connecting strings will remain in the app.config (web.config) file (even if they are in the old connection string format).
    3. All references to the Telerik Data Access assemblies will be updated to the latest installed version.
    4. The settings in the project that were used for calling the enhancer and schema tools (those settings are inserted by the "Enable Project Wizard") will be removed. There will be targets added for calling the new enhancer.
    5. All classes generated by the Reverse Mapping Wizard will be removed from the file system.
    6. A new .rlinq file that manages the domain model will be added to the project.

      Once the .RLINQ file is added to your project, you should open it and press the Save (Ctrl+S) command in order to generate the classes that were previously deleted.

      Note, that when you open the .RLINQ file for the first time in the Visual Designer, all class will be somehow "messed up". In order to make your diagram more readable you can use the Layout Diagram command.

    7. If there is an ObjectScopeProvider class, the ObjectScopeProvider.Database() method will be changed:

      • A new BackendConfiguration instance will be created considering the old backend settings that are previously defined in the XML configuration.
      • The Database object will be initialized by using the MetadataContainer and BackendConfiguration produced by the new domain model. That guarantees that the code previously written and based on the old "IObjectScope API" will still work as long as the ObjectScopeProvider is used for obtaining a new IObjectScope instance.

      Your ObjectScopeProvider.Database should look like the code-snippet below:

        static public Database Database()
        {
           if (theObjectScopeProvider1 == null)
               theObjectScopeProvider1 = new ObjectScopeProvider1();
           if (theObjectScopeProvider1.myDatabase == null)
           {
               ReverseMappingProject.NorthwindDbConnection context = new ReverseMappingProject.NorthwindDbConnection();
               MetadataContainer metadata = context.Metadata;
               BackendConfiguration backendConfiguration = ReverseMappingProject.NorthwindDbConnection.GetBackendConfiguration();
               context.Dispose();
               theObjectScopeProvider1.myDatabase = Telerik.OpenAccess.Database.Get("NorthwindDbConnection", backendConfiguration, metadata);
           }
           return theObjectScopeProvider1.myDatabase;
        }
      
  8. A backup of the migrated project will be created in a folder named "OpenAccessUpgradeTool_Backup". That folder is a sub-folder of your project folder.

  9. During the conversion each important action is written in a log file. Once the conversion has completed, the log file will be opened in the visual studio environment.

Note that if your project contains an ObjectScopeProvider, it won't be deleted in the migrated project. However, the ObjectScope.Database() method will be changed. That guarantees that the code previously written and based on the old "IObjectScope API" will still work as long as the ObjectScopeProvider is used for obtaining a new IObjectScope instance.