Link Search Menu Expand Document

Field


This is the class that is being used to define a field in many ways. This class is widely use within the library or even hugely use during the actual development.

Use-Cases

  • It is used to define a field to be queried during the Query and BatchQuery operations.
  • It is used to define a field to be affected during push operations like the Insert, Merge and Update operations.
  • It is used to define a qualifier field on the Merge, Update and etc.
  • It is used to define an argument that defines a field information.
  • It is used as an output in many of the extension methods within the library. A method of like ClassProperty.AsField() as an example.

Creating an Instance

var field = new Field("Id");

Or by passing a type.

var field = new Field("Id", typeof(string));

Or via a static method named From().

var fields = Field.From("Id", "Name", "CreatedDateUtc");

Parse Entity

You can also extract an array of field by extracting an entity.

var fields = Field.Parse<Person>();

Or by type.

var fields = Field.Parse(typeof(Person));

Parse Expression

You can also extract by parsing an expression.

var fields = Field.Parse<Person>(e => e.Id);

Or by parsing the multiple properties.

var fields = Field.Parse<Person>(e => new { e.Id, e.Name, e.DateOfBirth });

Parse Object

You can also extract by parsing a class or an anonymous object.

var person = new Person();
var fields = Field.Parse(person);

You can use this object anytime anywhere as long the context of the usage defines the field.