Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLOB field in EF4 generate System.NotSupportedException: PrimitiveTypeKind.Binary [DNET456] #449

Closed
firebird-automations opened this issue Aug 31, 2012 · 4 comments

Comments

@firebird-automations
Copy link

Submitted by: Full Metal Jacket (fmj)

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

@firebird-automations
Copy link
Author

Commented by: @cincuranet

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 :)).

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Tested with EF6 and latest provider and it's fine.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: In Progress [ 3 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: vNext [ 10705 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants