Forward Mapping with another database

4 posts, 0 answers
  1. Srinivas Chitta
    Srinivas Chitta avatar
    9 posts
    Member since:
    Dec 2009

    Posted 02 Mar 2010 Link to this post

    Hi,

    I am using Reverse Mapping for a database created in SQL Server. I have created a DLL for this Data Access Layer component. Everything is going fine. On one fine day, I thought of changing the database to Oracle. Now, without using my existing code for Data Access Layer and by using the generated  DLL, can i run forward mapping to change my database from SQL Server to Oracle?

    Waiting for your quick reply.


    Thanks
    Srinivas
  2. Ady
    Admin
    Ady avatar
    589 posts

    Posted 08 Mar 2010 Link to this post

    Hello Srinivas Chitta,

     Yes, you can use the same generated DLL and forward map your classes to an Oracle db.
    Here's how you can do it
    1. Create a copy of the connection node in the app.config and specify the setting for the oracle backend
    2. Add a 'backendconfiguration' node under the 'backendconfigurations' node. Both the connections should resolve to the same mapping node.
    Here is an example of how the <openaccess> node should look like

    <openaccess xmlns="http://www.telerik.com/OpenAccess">
        <references />
        <connections>
          <connection id="DatabaseConnectionMssql">
            <databasename>Northwind</databasename>
            <servername>(local)\SQLEXPRESS</servername>
            <integratedSecurity>True</integratedSecurity>
            <backendconfigurationname>mssqlConfiguration</backendconfigurationname>
          </connection>
          <connection id="DatabaseConnectionOracle">
            <databasename>databasename</databasename>
            <servername>servername</servername>
            <user>user</user>
            <password>password</password>
            <backendconfigurationname>oracleConfiguration</backendconfigurationname>
          </connection>
        </connections>
        <backendconfigurations>
          <backendconfiguration id="mssqlConfiguration" backend="mssql">
            <mappingname>commonMapping</mappingname>
          </backendconfiguration>
          <backendconfiguration id="oracleConfiguration" backend="oracle">
            <mappingname>commonMapping</mappingname>
          </backendconfiguration>
        </backendconfigurations>
        <mappings current="commonMapping">
          <mapping id="commonMapping" />
        </mappings>
      </openaccess>
     
    Here we have 2 connection nodes - 1 for each backend. Both point to their own 'backendconfiguration nodes - mssqlConfiguration and oracleConfiguration. These configurations point to a common mapping node - 'commonMapping.

     You can switch between the 2 backends using the connection id. You will need to remove/comment out the <extension key="db-do-not-create-table" value="true" /> node for each table so that the table gets created for oracle.

     Do get back to us in case you need further assitance.

    Best wishes,
    Ady
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft banner
  4. Srinivas Chitta
    Srinivas Chitta avatar
    9 posts
    Member since:
    Dec 2009

    Posted 09 Mar 2010 Link to this post

    Hi,

    I could not find the solution to my problem in the given reply. Let me be clear in my question. The scenario is this:

    When we are deploying our application at a client's place, should we create the database manually in the server or will open access automatically create the database in the server based on the connection details provided in the web.config and schema from the DAL.

    Waiting for your immediate reply...

    Thanks and Regards,
    Srinivas
  5. Ady
    Admin
    Ady avatar
    589 posts

    Posted 11 Mar 2010 Link to this post

    Hi Srinivas Chitta,

     As mentioned in my other reply, this is possible using the SchemaHandler api.You can use the API to check the existing database and calculate a SQL script necessary to create/migrate the database to match the existing classless' requirements.

     Hope this helps.

    Sincerely yours,
    Ady
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top