Issue Details (XML | Word | Printable)

Key: DNET-456
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jiri Cincura
Reporter: Full Metal Jacket
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
.NET Data provider

BLOB field in EF4 generate System.NotSupportedException: PrimitiveTypeKind.Binary

Created: 31/Aug/12 08:36 AM   Updated: 27/Aug/15 06:13 AM
Component/s: Entity Framework
Affects Version/s: 2.6, 2.6.5, 2.7, 2.7.5, 2.7.7
Fix Version/s: 4.8.0.0

Environment: Win7(32) - visual studio 2010 - EF4


 Description  « Hide
Mapping a field of type BLOB sub_type 0 as a Byte[] in EF4, during the call of SaveChanges() method, it returns an incomprehensible exception:
System.NotSupportedException: PrimitiveTypeKind.Binary

I created a dataannotation like:
[Column(TypeName="BLOB")]
public Byte[] filecontent { get; set; }

I can't find online documentation about how to map a blob field in EF4, maybe you can help us.

STACK TRACE
[NotSupportedException: PrimitiveTypeKind.Binary]
   FirebirdSql.Data.Entity.SqlGenerator.GetSqlPrimitiveType(TypeUsage type) +712
   FirebirdSql.Data.Entity.DmlSqlGenerator.GenerateReturningSql(StringBuilder commandText, DbModificationCommandTree tree, ExpressionTranslator translator, DbExpression returning) +586
   FirebirdSql.Data.Entity.DmlSqlGenerator.GenerateInsertSql(DbInsertCommandTree tree, List`1& parameters) +589
   FirebirdSql.Data.Entity.SqlGenerator.GenerateSql(DbCommandTree tree, List`1& parameters, CommandType& commandType) +308
   FirebirdSql.Data.FirebirdClient.FbProviderServices.CreateCommand(DbProviderManifest manifest, DbCommandTree commandTree) +601
   FirebirdSql.Data.FirebirdClient.FbProviderServices.CreateDbCommandDefinition(DbProviderManifest manifest, DbCommandTree commandTree) +16
   System.Data.Common.DbProviderServices.CreateCommandDefinition(DbCommandTree commandTree) +147
   System.Data.Common.DbProviderServices.CreateCommand(DbCommandTree commandTree) +7
   System.Data.Mapping.Update.Internal.UpdateTranslator.CreateCommand(DbModificationCommandTree commandTree) +40

[EntityCommandCompilationException: Errore durante la preparazione della definizione del comando. Per ulteriori informazioni, vedere l'eccezione interna.]
   System.Data.Mapping.Update.Internal.UpdateTranslator.CreateCommand(DbModificationCommandTree commandTree) +78
   System.Data.Mapping.Update.Internal.DynamicUpdateCommand.CreateCommand(UpdateTranslator translator, Dictionary`2 identifierValues) +163
   System.Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator translator, EntityConnection connection, Dictionary`2 identifierValues, List`1 generatedValues) +52
   System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter) +267

[UpdateException: Errore durante l'aggiornamento delle voci. Per ulteriori informazioni, vedere l'eccezione interna.]
   System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter) +389
   System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache) +163
   System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options) +609
   System.Data.Entity.Internal.InternalContext.SaveChanges() +120

[DbUpdateException: Errore durante l'aggiornamento delle voci. Per ulteriori informazioni, vedere l'eccezione interna.]
   System.Data.Entity.Internal.InternalContext.SaveChanges() +206
   System.Data.Entity.Internal.LazyInternalContext.SaveChanges() +24
   System.Data.Entity.DbContext.SaveChanges() +20
   DbContext.SaveChanges() in DbContext.cs:735
   AttachmentRepository.Save(Attachment attachment, ICollection`1 clsCat, Int32 currentUserId) in AttachmentRepository.cs:360
   Controllers.AttachmentController.CreateConfirm(Attachment attach, IEnumerable`1 files, List`1 ClsTreeView_checkedNodes, String sessioneVarId, Boolean LastDoc) in
   lambda_method(Closure , ControllerBase , Object[] ) +288
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
   System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
   System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
   System.Web.Mvc.Controller.ExecuteCore() +116
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8970061
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jiri Cincura added a comment - 26/Aug/15 12:34 PM
I know this is a pretty old ticket, but I'll give it a shot. Are you still facing the issue? The `Binary` type is supported in `GetSqlPrimitiveType` now, so I believe this is fixed (already for a long time :)).

Jiri Cincura added a comment - 27/Aug/15 06:13 AM
Tested with EF6 and latest provider and it's fine.