Fauna csharp driver  4.2.0
Public Member Functions | Properties | List of all members
FaunaDB.Types.FaunaFieldAttribute Class Reference

Maps a property/field member constructor parameter to FaunaDB object property while encoding/deconding an object. If this attribute if not specified the property/field name constructor parameter name will be used instead. More...

Inheritance diagram for FaunaDB.Types.FaunaFieldAttribute:

Public Member Functions

 FaunaFieldAttribute (string name)
 

Properties

string Name [get]
 The name of the property when encoding/decoding objects. More...
 
object DefaultValue [get, set]
 The default value used for a missing property when decoding an object. More...
 

Detailed Description

Maps a property/field member constructor parameter to FaunaDB object property while encoding/deconding an object. If this attribute if not specified the property/field name constructor parameter name will be used instead.

class Car { [FaunaField("model")] public string Model { get; set; }

[FaunaField("manufacturer")] public string Manufacturer { get; set; } }

var car = new Car { Model = "DeLorean DMC-12", Manufacturer = "DeLorean Motor Company" };

var encoded = Encoder.Encode(car);

//encoded will be equivalent to:

ObjectV.With("model", "DeLorean DMC-12", "manufacturer", "DeLorean Motor Company")

class Product { private string description; private double price;

[FaunaConstructor] public Product([FaunaField("Description")] string description, [FaunaField("Price")] double price) { this.description = description; this.price = price; } }

Definition at line 41 of file Attributes.cs.

Constructor & Destructor Documentation

◆ FaunaFieldAttribute()

FaunaDB.Types.FaunaFieldAttribute.FaunaFieldAttribute ( string  name)

Definition at line 53 of file Attributes.cs.

Property Documentation

◆ DefaultValue

object FaunaDB.Types.FaunaFieldAttribute.DefaultValue
getset

The default value used for a missing property when decoding an object.

Definition at line 51 of file Attributes.cs.

◆ Name

string FaunaDB.Types.FaunaFieldAttribute.Name
get

The name of the property when encoding/decoding objects.

Definition at line 46 of file Attributes.cs.


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