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

Domain Approach - Change backend

5 Answers 121 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Roland
Top achievements
Rank 1
Roland asked on 20 Nov 2010, 12:04 AM
Hello,

I am using the domain model approach in Q3 2010.
I have configured domain model for SQL for now, but I will need the ability to change the backend in the config file to SQLite.

The documentation refers only to the old style configuration. The GetBackendConfiguration method is static and hardcoded to SQL in my generated context class.

public static BackendConfiguration GetBackendConfiguration()
{
BackendConfiguration backend = new BackendConfiguration();
backend.Backend = "mssql";
return backend;
}


How do I change the backend in the web.config file ?

5 Answers, 1 is accepted

Sort by
0
Accepted
Alexander
Telerik team
answered on 23 Nov 2010, 05:17 PM
Hi Roland,

I am afraid that this is not possible. The backend configuration is no longer kept in the app.config/web.config but in the .rlinq file instead. You can, however, use the following constructor of the OpenAccess context class to achieve similar result:
MetadataSource metadataSource = XmlMetadataSource.FromAssemblyResource("EntityDiagrams1.rlinq");
BackendConfiguration config = new BackendConfiguration();
config.Backend = "sqlite";
 
EntityDiagramsContext context = new EntityDiagramsContext ("YourConnectionString", config, metadataSource);

If you really want to keep those settings in the configuration file, you can try to implement some custom logic that reads the needed settings from there and then use the code above. Hope that helps.

Sincerely yours,
Alexander
the Telerik team
Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
0
Roland
Top achievements
Rank 1
answered on 23 Nov 2010, 05:19 PM
Thanks, I figured that one out, but I thought it is still possible to use the openaccess config section.

0
Erik
Top achievements
Rank 2
answered on 14 Mar 2011, 08:53 PM
Hi Alexander,

Oops, I thought that was one of the nifty things, move from backend server...

Also not from MySql to SQL Server?

Thanks
0
Alexander
Telerik team
answered on 17 Mar 2011, 02:11 PM
Hi Proovit,

At the moment changing the backend is not recommended as one rlinq file can contain database specific information for only one backend. If you try to connect to another backend, for example mssql, while the rlinq is configured for mysql, this would most probably lead to runtime problems. However, if you use entirely forward mapping - start from an empty domain model and only add classes, without specifying any database-specific information, OpenAccess will use its default mapping and will be able to create a suitable database for any backend you would like to use. This way OpenAccess will handle the database specifics automatically, based on the currently selected backend and no errors should be observed.
Support for multiple backend configurations in a single rlinq file is on our TODO list and will be implemented for one of the following releases later this year.

Regards,
Alexander
the Telerik team
0
Erik
Top achievements
Rank 2
answered on 17 Mar 2011, 03:21 PM
Ok, thanks for the info Alexander.
Tags
Getting Started
Asked by
Roland
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Roland
Top achievements
Rank 1
Erik
Top achievements
Rank 2
Share this question
or