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

Code-only: Database name with periods

3 Answers 47 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.
Tonny
Top achievements
Rank 1
Tonny asked on 24 Feb 2014, 12:44 PM
After using OpenAccess in the Database-first scenario for a while, I decided to try Code-only for my new project, and faced a lot of trouble just getting started.

One of these problems had to do with the name of the database to be generated. I initially named it with the domain name of the site it'll eventually become, but using a name with periods (Database=sub.somesite.tld) did not go so well. At first, it couldn't generate the database at all, failing with an SQL syntax error. Adding brackets around the name in the connection string (Database=[sub.somesite.tld]) fixed that and allowed the DB to be created, but this conn-string failed when OA tried to log in to the newly created DB, and "schemaHandler.DatabaseExists()" reported false even though the DB was clearly present on the server.

I've got it running by replacing the periods in the name with underscores (Database=sub_somesite_tld) but I'm still interested in knowing if there's some way you can use a database with periods in the name with Telerik Data Access in the Code-only scenario.

We use SQL Express 2012 on dev and SQL Server 2008/2012 Web Edition on the live servers.

3 Answers, 1 is accepted

Sort by
0
Kristian Nikolov
Telerik team
answered on 25 Feb 2014, 03:49 PM
Hi Tonny,

Thank you for contacting us.

We managed to reproduce the behavior you have described. Unfortunately the cause for it is a bug on our side. Please accept our apologies for the caused inconvenience and find your Telerik Points updated for reporting this new bug. We have logged it in our backlog and it will be scheduled to be fixed in the future.

Meanwhile, we can suggest you a workaround which would allow you to use full stops in the database name. The approach involves the usage of a second OpenAccessContext object which would be instantiated with a modified connection string. This secondary OpenAccessContext object will be used only for creating the database in case it does not already exist. I have attached a sample project illustrating the approach. In order to run the application you may need to upgrade the references to the OpenAccess assemblies. You may also need to update the connection strings defined in the app.config files according to your setup.

I hope this helps. Should you have any more questions, do not hesitate to get back to us.

Regards,
Kristian Nikolov
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
0
Tonny
Top achievements
Rank 1
answered on 26 Feb 2014, 09:01 AM
Hi Kristian

Thank you for the acknowledgement and the reasonable workaround.

I'll adopt your approach with the conn-string manipulation in our code and look forward to seeing the bug fixed in a future release.
0
Kristian Nikolov
Telerik team
answered on 26 Feb 2014, 04:47 PM
Hi Tonny,

We are glad that the workaround is applicable for your scenario. We will be sure to inform you in this thread when a fix is available.

Meanwhile, in case you have additional questions or need assistance, feel free to contact us again via our Ticket System or post in our forums.

Regards,
Kristian Nikolov
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
Tags
Getting Started
Asked by
Tonny
Top achievements
Rank 1
Answers by
Kristian Nikolov
Telerik team
Tonny
Top achievements
Rank 1
Share this question
or