google bigquery c# API enum -


i'm trying work bigquery, c# api , complex types.

i have object like

public class myobject {     public myotherobject someproperty { get; set; } }  public class myotherobject {     public string innerproperty { get; set; }      public myenum otherinnerproperty { get; set; } } 

the field in table corresponding myotherobject record, innerproperty string field , otherinnerproperty string field.

working tabledatainsertallrequest.rowsdata, when try "map" in json property (which dictionary<string,object>) property myotherobject corresponding field, error thrown because (i assume) otherinnerproperty, enum, cannot converted string.

any idea how deal enums in particular case ?

thanks.

edit: can have field corresponding "otherinnerproperty" integer field in bq table, i'd rather have otherinnerproperty.tostring() , string value in table...

i don't know if you've solved issue, had problem , solved follows:

when create service in:

var service = new bigqueryservice(new baseclientservice.initializer()              {                  httpclientinitializer = credential,                  applicationname = applicationname              });  

add serializer = new enumtostringnewtonsoftjsonserializer(), enumtostringnewtonsoftjsonserializer modification of google.apis.json.newtonsoftjsonserializer can found here: https://code.google.com/p/google-api-dotnet-client/source/browse/src/googleapis.core/apis/json/newtonsoftjsonserializer.cs?name=1.8.1

in constructor of enumtostringnewtonsoftjsonserializer put:

jsonserializersettings settings = new jsonserializersettings();  settings.nullvaluehandling = nullvaluehandling.ignore;  settings.converters.add(new rfc3339datetimeconverter());  settings.converters.add(new newtonsoft.json.converters.stringenumconverter()); newtonsoftserializer = jsonserializer.create(settings); 

this worked me.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -