Page 1 of 1

Keyword not supported: 'host'

Posted: Tue 23 Dec 2014 21:18
by francis
Hi,

Using v8.3.303 with EF6. I am unable to connect to the db. Connection string is: "User Id=myuserid;Host=127.0.0.1;Database=mydb"

??

System.ArgumentException was unhandled
HResult=-2147024809
Message=Keyword not supported: 'host'.
Source=System.Data
StackTrace:
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(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)
at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<SetConnectionString>b__18(DbConnection t, DbConnectionPropertyInterceptionContext`1 c)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.SetConnectionString(DbConnection connection, DbConnectionPropertyInterceptionContext`1 interceptionContext)
at System.Data.Entity.Infrastructure.SqlConnectionFactory.CreateConnection(String nameOrConnectionString)
at System.Data.Entity.Infrastructure.LocalDbConnectionFactory.CreateConnection(String nameOrConnectionString)
at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
at System.Data.Entity.Internal.LazyInternalConnection.get_ProviderName()
at System.Data.Entity.Internal.LazyInternalContext.get_ProviderName()
at System.Data.Entity.Internal.DefaultModelCacheKeyFactory.Create(DbContext context)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.Initialize()
at System.Data.Entity.Internal.LazyInternalContext.get_ObjectContext()
at System.Data.Entity.Internal.InternalContext.DetectChanges(Boolean force)
at System.Data.Entity.Internal.InternalContext.GetStateEntry(Object entity)
at System.Data.Entity.Internal.InternalEntityEntry..ctor(InternalContext internalContext, Object entity)
at System.Data.Entity.DbContext.Entry[TEntity](TEntity entity)
at Entities.Context.AttachObjectInState[T](T item, EntityState state) in c:\Users\Visual Studio 2013\Projects\EF6 Test App\EF6 Test App\Context\Context.cs:line 26
at Entities.Context.RegisterAdded[T](T item) in c:\Users\Visual Studio 2013\Projects\EF6 Test App\EF6 Test App\Context\Context.cs:line 81
at EF6_Test_App.Form1.button_add_Click(Object sender, EventArgs e) in c:\Users\Visual Studio 2013\Projects\EF6 Test App\EF6 Test App\Form1.cs:line 46
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at EF6_Test_App.Program.Main() in c:\Users\Visual Studio 2013\Projects\EF6 Test App\EF6 Test App\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Re: Keyword not supported: 'host'

Posted: Wed 24 Dec 2014 11:09
by Shalex
francis wrote: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)
Your code uses the System.Data.SqlClient provider. The namespace of dotConnect for MySQL is Devart.Data.MySql.

Please refer to our tutorials:
http://blog.devart.com/entity-framework ... force.html
http://www.devart.com/dotconnect/mysql/ ... pport.html

If this doesn't help, send us a small test project for reproducing the problem.

Re: Keyword not supported: 'host'

Posted: Wed 24 Dec 2014 21:01
by francis
1) Modifying the app.config as per tutorial did not help. Somehow the DbContext initialization (DbConnectionDispatcher) insists on using sqlclient even though it is not referenced anywhere in my app.

I pass "User Id=myuser;Host=127.0.0.1;Database=mydb" below and it somehow assumes I'm using SQL Server?

[DbConfigurationType(typeof(Devart.Data.MySql.Entity.MySqlEntityProviderServicesConfiguration))]
class Context: DbContext, IContext
{
public Context(string connectionString) : base(connectionString){}
}



2) I tried your example code but CrmDemo.EF6CodeFirst_.zip project does not run. It did not compile until I removed the non-mysql projects (I have the mysql version fo dotconnect).

{"The 'Instance' member of the Entity Framework provider type 'Devart.Data.MySql.Entity.MySqlEntityProviderServices, Devart.Data.MySql.Entity, Version=8.3.303.0, Culture=neutral, PublicKeyToken=09af7300eec23701' did not return an object that inherits from 'System.Data.Entity.Core.Common.DbProviderServices'. Entity Framework providers must inherit from this class and the 'Instance' member must return the singleton instance of the provider. This may be because the provider does not support Entity Framework 6 or later; see http://go.microsoft.com/fwlink/?LinkId=260882 for more information."}

Re: Keyword not supported: 'host'

Posted: Wed 24 Dec 2014 21:31
by francis
In case it helps, here is mu app.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<providers>
<provider invariantName="Devart.Data.MySql" type="Devart.Data.MySql.Entity.MySqlEntityProviderServices, Devart.Data.MySql.Entity, Version=8.3.303.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="Devart.Data.MySql" />
<add name="dotConnect for MySQL" invariant="Devart.Data.MySql" description="Devart dotConnect for MySQL"
type="Devart.Data.MySql.MySqlProviderFactory, Devart.Data.MySql, Version=8.3.303.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="Entities.Properties.Settings.Context" connectionString="User Id=myuser;Host=127.0.0.1;Port=3306;Database=mydb;unicode=True" providerName="Devart.Data.MySql" />
</connectionStrings>
</configuration>

