Code First - Unexpected store type 'blob'

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
aldare666
Posts: 10
Joined: Wed 08 Oct 2014 11:31

Code First - Unexpected store type 'blob'

Post by aldare666 » Tue 03 Feb 2015 08:31

Hello,

I am getting this error when trying to save entity with BLOB database column type.
I am using pure EF fluent mapping, no .edml file, with stored procedures

Entity :

Code: Select all

 public partial class File
  {
    public byte[] FileData { get; set; }
  }
Mapping :

Code: Select all

public class FileMap : EntityTypeConfiguration<File>
  {
    public FileMap()
    {
      this.Property(t => t.FileData)
                .IsRequired();
      // Table & Column Mappings
      this.ToTable("V_SHEET_FILE", "DEV");
      this.MapToStoredProcedures(s=>s.Insert(i=>i.HasName("SHEET_FILE_I", "ADAPTER")).Update(d=>d.HasName("SHEET_FILE_U", "ADAPTER").RowsAffectedParameter("AFFECTEDROWS")).Delete(d=>d.HasName("SHEET_FILE_D", "ADAPTER").RowsAffectedParameter("AFFECTEDROWS")));
      this.Property(t => t.FileData).HasColumnType("BLOB").HasColumnName("FILE_DATA");
    }
  }
Stack trace of error:

Code: Select all

   at System.Data.Common.CommandTrees.d.a(String A_0, Int32& A_1)
   at System.Data.Common.CommandTrees.d.b(TypeUsage A_0, Int32& A_1)
   at System.Data.Common.CommandTrees.b.a(EdmFunction A_0)
   at System.Data.Common.CommandTrees.d.a(EdmFunction A_0)
   at System.Data.Common.CommandTrees.c.a(DbFunctionCommandTree A_0)
   at System.Data.Common.CommandTrees.c.a(DbCommandTree A_0)
   at System.Data.Common.CommandTrees.c.b(DbCommandTree A_0)
   at Devart.Data.Oracle.Entity.OracleEntityProviderServices.a(az A_0, DbCommandTree A_1)
   at Devart.Data.Oracle.Entity.OracleEntityProviderServices.CreateDbCommandDefinition(DbProviderManifest baseProviderManifest, DbCommandTree commandTree)
   at System.Data.Entity.Core.Common.DbProviderServices.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree, DbInterceptionContext interceptionContext)
   at System.Data.Entity.Core.Common.DbProviderServices.CreateCommandDefinition(DbCommandTree commandTree, DbInterceptionContext interceptionContext)
   at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.GenerateCommandDefinition(ModificationFunctionMapping functionMapping)
   at System.Data.Entity.Core.Mapping.Update.Internal.FunctionUpdateCommand..ctor(ModificationFunctionMapping functionMapping, UpdateTranslator translator, ReadOnlyCollection`1 stateEntries, ExtractedStateEntry stateEntry)
   at System.Data.Entity.Core.Mapping.Update.Internal.ModificationFunctionMappingTranslator.EntitySetTranslator.Translate(UpdateTranslator translator, ExtractedStateEntry stateEntry)
   at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.<ProduceFunctionCommands>d__1a.MoveNext()
   at System.Linq.Enumerable.<ConcatIterator>d__71`1.MoveNext()
   at System.Data.Entity.Core.Mapping.Update.Internal.UpdateCommandOrderer..ctor(IEnumerable`1 commands, UpdateTranslator translator)
   at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.ProduceCommands()
   at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
   at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.<Update>b__2(UpdateTranslator ut)
   at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update[T](T noChangesResult, Func`2 updateFunction)
   at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update()
   at System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesToStore>b__35()
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
   at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
   at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass2a.<SaveChangesInternal>b__27()
   at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
   at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
   at System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options)
   at System.Data.Entity.Internal.InternalContext.SaveChanges()
   at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
   at System.Data.Entity.DbContext.SaveChanges()
...
I have tracked the error in the library (although obfuscated) and found this piece of code in System.Data.Common.CommandTrees.d.a(String A_0, Int32& A_1) :

Code: Select all

switch (A_0)
      {
        ...
        case "BLOB":
          A_1 = 3;
          break;
        ...
      }
which proves this should work, but ... the text of the error says 'blob' and not 'BLOB'. Might that be the root of the problem?

Is there any chance this might be corrected?

Thank you for any help!

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: Code First - Unexpected store type 'blob'

Post by Shalex » Wed 04 Feb 2015 15:06

Thank you for your report. We have reproduced the issue and are investigating it. We will notify you about the result.

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: Code First - Unexpected store type 'blob'

Post by Shalex » Fri 13 Feb 2015 10:03

The bug with parsing the types of stored procedure parameters in Code-First mapping is fixed in the new (8.4.352) build of dotConnect for Oracle. Please try it and notify us about the results.

aldare666
Posts: 10
Joined: Wed 08 Oct 2014 11:31

Re: Code First - Unexpected store type 'blob'

Post by aldare666 » Fri 20 Feb 2015 10:32

Thank you for the fix. I will check it shortly and get back with result.

Post Reply