Field
This class defines a field and is used extensively throughout the library and in application code.
Use-Cases
- Specifying fields to query in Query and BatchQuery operations.
- Specifying fields affected in push operations such as Insert, Merge, and Update.
- Defining qualifier fields in Merge, Update, and similar operations.
- Defining field arguments.
- Returned by extension methods such as
ClassProperty.AsField().
Creating an Instance
var field = new Field("Id");
Or with a type.
var field = new Field("Id", typeof(string));
Or via the static From() method.
var fields = Field.From("Id", "Name", "CreatedDateUtc");
Parse Entity
Extract fields from an entity type.
var fields = Field.Parse<Person>();
Or by type reference.
var fields = Field.Parse(typeof(Person));
Parse Expression
Extract fields from a lambda expression.
var fields = Field.Parse<Person>(e => e.Id);
Or from multiple properties.
var fields = Field.Parse<Person>(e => new { e.Id, e.Name, e.DateOfBirth });
Parse Object
Extract fields from a class or anonymous object.
var person = new Person();
var fields = Field.Parse(person);
This object can be used anywhere a field definition is required.