fixer-m / snowflake-db-net-client

Snowflake .NET Client
Apache License 2.0
51 stars 14 forks source link

Mapping $id or $ref into properties. #44

Open brandorf opened 1 year ago

brandorf commented 1 year ago

I've got some inner objects that are using $id as property names that need to be mapped to an object. Normally I would modify the json serializer settings to ignore references, but this seems to not be exposed to us when using the Snowflake client?

Short version, given an object like so: "emid": { "$id": "63484e6eab783af4c4072539" }

With a poco:

public class Emid { [JsonProperty("$id")] public string id { get; set; } }

In the final deserialized object coming back from QueryAsync, that ID will alway be null, is there a setting I'm overlooking?

fixer-m commented 1 year ago

Hello! You can override json serializer options - you can pass them in SnowflakeClient constructor or you can set it directly with this method: SnowflakeDataMapper.SetJsonMapperOptions(jsonSerializerOptions).