Retrieve User Schema¶
An application can get a list of the properties associated with the user schema by using the following API:
Non-Blocking API¶
public void Backendless.UserService.DescribeUserClass( AsyncCallback<List<UserProperty>> callback );
where:
Argument | Description |
---|---|
callback |
an object which receives either a return value or an error from the server. The return value from the server is a collection of the UserProperty objects. |
Blocking API¶
public List<UserProperty> Backendless.UserService.DescribeUserClass();
The UserProperty
class defines the following properties:
// returns true if the property is marked as 'identity'
public bool IsIdentity { get; }
// returns the name of the property
public string Name { get; }
// returns true if the property is required during user registration
public bool IsRequired { get; }
// returns the data type of the property
public DateTypeEnum Type { get; }
// returns the default value which is assigned to the property
// when it is missing during the user registration operation
public object DefaultValue { get; }
// returns true if the property/column represents a relation
// and is marked as auto-load
public bool AutoLoad( get; }
// Returns the validator regular expression, if the
// property/column has a validator assigned to it.
public string CustomRegex { get; }
// Returns the name of the related table, if the
// property/column represents a relation
public string RelatedTable { get; }
Non-blocking Method Example¶
using BackendlessAPI;
using BackendlessAPI.Async;
using BackendlessAPI.Property;
AsyncCallback<List<UserProperty>> callback;
callback = new AsyncCallback<List<UserProperty>>(
props =>
{
foreach( UserProperty p in props )
{
System.Console.WriteLine( "prop name " + p.Name );
System.Console.WriteLine( "\tis identity " + p.IsIdentity );
System.Console.WriteLine( "\tis required " + p.IsRequired );
System.Console.WriteLine( "\tprop type " + p.Type );
System.Console.WriteLine( "\tdefault value " + p.DefaultValue );
}
},
fault =>
{
System.Console.WriteLine( fault.ToString() );
} );
Backendless.UserService.DescribeUserClass( callback );
Blocking Method Example¶
using BackendlessAPI;
using BackendlessAPI.Async;
using BackendlessAPI.Property;
List<UserProperty> properties = Backendless.UserService.DescribeUserClass();
foreach( UserProperty p in properties )
{
System.Console.WriteLine( "prop name " + p.Name );
System.Console.WriteLine( "\tis identity " + p.IsIdentity );
System.Console.WriteLine( "\tis required " + p.IsRequired );
System.Console.WriteLine( "\tprop type " + p.Type );
System.Console.WriteLine( "\tdefault value " + p.DefaultValue );
}