problema mysql com entityframework
26/09/2013
0
segue msg de erro:
System.Data.Entity.Infrastructure.DbUpdateException was unhandled
HResult=-2146233087
Message=Erro ao atualizar as entradas. Consulte a exceção interna para obter detalhes.
Source=EntityFramework
StackTrace:
em System.Data.Entity.Internal.InternalContext.SaveChanges()
em System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
em System.Data.Entity.DbContext.SaveChanges()
em ConsoleApplication5.ProAplicacao.Salvar(Produto produto) na c:\ConsoleApplication5\ConsoleApplication5\ProAplicacao.cs:linha 19
em ConsoleApplication5.Program.Main(String[] args) na c:\ConsoleApplication5\ConsoleApplication5\Program.cs:linha 17
em System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
em Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
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: System.Data.UpdateException
HResult=-2146233087
Message=Erro ao atualizar as entradas. Consulte a exceção interna para obter detalhes.
Source=System.Data.Entity
StackTrace:
em System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
em System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)
em System.Data.Entity.Internal.InternalContext.SaveChanges()
InnerException: MySql.Data.MySqlClient.MySqlException
HResult=-2147467259
Message=Table 'lumendonca.produtoes' doesn't exist
Source=MySql.Data
ErrorCode=-2147467259
Number=1146
StackTrace:
em MySql.Data.MySqlClient.MySqlStream.ReadPacket()
em MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
em MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId)
em MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
em MySql.Data.MySqlClient.MySqlDataReader.NextResult()
em MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
em MySql.Data.Entity.EFMySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
em System.Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator translator, EntityConnection connection, Dictionary`2 identifierValues, List`1 generatedValues)
em System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
InnerException:
Alguem pode me ajudar a resolver
grato
Fernando
Fernando Fecher
Posts
27/09/2013
Thiago Porto
Segue um exemplo de remoção da pluralização:
PS: Esse modelo se conecta com Mysql mas não tem diferença com outro banco
public class Contexto : DbContext { public Contexto() : base("connMySql") { } public DbSet<Marcas> marcas { get; set; } protected override void OnModelCreating(DbModelBuilder modelBuilder) { Database.SetInitializer(new CreateDatabaseIfNotExists<Contexto>()); //cria o banco se não existir modelBuilder.Conventions.Remove<PluralizingTableNameConvention>(); //remove a pluralização } }
27/09/2013
Thiago Porto
27/09/2013
Fernando Fecher
System.Data.ProviderIncompatibleException was unhandled
HResult=-2146233087
Message=An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.
Source=EntityFramework
StackTrace:
em System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection)
em System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest)
em System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
em System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
em System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
em System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
em System.Data.Entity.Internal.InternalContext.Initialize()
em System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
em System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
em System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
em System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName)
em System.Data.Entity.Internal.Linq.InternalSet`1.Add(Object entity)
em System.Data.Entity.DbSet`1.Add(TEntity entity)
em ConsoleApplication5.ProAplicacao.Salvar(Produto produto) na c:\ConsoleApplication5\ConsoleApplication5\ProAplicacao.cs:linha 18
em ConsoleApplication5.Program.Main(String[] args) na c:\ConsoleApplication5\ConsoleApplication5\Program.cs:linha 17
em System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
em Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
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: System.Data.ProviderIncompatibleException
HResult=-2146233087
Message=O provedor não retornou uma cadeia de caracteres ProviderManifestToken.
Source=System.Data.Entity
StackTrace:
em System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection)
em System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection)
InnerException: System.Data.SqlClient.SqlException
HResult=-2146232060
Message=Erro de rede ou específico à instância ao estabelecer conexão com o SQL Server. O servidor não foi encontrado ou não estava acessível. Verifique se o nome da instância está correto e se o SQL Server está configurado para permitir conexões remotas. (provider: SQL Network Interfaces, error: 26 - Erro ao Localizar Servidor/Instância Especificada)
Source=.Net SqlClient Data Provider
ErrorCode=-2146232060
Class=20
LineNumber=0
Number=-1
Server=""
State=0
StackTrace:
em System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
em System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
em System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)
em System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
em System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
em System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
em System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions)
em System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
em System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
em System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions)
em System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions)
em System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
em System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
em System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
em System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
em System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
em System.Data.SqlClient.SqlConnection.Open()
em System.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnection sqlConnection, Action`1 act)
em System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection, Action`1 act)
em System.Data.SqlClient.SqlProviderServices.GetDbProviderManifestToken(DbConnection connection)
em System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection)
InnerException:
27/09/2013
Fernando Fecher
<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=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> </configSections> <connectionStrings> <add name="DbContexto" connectionString="server=174.36.33.6;User Id=lume;password=12345;database=lumendonca" providerName="MySql.Data.MySqlClient"/> </connectionStrings> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
27/09/2013
Thiago Porto
<system.data> <DbProviderFactories> <add name="MySql Data Provider" invariant="MySql.Data.MySqlClient" description=".Net FrameWork Data Provider for MySql" type="MySql.Data.MySqlClient.MySqlClientFactory,MySql.Data,Version=6.5.4.0,Culture=neutral"/> </DbProviderFactories> </system.data>
27/09/2013
Thiago Porto
[url]http://wwww.youtube.com/waibtecnologia[/url]
27/09/2013
Fernando Fecher
HResult=-2146233067
Message=Unable to determine the provider name for connection of type 'System.Data.SqlClient.SqlConnection'.
Source=EntityFramework
StackTrace:
em System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInvariantName(DbConnection connection)
em System.Data.Entity.Internal.InternalConnection.get_ProviderName()
em System.Data.Entity.Internal.LazyInternalConnection.get_ProviderName()
em System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
em System.Data.Entity.Internal.InternalContext.Initialize()
em System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
em System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
em System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
em System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName)
em System.Data.Entity.Internal.Linq.InternalSet`1.Add(Object entity)
em System.Data.Entity.DbSet`1.Add(TEntity entity)
em ConsoleApplication5.ProAplicacao.Salvar(Produto produto) na c:\ConsoleApplication5\ConsoleApplication5\ProAplicacao.cs:linha 18
em ConsoleApplication5.Program.Main(String[] args) na c:\ConsoleApplication5\ConsoleApplication5\Program.cs:linha 17
em System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
em Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
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:
POREM PRECISO SABER QUAL A VERSAO QUE ESTA INSTALADA NO MEU SERVIDOR ?
27/09/2013
Thiago Porto
27/09/2013
Thiago Porto
27/09/2013
Fernando Fecher
Clique aqui para fazer login e interagir na Comunidade :)