Table of Contents

Class ReferenceAttribute

Namespace
Supabase.Postgrest.Attributes
Assembly
Supabase.Postgrest.dll

Used to specify that a foreign key relationship exists in PostgreSQL

See: https://postgrest.org/en/stable/api.html#resource-embedding

[AttributeUsage(AttributeTargets.Property)]
public class ReferenceAttribute : Attribute
Inheritance
ReferenceAttribute
Inherited Members

Constructors

ReferenceAttribute(Type, JoinType, bool, string, string?)

Establishes a reference between two tables

public ReferenceAttribute(Type model, ReferenceAttribute.JoinType joinType, bool includeInQuery = true, string columnName = "", string? foreignKey = null)

Parameters

model Type

Model referenced

joinType ReferenceAttribute.JoinType

Specifies the join type for this relationship

includeInQuery bool

Should referenced be included in queries?

columnName string

Column this attribute references as specified in Postgres, DOES NOT need to be set if <see cref="ForeignKey"/> is set.

foreignKey string

Foreign Key this attribute references as specified in Postgres (only required if the model references the same table multiple times)

Exceptions

Exception

ReferenceAttribute(Type, bool, bool, string?, string?)

Establishes a reference between two tables

public ReferenceAttribute(Type model, bool includeInQuery = true, bool useInnerJoin = true, string? columnName = null, string? foreignKey = null)

Parameters

model Type

Model referenced

includeInQuery bool

Should referenced be included in queries?

useInnerJoin bool

As to whether the query will filter top-level rows.

columnName string

Column this attribute references as specified in Postgres, DOES NOT need to be set if ForeignKey is set.

foreignKey string

Foreign Key this attribute references as specified in Postgres (only required if the model references the same table multiple times)

Exceptions

Exception

Properties

ColumnName

Column this attribute references as specified in Postgres, DOES NOT need to be set if ForeignKey is set.

public string? ColumnName { get; }

Property Value

string

Columns

Columns that exist on the model we will select from.

public List<string> Columns { get; }

Property Value

List<string>

ForeignKey

The explicit SQL defined foreign key that this references.

public string? ForeignKey { get; }

Property Value

string

IgnoreOnInsert

If the performed query is an Insert or Upsert, should this value be ignored? (DEFAULT TRUE)

public bool IgnoreOnInsert { get; }

Property Value

bool

IgnoreOnUpdate

If the performed query is an Update, should this value be ignored? (DEFAULT TRUE)

public bool IgnoreOnUpdate { get; }

Property Value

bool

IncludeInQuery

If Reference should automatically be included in queries on this reference. (DEFAULT TRUE)

public bool IncludeInQuery { get; }

Property Value

bool

Model

Type of the model referenced

public Type Model { get; }

Property Value

Type

TableName

Table name of model

public string TableName { get; }

Property Value

string

UseInnerJoin

As to whether the query will filter top-level rows.

See: https://postgrest.org/en/stable/api.html#resource-embedding

public bool UseInnerJoin { get; }

Property Value

bool

Methods

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool