I am using Entity Framework with ODP.NET 11.2.0.3.0. Perseverance worked for me for some tables, but this apartment does not allow to add a simple new object, and I can not understand it. Your help is greatly appreciated. Thanks you
Here is the code. I removed the image field from the object through the model browser, and yet the code will not work when SaveChanges () is called.
var corpDirectoryEntities = new CorpDirectoryEntities(); var cc = new EmployeePhoto(); cc.UserId = 12345;
The following exception is thrown.
System.Data.UpdateException was unhandled by user code
Message = An error occurred while updating the entries. See the inner exception for details.
Source = System.Data.Entity
Stacktrace:
at System.Data.Mapping.Update.Internal.UpdateTranslator.Update (IEntityStateManager stateManager, IEntityAdapter adapter)
at System.Data.EntityClient.EntityAdapter.Update (IEntityStateManager entityCache)
at System.Data.Objects.ObjectContext.SaveChanges (SaveOptions options)
at System.Data.Objects.ObjectContext.SaveChanges ()
at Repositories.Services.CorpDirectory.CorpDirectoryRepository.SaveDirectoryAccountPhoto (Int32 accountId, Byte [] photoStream) in C: \ Dev \ Projects \ Repositories \ Services \ CorpDirectory \ CorpDirectoryRepository.cs: line 356
at Tests.CorpDirectory.CorpDirectoryUserTestFixture.TestGetUserPhoto () in C: \ Dev \ Projects \ Repositories.Tests \ CorpDirectory \ CorpDirectoryUserTestFixture.cs: line 192
InnerException: System.Data.EntityCommandCompilationException
Message = An error occurred while preparing the command definition. See the inner exception for details.
Source = System.Data.Entity
Stacktrace:
at System.Data.Mapping.Update.Internal.UpdateTranslator.CreateCommand (DbModificationCommandTree commandTree)
at System.Data.Mapping.Update.Internal.DynamicUpdateCommand.CreateCommand (UpdateTranslator translator, Dictionary`2 identifierValues)
at System.Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute (UpdateTranslator translator, EntityConnection connection, Dictionary`2 identifierValues, List`1 generatedValues)
at System.Data.Mapping.Update.Internal.UpdateTranslator.Update (IEntityStateManager stateManager, IEntityAdapter adapter)
InnerException: System.InvalidOperationException
Message = Operation is not valid due to the current state of the object.
Source = Oracle.DataAccess
Stacktrace:
at Oracle.DataAccess.Client.SqlGen.DmlSqlGenerator.ExpressionTranslator.Visit (DbScanExpression expression)
at System.Data.Common.CommandTrees.DbScanExpression.Accept (DbExpressionVisitor visitor)
at Oracle.DataAccess.Client.SqlGen.DmlSqlGenerator.GenerateInsertSql (DbInsertCommandTree tree, EFOracleProviderManifest providerManifest, EFOracleVersion sqlVersion, List`1 & parameters)
at Oracle.DataAccess.Client.SqlGen.SqlGenerator.GenerateSql (DbCommandTree tree, EFOracleProviderManifest providerManifest, EFOracleVersion sqlVersion, List`1 & parameters, CommandType & commandType)
at Oracle.DataAccess.Client.EFOracleProviderServices.CreateCommand (EFOracleProviderManifest providerManifest, DbCommandTree commandTree)
at Oracle.DataAccess.Client.EFOracleProviderServices.CreateDbCommandDefinition (DbProviderManifest providerManifest, DbCommandTree commandTree)
at System.Data.Common.DbProviderServices.CreateCommandDefinition (DbCommandTree commandTree)
at System.Data.Common.DbProviderServices.CreateCommand (DbCommandTree commandTree)
at System.Data.Mapping.Update.Internal.UpdateTranslator.CreateCommand (DbModificationCommandTree commandTree)
InnerException:
source share