1
resposta

Erro no Dialect

Na linha 2 do GeraSchema: new SchemaExport(cfg).Create(true, true);

Ao executar pela primeira vez, recebo o erro no Dialect:

  • An unhandled exception of type 'NHibernate.HibernateException' occurred in NHibernate.dll

  • Additional information: Could not instantiate dialect class NHibernate.Dialect.MySql5Dialect

View Details:

NHibernate.HibernateException was unhandled HResult=-2146233088 Message=The host localhost does not support SSL connections. Source=NHibernate StackTrace: em NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action1 scriptAction, Boolean execute, Boolean justDrop, TextWriter exportOutput) em NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Boolean useStdOut, Boolean execute, Boolean justDrop) em NHibernate.Tool.hbm2ddl.SchemaExport.Create(Boolean useStdOut, Boolean execute) em AulaBD.Infra.NHibernateHelper.GeraSchema() na c:\users\rfran\documents\visual studio 2015\Projects\AulaBD\AulaBD\Infra\NHibernateHelper.cs:linha 24 em AulaBD.Program.Main(String[] args) na c:\users\rfran\documents\visual studio 2015\Projects\AulaBD\AulaBD\Program.cs:linha 14 em System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) em System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) em Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() em System.Threading.ThreadHelper.ThreadStart_Context(Object state) em System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) em System.Threading.ThreadHelper.ThreadStart() InnerException: Code=0 ErrorCode=-2147467259 HResult=-2147467259 Message=The host localhost does not support SSL connections. Number=0 Source=MySql.Data StackTrace: em MySql.Data.MySqlClient.NativeDriver.Open() em MySql.Data.MySqlClient.Driver.Open() em MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) em MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() em MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() em MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() em MySql.Data.MySqlClient.MySqlPool.GetConnection() em MySql.Data.MySqlClient.MySqlConnection.Open() em NHibernate.Connection.DriverConnectionProvider.GetConnection() em NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action1 scriptAction, Boolean execute, Boolean justDrop, TextWriter exportOutput) InnerException:

*** O MySql.Data está presente em References

Além disso, tive que incluir os seguintes "usings": using NHibernate.Tool.hbm2ddl; using System.Reflection;

Que nao foram mencionados na aula. É isso mesmo ?

1 resposta

Olá, Ricardo

Por favor, confira a propriedade dialect e veja se o nome está exatamente igual a este abaixo:

<property name="dialect">
    NHibernate.Dialect.MySQL5Dialect
</property>

Qualquer diferença, mesmo entre maiúsculas e minúsculas, irá gerar o erro que você encontrou acima.