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

Create duplicate database

1 Answer 71 Views
Web Services
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Thomas
Top achievements
Rank 1
Thomas asked on 18 Jul 2011, 11:26 AM
Today we have one MsSql database and one EntityDiagrams.rlinq file which are matched up.

But for some installations we would ler the user decide for an SQLite database instead, and therefore we need to reverse engineer the EntityDiagrams to the new database, but we have no idea how to do this with OpenAccess.

Thanks in advance
-Thomas Leggett
Eltek Valere

1 Answer, 1 is accepted

Sort by
0
Serge
Telerik team
answered on 20 Jul 2011, 05:03 PM
Hello Thomas,

 For the time being we haven't fully implemented multi backend support for the visual designer, which basically means that you will be able to get it working though you will need to get a better understanding of OpenAccess.

First of all if you setup your model correctly you will be able to connect to different backends using the same model. In order to do so there are a couple of things you need to grasp. The model that you have defined contains of two parts, a relational one (that describes the database schema) and a conceptual one (that holds the information about your CLR classes). 

And of course the mapping between the two. The point is that the relational model sometimes holds backend specific information, for example the MetaColumn (that represents a column in the database) holds the information about the type, which is backend specific. 

So in other words if you have information in your model that is specific to MSSQL you will not be able to connect to MySQL with the same mapping. Fortunately there is a way to work around this. As you have said you have started developing with the visual designer, so there is a big chance that you only have your conceptual mapping defined. If you have used OpenAccess to generate your database you have little trouble. 

The point is that OpenAccess can create the relational part of the model (and the schema) on its own, just based on the backend you want to connect to. It will use the defaults that it knows are backend specific and populate your model. 

In order to check the relational part of your model have a look at the Model Schema Explorer

So basically the configuration you need to to is just change the backend you are connecting to in theBackendConfigurationSettings that are passed to the context. Have a look at the generated context class and the GetBackendConfiguration() method. The only thing you need to change in order to connect tomysql is the Backend. It should go from "mssql" to "mysql". Of course you will need to change the connection string as well. I will suggesting creating your own context class that can handle this and not using the generated one. 

As to schema generation please have a look at this blog post.

 This should be enough to get you started, please do not hesitate to let us know if you face further trouble. I am looking forward to helping you set up your domain model. 

All the best,
Serge
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Web Services
Asked by
Thomas
Top achievements
Rank 1
Answers by
Serge
Telerik team
Share this question
or