LeanCloud C# SDK
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Properties | List of all members
LeanCloud.Storage.LCObject Class Reference

The LCObject is a local representation of data that can be saved and retrieved from the LeanCloud. More...

Inheritance diagram for LeanCloud.Storage.LCObject:
LeanCloud.Storage.LCFile LeanCloud.Storage.LCFriendshipRequest LeanCloud.Storage.LCInstallation LeanCloud.Storage.LCRole LeanCloud.Storage.LCStatus LeanCloud.Storage.LCUser

Public Member Functions

void DisableBeforeHook ()
 Disable hooks before saving / updating / deleting LCObject.
 
void DisableAfterHook ()
 Disable hooks after saving / updating / deleting LCObject.
 
void IgnoreHook (string hookName)
 Ignores the hook for this LCObject.
 
ReadOnlyCollection< string > GetUpdatedKeys ()
 Gets the updated keys of this LCObject.
 
 LCObject (string className)
 Constructs a new LCObject with no data in it. A LCObject constructed in this way will not have an ObjectedId and will not persist in the cloud until Save(bool, LCQuery<LCObject>)) is called.
 
void Unset (string key)
 Removes the key.
 
void AddRelation (string key, LCObject value)
 Creates a LCRelation<T> value for a key.
 
void RemoveRelation (string key, LCObject value)
 Removes a LCRelation<T> value for a key.
 
void Increment (string key, object value)
 Atomically increments the value of the given key with amount.
 
void Add (string key, object value)
 Atomically adds value to the end of the array key.
 
void AddAll (string key, IEnumerable values)
 Atomically adds values to the end of the array key.
 
void AddUnique (string key, object value)
 Atomically adds value to the array key, only if not already present.
 
void AddAllUnique (string key, IEnumerable values)
 Atomically adds values to the array key, only if not already present.
 
void Remove (string key, object value)
 Atomically removes all value from the array key.
 
void RemoveAll (string key, IEnumerable values)
 Atomically removes all values from the array key.
 
async Task< LCObjectSave (bool fetchWhenSave=false, LCQuery< LCObject > query=null)
 Saves this object to the cloud.
 
async Task Delete ()
 Deletes this object in the cloud.
 
async Task< LCObjectFetch (IEnumerable< string > keys=null, IEnumerable< string > includes=null)
 Fetches this object from the cloud.
 
override string ToString ()
 Serializes this LCObject to a JSON string.
 
void Merge (LCObjectData objectData)
 

Static Public Member Functions

static LCObject CreateWithoutData (string className, string objectId)
 Creates a reference to an existing LCObject.
 
static LCObject Create (string className)
 Creates a new LCObject.
 
static async Task< List< LCObject > > SaveAll (IEnumerable< LCObject > objects)
 Saves each object in the provided list.
 
static async Task DeleteAll (IEnumerable< LCObject > objects)
 Deletes each object in the provided list.
 
static async Task< IEnumerable< LCObject > > FetchAll (IEnumerable< LCObject > objects)
 Fetches all of the objects in the provided list.
 
static void RegisterSubclass< T > (string className, Func< T > constructor, string endpoint=null)
 Registers a custom subclass type with LeanCloud SDK, enabling strong-typing of those LCObjects whenever they appear.
 
static LCObject ParseObject (string json)
 Deserializes a JSON string to a LCObject.
 
static string GetClassEndpoint (string className)
 

Properties

string ClassName [get]
 Gets the class name for the LCObject.
 
string ObjectId [get]
 Gets the object id. An object id is assigned as soon as an object is saved to the server. The combination of a ClassName and an ObjectId uniquely identifies an object in your application.
 
DateTime CreatedAt [get]
 Gets the creation time of this object in the cloud.
 
DateTime UpdatedAt [get]
 Gets the latest update time of this object in the cloud.
 
LCACL ACL [get, set]
 Gets or sets the LCACL governing this object.
 
bool IsDirty [get, set]
 
object this[string key] [get, set]
 Gets or sets a value on the object. It is forbidden to name keys with a leading underscore ('_').
 

Detailed Description

The LCObject is a local representation of data that can be saved and retrieved from the LeanCloud.

Constructor & Destructor Documentation

◆ LCObject()

LeanCloud.Storage.LCObject.LCObject ( string  className)
inline

Constructs a new LCObject with no data in it. A LCObject constructed in this way will not have an ObjectedId and will not persist in the cloud until Save(bool, LCQuery<LCObject>)) is called.

Parameters
classNameThe className for the LCObject.

Member Function Documentation

◆ Add()

void LeanCloud.Storage.LCObject.Add ( string  key,
object  value 
)
inline

Atomically adds value to the end of the array key.

Parameters
key
value

◆ AddAll()

void LeanCloud.Storage.LCObject.AddAll ( string  key,
IEnumerable  values 
)
inline

Atomically adds values to the end of the array key.

Parameters
key
values

◆ AddAllUnique()

void LeanCloud.Storage.LCObject.AddAllUnique ( string  key,
IEnumerable  values 
)
inline

Atomically adds values to the array key, only if not already present.

Parameters
key
values

◆ AddRelation()

void LeanCloud.Storage.LCObject.AddRelation ( string  key,
LCObject  value 
)
inline

Creates a LCRelation<T> value for a key.

Parameters
key
value

◆ AddUnique()

void LeanCloud.Storage.LCObject.AddUnique ( string  key,
object  value 
)
inline

Atomically adds value to the array key, only if not already present.

Parameters
key
value

◆ Create()

static LCObject LeanCloud.Storage.LCObject.Create ( string  className)
inlinestatic

Creates a new LCObject.

Parameters
classNameThe className for the LCObject.
Returns

