简体   繁体   English

ArangoDb .Net驱动程序不处理枚举

[英]ArangoDb .Net driver doesn't handle enum

I am a newbie for ArangoDB and I am trying to make some CRUD operation but I am stucked whenever getting to entity object with Enum . 我是ArangoDB的新手,我正在尝试进行一些CRUD操作,但每当与Enum一起使用实体对象时我都会被困住。

It prompted me the message like this. 它提示我这样的消息。

System.InvalidCastException : 
Invalid cast from 'System.Int64' to 'Testing.Sample.Repository.EventAction'.

EventAction is actually an Enum type. EventAction实际上是一个Enum类型。 Once I switch it to integer and it works. 一旦我将其切换为整数,它就可以工作。 I am wondering can I use enum for my case as it is more convenience to handle than using integer. 我想知道我可以使用enum作为我的情况,因为它比使用整数更方便处理。 Thanks. 谢谢。

Since Enum type is not standard JSON type, driver serialize it as integer value. 由于Enum类型不是标准JSON类型,因此驱动程序将其序列化为整数值。 Deserialization might not be supported in the driver version you are using, however new version is going to be released soon with support for Enum type deserialization in strongly typed objects. 您正在使用的驱动程序版本可能不支持反序列化,但是很快将发布新版本,并且在强类型对象中支持Enum类型反序列化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM