Thursday, December 13, 2018

Get raw query from Elasticsearch NEST client

https://stackoverflow.com/questions/28939022/get-raw-query-from-nest-client
var json = elasticClient.RequestResponseSerializer.SerializeToString(request);
Great for debugging and finding out what json you are sending.

Wednesday, December 12, 2018

DateTime and DateTimeOffset

Choosing between DateTime, DateTimeOffset, TimeSpan, and TimeZoneInfo

DateTime.ToLocalTime

Utc This instance of DateTime is converted to local time.
Local No conversion is performed.
Unspecified This instance of DateTime is assumed to be a UTC time, and the conversion is performed as if Kind were Utc.

DateTime.ToUniversalTime

Utc No conversion is performed.
Local The current DateTime object is converted to UTC.
Unspecified The current DateTime object is assumed to be a local time, and the conversion is performed as if Kind were Local.