2013-01-22 3 views
0

을 직렬화 할 때 오류가 발생했습니다. Google의 백업 데이터베이스에 varbinary (max) 유형의 데이터 필드가 있습니다. Breeze를 사용하면이 필드에 데이터를 저장할 수 있지만 다시 호출 할 때 오류가 발생합니다. 생성 된 모델에서 필드는 byte []로 매핑됩니다. 그러나 Breeze가이를 문자열로 직렬화하려고 시도하면 오류가 발생합니다.byte []

$id: "1", 
$type: "System.Web.Http.HttpError, System.Web.Http", 
Message: "An error has occurred.", 
ExceptionMessage: "The specified cast from a materialized 'System.String' type to the 'System.Byte[]' type is not valid.", 
ExceptionType: "System.InvalidOperationException", 
StackTrace: " at System.Data.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal) at System.Data.Common.Internal.Materialization.Shaper.GetColumnValueWithErrorHandling[TColumn](Int32 ordinal) at lambda_method(Closure , Shaper) at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper) at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Breeze.WebApi.ODataActionFilter.OnActionExecuted(HttpActionExecutedContext actionExecutedContext) at System.Web.Http.Filters.ActionFilterAttribute.CallOnActionExecuted(HttpActionContext actionContext, HttpResponseMessage response, Exception exception) at System.Web.Http.Filters.ActionFilterAttribute.<>c__DisplayClass2.<System.Web.Http.Filters.IActionFilter.ExecuteActionFilterAsync>b__0(HttpResponseMessage response) at System.Threading.Tasks.TaskHelpersExtensions.<>c__DisplayClass41`2.<Then>b__40(Task`1 t) at System.Threading.Tasks.TaskHelpersExtensions.ThenImpl[TTask,TOuterResult](TTask task, Func`2 continuation, CancellationToken cancellationToken, Boolean runSynchronously)" 

도움이 될 것입니다.

+0

오늘은 나중에 살펴 보려고합니다. –

답변

0

나는 이것을 재현 할 수 없었다.

Breeze는 서버 쪽 바이트 []를 사용하여 클라이언트의 문자열로 변환 할 수 있습니다. Employee 엔티티가 리턴 될 때마다 breeze 'DocCode'샘플에서이 예제를 볼 수 있습니다. Employee 유형에는 '문자열'로 breeze 클라이언트에 반환되는 'byte []'의 서버 측 데이터 유형이있는 Photo 속성이 있습니다.

내가 생각한 것은 데이터베이스의 바이너리 BLOB를 문자열 속성으로 구체화하려는 서버 측 구체화 문제입니다. 이것은 모델 속성이 'byte []'대신 'String'으로 입력 된 경우 발생합니다.

희망이 도움이됩니다.

관련 문제