Page 1 of 1

LinqConnect from local to production server problem

Posted: Wed 13 Mar 2013 05:52
by ferroariel
Hi you all!
I´m using LinqConnect Free to map a couple of MySQL tables to my .NET project. Everything went fine, despite a couple of tweaks here and there.
This is the question: How can I publish my project to my production server? Is this version targeted to testing purposes only? I say this ´cause I couldn´t find a way to change the connection string from local to production server and compile the project correctly.
Any clue will be highly appreciated.
Regards,
Ariel

Re: LinqConnect from local to production server problem

Posted: Wed 13 Mar 2013 13:00
by MariiaI
If we correctly understood you, you are using LinqConnect Express (not Trial).
To deploy applications written with the help of LinqConnect to a production server you should register the run-time assemblies Devart.Data.MySql.Linq.dll, Devart.Data.Linq.dll, Devart.Data.MySql.dll and Devart.Data.dll at Global Assembly Cache (GAC) or place them in the Bin folder of your application.
For more information about deployment see
http://www.devart.com/linqconnect/docs/Deployment.html
http://www.devart.com/dotconnect/mysql/ ... yment.html

In case you are using LinqConnect Trial, it is necessary to add a technical license resource to your application to use it on computers where LinqConnect is not installed. This is a peculiarity of the LinqConnect trial, there should be no need in adding this resource when using a licensed version.
For more information about licensing please refer to
http://www.devart.com/dotconnect/mysql/ ... ml#compile

If this information doesn't help, please specify the problems you are encountering with LinqConnect in more details.

Re: LinqConnect from local to production server problem

Posted: Wed 13 Mar 2013 13:07
by ferroariel
Thanks for your reply!
I´m using the FREE version. The problem I´m facing is that the production server db connection string uses "localhost" too, so when I try to build and deploy / publish the project, the compiler tries to find the tables on MY localhost, and the compiler throws zillions of errors...
Ariel

Re: LinqConnect from local to production server problem

Posted: Thu 14 Mar 2013 12:32
by MariiaI
Could you please specify the connection string you are using and, if possible, please send us a sample project with which this situation could be reproduced.

Connection string could be changed by selecting the 'Edit Connection Properties' in the context menu of the Database Explorer (it is available when your model *.lqml is opened).
Also, the necessary connection string could be passed to the DataContext constructor.

Re: LinqConnect from local to production server problem

Posted: Thu 14 Mar 2013 12:43
by ferroariel
I´m using a "localhost" on my pc, and the final production server force me to use "localhost", too! So when I follow the steps you mentioned, I´m being unable to change the connection that way; db / user / pw are not the very same in both places

Re: LinqConnect from local to production server problem

Posted: Fri 15 Mar 2013 13:48
by MariiaI
To resolve this issue, you can pass one or another connection string to your DataContext constructor, depending on where the code is being executed (at the local development machine or at the production server). For example, you can use the compilation conditions for this:

Code: Select all

//the code that determine what connection string to use 

#if DEBUG
   static string connectionString = "data source = localhost; ... ";//put here the necessary connection string
#else
   static string connectionString = "data source = Mylocalhost; ... ";//put here the necessary connection string
#endif

Code: Select all

//DataContext constructor with the necessary connection string
   
 YourDataContext context = new YourDataContext(connectionString);
Please tell us about the results.

Re: LinqConnect from local to production server problem

Posted: Fri 15 Mar 2013 20:30
by ferroariel
I´ll give it a try and let you know, thanks!

Re: LinqConnect from local to production server problem

Posted: Sun 17 Mar 2013 17:17
by ferroariel
It works! But, frankly, I decided to a simpler option; just create a local mysql user with the same credentials as the production server one, to keep moving. Also, I´m not sure about how this works: it creates all objects at compiler time? at runtime?
Thank you anyway!

Re: LinqConnect from local to production server problem

Posted: Mon 18 Mar 2013 13:42
by MariiaI
While compiling your project the first or the second string is compiled (due to the condition we have added). The objects (connection string and DataContext object with this connection string) are created at runtime.

For more information about conditional compilation please refer to
http://msdn.microsoft.com/library/vstud ... 00%29.aspx

Re: LinqConnect from local to production server problem

Posted: Mon 18 Mar 2013 13:58
by ferroariel
That´s excelent! Thanks for your support!

Re: LinqConnect from local to production server problem

Posted: Tue 19 Mar 2013 09:29
by MariiaI
If you have any further questions, feel free to contact us.