This is a migrated thread and some comments may be shown as answers.

Forward Mapping with another database

3 Answers 94 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Srinivas Chitta
Top achievements
Rank 1
Srinivas Chitta asked on 03 Mar 2010, 04:59 AM
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

3 Answers, 1 is accepted

Sort by
0
Ady
Telerik team
answered on 08 Mar 2010, 04:10 PM
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.
0
Srinivas Chitta
Top achievements
Rank 1
answered on 09 Mar 2010, 06:01 AM
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
0
Ady
Telerik team
answered on 11 Mar 2010, 03:22 PM
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.
Tags
Data Access Free Edition
Asked by
Srinivas Chitta
Top achievements
Rank 1
Answers by
Ady
Telerik team
Srinivas Chitta
Top achievements
Rank 1
Share this question
or