LinqConnect from local to production server problem

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
ferroariel
Posts: 8
Joined: Wed 13 Mar 2013 05:48

LinqConnect from local to production server problem

Post by ferroariel » Wed 13 Mar 2013 05:52

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

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: LinqConnect from local to production server problem

Post by MariiaI » Wed 13 Mar 2013 13:00

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.

ferroariel
Posts: 8
Joined: Wed 13 Mar 2013 05:48

Re: LinqConnect from local to production server problem

Post by ferroariel » Wed 13 Mar 2013 13:07

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

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: LinqConnect from local to production server problem

Post by MariiaI » Thu 14 Mar 2013 12:32

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.

ferroariel
Posts: 8
Joined: Wed 13 Mar 2013 05:48

Re: LinqConnect from local to production server problem

Post by ferroariel » Thu 14 Mar 2013 12:43

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

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: LinqConnect from local to production server problem

Post by MariiaI » Fri 15 Mar 2013 13:48

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.

ferroariel
Posts: 8
Joined: Wed 13 Mar 2013 05:48

Re: LinqConnect from local to production server problem

Post by ferroariel » Fri 15 Mar 2013 20:30

I´ll give it a try and let you know, thanks!

ferroariel
Posts: 8
Joined: Wed 13 Mar 2013 05:48

Re: LinqConnect from local to production server problem

Post by ferroariel » Sun 17 Mar 2013 17:17

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!

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: LinqConnect from local to production server problem

Post by MariiaI » Mon 18 Mar 2013 13:42

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

ferroariel
Posts: 8
Joined: Wed 13 Mar 2013 05:48

Re: LinqConnect from local to production server problem

Post by ferroariel » Mon 18 Mar 2013 13:58

That´s excelent! Thanks for your support!

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: LinqConnect from local to production server problem

Post by MariiaI » Tue 19 Mar 2013 09:29

If you have any further questions, feel free to contact us.

Post Reply