Aerospike.Database.LINQPadDriver.Extensions Namespace
Aerospike LINDPad Driver

ARecord..::..FromJson Method (String, String, String, String, String, ANamespaceAccess, Boolean, Boolean)

Given a Json string, creates a ARecord object that can but used to update the DB.

Namespace:  Aerospike.Database.LINQPadDriver.Extensions
Assembly:  Aerospike.Database.LINQPadDriver (in Aerospike.Database.LINQPadDriver.dll)

Syntax


public static ARecord FromJson(
	string nameSpace,
	string setName,
	string json,
	string pkPropertyName,
	string jsonBinName,
	ANamespaceAccess setAccess,
	bool writePKPropertyName,
	bool treatEmptyStrAsNull
)

Parameters

nameSpace
Type: String
The associated namespace of the set
setName
Type: String
The associated Set of the record
json
Type: String
pkPropertyName
Type: String
The property name used to obtain the primary key. This must be a top level field (cannot be nested). The default is '_id'. If the pkPropertyName doesn's exists, a KeyNotFoundException is thrown.
jsonBinName
Type: String
If provided, the Json object is placed into this bin. If null (default), the each top level Json property will be associated with a bin. Note, if the property name is greater than the bin name limit, an Aerospike exception will occur during the put.
setAccess
Type: Aerospike.Database.LINQPadDriver.Extensions..::..ANamespaceAccess
The set instance that will be associated to this record.
writePKPropertyName
Type: Boolean
If true, the pkPropertyName, is written to the record. If false (default), it will not be part of the record (only used to define the PK).
treatEmptyStrAsNull
Type: Boolean
If true, default, these properties with an empty string value will be considered null (bin not saved). If false, these properties with an empty string value will have a bin value of empty string.

Return Value

Returns ARecord instance.

Exceptions


ExceptionCondition
KeyNotFoundException Thrown if the pkPropertyName is not found as a top-level field.

Remarks


The Json string can include Json in-line types. Below are the supported types:
C#
$date
or
C#
$datetime
, This can include an optional sub Json Type.Example:
C#
"bucket_start_date": "$date": { "$numberLong": "1545886800000"}}
C#
$datetimeoffset
, This can include an optional sub Json Type. Example:
C#
"bucket_start_datetimeoffset": "$datetimeoffset": { "$numberLong": "1545886800000"}}
C#
$timespan
, This can include an optional sub Json Type. Example:
C#
"bucket_start_time": "$timespan": { "$numberLong": "1545886800000"}}
C#
$timestamp
,
C#
$guid
or
C#
$uuid
, "$oid", If the Json string value equals 40 in length it will be treated as a digest and converted into a byte array. Example: " _id": { "$oid":"0080a245fabe57999707dc41ced60edc4ac7ac40" } ==> "_id":[00 80 A2 45 FA BE 57 99 97 07 DC 41 CE D6 0E DC 4A C7 AC 40] This type can also take an optional keyword as a value. They are:
C#
$guid
or
C#
$uuid
-- If provided, a new guid/uuid is generate as a unique value used
C#
$numeric
-- a sequential number starting at 1 will be used Example: " _id": { "$oid": "$uuid" } ==> Generates a new uuid as the _id value
C#
$numberint64
,
C#
$numberlong
or
C#
$long
,
C#
$numberint32
,
C#
$numberint
, or
C#
$int
,
C#
$numberdecimal
or
C#
$decimal
,
C#
$numberdouble
or
C#
$double
,
C#
$numberfloat
,
C#
$single
, or
C#
$float
,
C#
$numberint16
,
C#
$numbershort
or
C#
$short
,
C#
$numberuint32
,
C#
$numberuint
, or
C#
$uint
,
C#
$numberuint64
,
C#
$numberulong
, or
C#
$ulong
,
C#
$numberuint16
,
C#
$numberushort
or
C#
$ushort
,
C#
$bool
or
C#
$boolean
;
C#
$type
This item must be the first property in a JObject where the property's value is a .NET type. All reminding elements will be transformed into that .NET object.