Class DbDoc
Represents a generic document in JSON format.
Namespace: MySqlX.XDevAPI
Assembly: MySql.Data.dll
Version: 9.0.0
Syntax
public class DbDoc
Constructors
DbDoc(Object)
Initializes a new instance of the DbDoc class based on the object provided. The value can be a domain object, anonymous object, or JSON string.
Declaration
public DbDoc(object val = null)
Parameters
Type | Name | Description |
---|---|---|
Object | val | The value for this DbDoc. |
Properties
HasId
Gets a value indicating if this document has an identifier (property named _id with a value).
Declaration
public bool HasId { get; }
Property Value
Type | Description |
---|---|
Boolean |
Id
Gets the identifier of the document.
Declaration
public object Id { get; }
Property Value
Type | Description |
---|---|
Object |
Item[String]
Gets the value of a document property.
Declaration
public object this[string path] { get; }
Parameters
Type | Name | Description |
---|---|---|
String | path | The key path for the property. |
Property Value
Type | Description |
---|---|
Object |
Methods
Equals(Object)
Compares this DbDoc with another one.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The DbDoc to compare to. |
Returns
Type | Description |
---|---|
Boolean | True if they are equal, false otherwise. |
Overrides
GetHashCode()
Gets a value that serves as a hash function for a particular type.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code for the current object. |
Overrides
SetValue(String, Object)
Sets a property on this document.
Declaration
public void SetValue(string key, object val)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key of the property. |
Object | val | The new property value. |
ToString()
Returns this document in Json format.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | A Json formatted string. |