Aerospike.Database.LINQPadDriver.Extensions Namespace
Aerospike LINDPad Driver

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

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,
	Object primaryKey,
	string json,
	string jsonBinName,
	string ignorePKPropertyName,
	ANamespaceAccess setAccess
)

Parameters

nameSpace
Type: String
The associated namespace of the set
setName
Type: String
The associated Set of the record
primaryKey
Type: Object
The primary key which can be: a C# value, digest byte array, Key, APrimaryKey, AValue, Value
json
Type: String
A valid Json string
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.
ignorePKPropertyName
Type: String
Removes the primary key property, if present, so that it is not added to the record. If null, all properties are added to the record.
setAccess
Type: Aerospike.Database.LINQPadDriver.Extensions..::..ANamespaceAccess
The set instance that will be associated to this record.

Return Value

Returns ARecord instance.

Exceptions


ExceptionCondition
InvalidDataExceptionThrown if the Json is not valid

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.