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

Backend independent mapping

3 Answers 55 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.
Anwar
Top achievements
Rank 1
Anwar asked on 29 Jul 2015, 01:39 PM

Hi,

I had a quick look at the following docs about backend independent mapping and I am just worried the whole process is a bit tedious:

http://docs.telerik.com/data-access/developers-guide/code-only-mapping/mapping-clr-types-properties-and-associations/advanced-mapping/backend-independent-mapping/fluent-mapping-mapping-clr-advanced-backend-independent-change-backend

 

What I did is to generate my db objects using an existing Firebird db (db first). The model is quite complex with many tables and some tables containing 100+ columns. I am now trying to switch to Oracle and reuse the original backend. As expected I am getting errors because data types differ between the 2 dbs. However the method described in the previous docs seem to be quite tedious where I need to specify one by one the problematic columns. Would it not be easier to simply regenerate the domain objects for both dbs?

 Am I missing something?

 

Thanks!

Anwar

 

 

3 Answers, 1 is accepted

Sort by
0
Yavor Slavchev
Telerik team
answered on 03 Aug 2015, 01:02 PM
Hi Anwar,
Thank you for contacting us.

If you want to switch a fluent model to work with another backend, especially when this model is quite complex as in your scenario, you basically have two options:
1. Modify your fluent model in order to support backend independent mapping if it is possible. The downside of this approach is that you manually have to go through the mapping and modify the columns but this is a one time effort anyway.
2. The second option is to create another fluent model for the Oracle database, which mapping will fit the Oracle specific columns. The downside of this approach is that you have to maintain two mappings simultaneously and keep them in sync.

If you plan to switch to Oracle and not use the Firebird db, I will recommend you to use the second approach to regenerate the mapping but if you plan to use the two data sources simultaneously, it is better to use the first approach and unify the column mappings.

I hope this information is helpful.

Regards,
Yavor Slavchev
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
0
Anwar
Top achievements
Rank 1
answered on 05 Aug 2015, 08:40 AM

Hi Yavor,

 

Thanks for the information. I will have to maintain 2 datasources (oracle & firebird), so I guess I will use the column mappings approach. However I am still not sure how to proceed after having read the documents.

 - In my case I am using a database first approach, i.e. the domain classes are generated from the db tables (including associations etc).

- So basically I have a generated context inheriting from OpenAccesContext as well as an XmlMetadataSource which points to an .rling file.

 My question is: how do I adapt the generated artefacts so that my mappings are db independent (off course knowing that they have been generating using a specific db)?

 

Thanks!

 

Anwar

0
Yavor Slavchev
Telerik team
answered on 07 Aug 2015, 09:44 AM
Hello Anwar,

Thank you for getting back to us.

As it is explained in the documentation, in order to configure your properties in an abstract  manner, you have to change your fluent mapping by going through the entire mapping and changed the data source specific properties. There is no automated way to do this. This way, you will precisely review your mapping which will avoid further database specific problems.

I hope this is helpful. Let us know if you have any further questions.

Regards,
Yavor Slavchev
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Tags
Data Access Free Edition
Asked by
Anwar
Top achievements
Rank 1
Answers by
Yavor Slavchev
Telerik team
Anwar
Top achievements
Rank 1
Share this question
or