Re: Keyword not supported: 'host'

Posted: Thu 25 Dec 2014 09:39
by Shalex
Your *.config registers "Devart.Data.MySql.Entity, Version=8.3.303.6" but the error is about "Devart.Data.MySql.Entity, Version=8.3.303.0".

Try removing all references to Devart.* assemblies from your project and adding them again:
"C:\Program Files (x86)\Devart\dotConnect\MySQL\Devart.Data.dll"
"C:\Program Files (x86)\Devart\dotConnect\MySQL\Devart.Data.MySql.dll"
"C:\Program Files (x86)\Devart\dotConnect\MySQL\Entity\EF6\Devart.Data.MySql.Entity.dll"

Re: Keyword not supported: 'host'

Posted: Thu 25 Dec 2014 20:16
by francis
That helped thanks. (and thanks for a response on Dec 25!)

Changing in app.config to "Version=8.3.303.0" gets rid the the Keyword not supported error, but now I get this below. What's strange to me is Devart.Data.MySql.Entity.dll really is 8.3.303.6 so I'm not sure specifying 8.3.303.0 is correct.

System.InvalidOperationException was unhandled
HResult=-2146233079
Message=The 'Instance' member of the Entity Framework provider type 'Devart.Data.MySql.Entity.MySqlEntityProviderServices, Devart.Data.MySql.Entity, Version=8.3.303.0, Culture=neutral, PublicKeyToken=09af7300eec23701' did not return an object that inherits from 'System.Data.Entity.Core.Common.DbProviderServices'. Entity Framework providers must inherit from this class and the 'Instance' member must return the singleton instance of the provider. This may be because the provider does not support Entity Framework 6 or later; see http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
Source=EntityFramework
StackTrace:
at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(Type providerType)
at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName)
at System.Data.Entity.Internal.AppConfig.<.ctor>b__2(ProviderElement e)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at System.Data.Entity.Internal.AppConfig.<.ctor>b__1()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at System.Data.Entity.Internal.AppConfig.get_DbProviderServices()
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.RegisterDbProviderServices()
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetServiceFactory(Type type, String name)
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.<>c__DisplayClass1.<GetService>b__0(Tuple`2 t)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetService(Type type, Object key)
at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.GetService(Type type, Object key)
at System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver`2.GetService(Type type, Object key)
at System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetService[T](IDbDependencyResolver resolver)
at System.Data.Entity.DbContext.InitializeLazyInternalContext(IInternalConnection internalConnection, DbCompiledModel model)
at System.Data.Entity.DbContext..ctor(String nameOrConnectionString)
at Entities.Context..ctor(String connectionString) in c:\Documents\Visual Studio 2013\Projects\EF6 Test App\EF6 Test App\Context\Context.cs:line 20
at EF6_Test_App.Form1.button_add_Click(Object sender, EventArgs e) in c:\Documents\Visual Studio 2013\Projects\EF6 Test App\EF6 Test App\Form1.cs:line 24
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at EF6_Test_App.Program.Main() in c:\Documents\Visual Studio 2013\Projects\EF6 Test App\EF6 Test App\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Re: Keyword not supported: 'host'

Posted: Fri 26 Dec 2014 07:51
by Shalex
francis wrote:Changing in app.config to "Version=8.3.303.0" gets rid the the Keyword not supported error, but now I get this below. What's strange to me is Devart.Data.MySql.Entity.dll really is 8.3.303.6 so I'm not sure specifying 8.3.303.0 is correct.
The revision number of provider in the entityFramework section should be *.6 but in DbProviderFactories - *.0. The *.config entry in your previous message seems to be correct.
francis wrote:Message=The 'Instance' member of the Entity Framework provider type 'Devart.Data.MySql.Entity.MySqlEntityProviderServices, Devart.Data.MySql.Entity, Version=8.3.303.0, Culture=neutral, PublicKeyToken=09af7300eec23701' did not return an object that inherits from 'System.Data.Entity.Core.Common.DbProviderServices'. Entity Framework providers must inherit from this class and the 'Instance' member must return the singleton instance of the provider. This may be because the provider does not support Entity Framework 6 or later; see http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
Try removing all references to Devart.* assemblies from your project and adding them again:
"C:\Program Files (x86)\Devart\dotConnect\MySQL\Devart.Data.dll"
"C:\Program Files (x86)\Devart\dotConnect\MySQL\Devart.Data.MySql.dll"
"C:\Program Files (x86)\Devart\dotConnect\MySQL\Entity\EF6\Devart.Data.MySql.Entity.dll"

If this doesn't help, send us a small test project for reproducing the error in our environment.

Re: Keyword not supported: 'host'

Posted: Fri 26 Dec 2014 18:08
by francis
I submitted a project to your support area.

Re: Keyword not supported: 'host'

Posted: Mon 29 Dec 2014 14:55
by Shalex
We have answered you by email.