This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi I analysing the Lightspeed 3 using the trial version for our upcoming upgrade, but I ran into an early problem with the Provider/connection string. Can't see what the difference is really from the 2.1 version of Lightspeed we are using. Whenever I access the database using Lightspeed I get the following error: System.ArgumentException: Keyword not supported: 'port'.
at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey)
at ... I see you are using MySql 5.2.5, but I am rebinding to 5.2.3 using assemblyBinding. This works fine in Lightspeed 2.1.
Below is the full app.config that I am using. Any ideas of what it can be?
<configSections>
|
|
|
Could you provide a bit more of the exception stack trace? I don't think we've added anything that would cause us to parse the connection string, so this looks like a MySQL issue... but presumably you're using the same version of the MySQL Connector that worked under 2.1... So just trying to get a handle on where this might be happening... |
|
|
Yep, I believe you are right and the error seem to be in the MySql provider. It is probably some simple configuration setup bug, but I can't bloody find it. :( Here's the complete stack trace. Please let me know if it gives you any clue of what it is. I'll be analysing a bit more tomorrow evening again (20 hours from now).
System.ArgumentException: Keyword not supported: 'port'.
at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey)
at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, ref DbConnectionOptions userConnectionOptions) at System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) at ..get_Connection() at Mindscape.LightSpeed.UnitOfWork.() at Mindscape.LightSpeed.UnitOfWork.BeginTransaction(IsolationLevel isolationLevel) at Mindscape.LightSpeed.UnitOfWork.SaveChanges(Boolean reset) at Mindscape.LightSpeed.UnitOfWorkBase.SaveChanges() at CookingCore.UserRepository.CreateUser(User user) in UserRepository.cs: line 16 at CookingCore.Test.UserRepositoryTest.TestCreateUser() in UserRepositoryTest.cs: line 25 |
|
|
ok, found it. My bad and stupid mistake. I missed to set the provider here: public static LightSpeedContext<ModelUnitOfWork> Context So I guess it was defaulting to Sql Server or something.
|
|
|
Yep, that would be the problem. As a tip, a quicker and more reliable way to do this is to write: _context = new LightSpeedContext<ModelUnitOfWork>("default"); That is, there's usually no benefit in explicitly copying properties from a configured context to a blank context: it's more reliable (and fewer lines of code!) to just use the configured context directly. (I notice you're setting IdentityMethod in code rather than in config, but you can still modify the properties of a configured context in code if that's what you want.) |
|
|
Yeap, good tipp, thanks. I was actually wondering about that as I was copying the code from the Lightspeed video in order to get the syntax right. FYI, that video also contained code that is marked as obsolete in Lightspeed 3. |
|
|
Hi Tobias, The video has been updated based on the LightSpeed 3.0 release now. Sorry for the confusion. John-Daniel Trask |
|
|
No problem. thanks! |
|