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
TypeModel referenced
joinType
ReferenceAttribute.JoinTypeSpecifies the join type for this relationship
includeInQuery
boolShould referenced be included in queries?
columnName
stringColumn this attribute references as specified in Postgres, DOES NOT need to be set if <see cref="ForeignKey"/> is set.
foreignKey
stringForeign Key this attribute references as specified in Postgres (only required if the model references the same table multiple times)
Exceptions
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
TypeModel referenced
includeInQuery
boolShould referenced be included in queries?
useInnerJoin
boolAs to whether the query will filter top-level rows.
columnName
stringColumn this attribute references as specified in Postgres, DOES NOT need to be set if ForeignKey is set.
foreignKey
stringForeign Key this attribute references as specified in Postgres (only required if the model references the same table multiple times)
Exceptions
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
Columns
Columns that exist on the model we will select from.
public List<string> Columns { get; }
Property Value
ForeignKey
The explicit SQL defined foreign key that this references.
public string? ForeignKey { get; }
Property Value
IgnoreOnInsert
If the performed query is an Insert or Upsert, should this value be ignored? (DEFAULT TRUE)
public bool IgnoreOnInsert { get; }
Property Value
IgnoreOnUpdate
If the performed query is an Update, should this value be ignored? (DEFAULT TRUE)
public bool IgnoreOnUpdate { get; }
Property Value
IncludeInQuery
If Reference should automatically be included in queries on this reference. (DEFAULT TRUE)
public bool IncludeInQuery { get; }
Property Value
Model
Type of the model referenced
public Type Model { get; }
Property Value
TableName
Table name of model
public string TableName { get; }
Property Value
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
Methods
Equals(object?)
public override bool Equals(object? obj)
Parameters
obj
object