◆ CreateWithoutData()

static LCObject LeanCloud.Storage.LCObject.CreateWithoutData ( string  className,
string  objectId 
)
inlinestatic

Creates a reference to an existing LCObject.

Parameters
classNameThe className for the LCObject.
objectIdThe object id for the LCObject.
Returns

◆ Delete()

async Task LeanCloud.Storage.LCObject.Delete ( )
inline

Deletes this object in the cloud.

Returns

◆ DeleteAll()

static async Task LeanCloud.Storage.LCObject.DeleteAll ( IEnumerable< LCObject objects)
inlinestatic

Deletes each object in the provided list.

Parameters
objects
Returns

◆ DisableAfterHook()

void LeanCloud.Storage.LCObject.DisableAfterHook ( )
inline

Disable hooks after saving / updating / deleting LCObject.

◆ DisableBeforeHook()

void LeanCloud.Storage.LCObject.DisableBeforeHook ( )
inline

Disable hooks before saving / updating / deleting LCObject.

◆ Fetch()

async Task< LCObject > LeanCloud.Storage.LCObject.Fetch ( IEnumerable< string >  keys = null,
IEnumerable< string >  includes = null 
)
inline

Fetches this object from the cloud.

Parameters
keysThe keys for fetching.
includesThe include keys for fetching.
Returns

◆ FetchAll()

static async Task< IEnumerable< LCObject > > LeanCloud.Storage.LCObject.FetchAll ( IEnumerable< LCObject objects)
inlinestatic

Fetches all of the objects in the provided list.

Parameters
objectsThe objects for fetching.
Returns

◆ GetClassEndpoint()

static string LeanCloud.Storage.LCObject.GetClassEndpoint ( string  className)
inlinestatic

◆ GetUpdatedKeys()

ReadOnlyCollection< string > LeanCloud.Storage.LCObject.GetUpdatedKeys ( )
inline

Gets the updated keys of this LCObject.

Returns

◆ IgnoreHook()

void LeanCloud.Storage.LCObject.IgnoreHook ( string  hookName)
inline

Ignores the hook for this LCObject.

Parameters
hookName

◆ Increment()

void LeanCloud.Storage.LCObject.Increment ( string  key,
object  value 
)
inline

Atomically increments the value of the given key with amount.

Parameters
key
value

◆ Merge()

void LeanCloud.Storage.LCObject.Merge ( LCObjectData  objectData)
inline

◆ ParseObject()

static LCObject LeanCloud.Storage.LCObject.ParseObject ( string  json)
inlinestatic

Deserializes a JSON string to a LCObject.

Parameters
json
Returns

◆ RegisterSubclass< T >()

static void LeanCloud.Storage.LCObject.RegisterSubclass< T > ( string  className,
Func< T >  constructor,
string  endpoint = null 
)
inlinestatic

Registers a custom subclass type with LeanCloud SDK, enabling strong-typing of those LCObjects whenever they appear.

Template Parameters
TThe LCObject subclass type to register.
Parameters
classNameThe className on server.
constructorThe constructor for creating an object.
Type Constraints
T :LCObject 

◆ Remove()

void LeanCloud.Storage.LCObject.Remove ( string  key,
object  value 
)
inline

Atomically removes all value from the array key.

Parameters
key
value

◆ RemoveAll()

void LeanCloud.Storage.LCObject.RemoveAll ( string  key,
IEnumerable  values 
)
inline

Atomically removes all values from the array key.

Parameters
key
values

◆ RemoveRelation()

void LeanCloud.Storage.LCObject.RemoveRelation ( string  key,
LCObject  value 
)
inline

Removes a LCRelation<T> value for a key.

Parameters
key
value

◆ Save()

async Task< LCObject > LeanCloud.Storage.LCObject.Save ( bool  fetchWhenSave = false,
LCQuery< LCObject query = null 
)
inline

Saves this object to the cloud.

Parameters
fetchWhenSaveWhether or not fetch data when saved.
queryThe condition for saving.
Returns

◆ SaveAll()

static async Task< List< LCObject > > LeanCloud.Storage.LCObject.SaveAll ( IEnumerable< LCObject objects)
inlinestatic

Saves each object in the provided list.

Parameters
objectsThe objects to save.
Returns

◆ ToString()

override string LeanCloud.Storage.LCObject.ToString ( )
inline

Serializes this LCObject to a JSON string.

Returns

◆ Unset()

void LeanCloud.Storage.LCObject.Unset ( string  key)
inline

Removes the key.

Parameters
key

Property Documentation

◆ ACL

LCACL LeanCloud.Storage.LCObject.ACL
getset

Gets or sets the LCACL governing this object.

◆ ClassName

string LeanCloud.Storage.LCObject.ClassName
get

Gets the class name for the LCObject.

◆ CreatedAt

DateTime LeanCloud.Storage.LCObject.CreatedAt
get

Gets the creation time of this object in the cloud.

◆ IsDirty

bool LeanCloud.Storage.LCObject.IsDirty
getsetprotected

◆ ObjectId

string LeanCloud.Storage.LCObject.ObjectId
get

Gets the object id. An object id is assigned as soon as an object is saved to the server. The combination of a ClassName and an ObjectId uniquely identifies an object in your application.

◆ this[string key]

object LeanCloud.Storage.LCObject.this[string key]
getset

Gets or sets a value on the object. It is forbidden to name keys with a leading underscore ('_').

Parameters
keyThe name of a key.
Returns

◆ UpdatedAt

DateTime LeanCloud.Storage.LCObject.UpdatedAt
get

Gets the latest update time of this object in the cloud.


The documentation for this class was generated from the following files: