Skip to content

Commit

Permalink
Re: #81, Removes IgnoreOnInsert and IgnoreOnUpdate from `Referenc…
Browse files Browse the repository at this point in the history
…eAttribute` as changing these properties to `false` does not currently provide the expected functionality.
  • Loading branch information
acupofjose committed Jan 3, 2024
1 parent a57246f commit 5563fee
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions Postgrest/Attributes/ReferenceAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,31 +82,26 @@ public enum JoinType
/// <summary>Establishes a reference between two tables</summary>
/// <param name="model">Model referenced</param>
/// <param name="includeInQuery">Should referenced be included in queries?</param>
/// <param name="ignoreOnInsert">Should reference data be excluded from inserts/upserts?</param>
/// <param name="ignoreOnUpdate">Should reference data be excluded from updates?</param>
/// <param name="joinType">Specifies the join type for this relationship</param>
/// <param name="columnName">Column this attribute references as specified in Postgres, DOES NOT need to be set if &lt;see cref="ForeignKey"/&gt; is set.</param>
/// <param name="foreignKey">Foreign Key this attribute references as specified in Postgres (only required if the model references the same table multiple times)</param>
/// <exception cref="Exception"></exception>
public ReferenceAttribute(Type model, JoinType joinType, bool includeInQuery = true, bool ignoreOnInsert = true,
bool ignoreOnUpdate = true, [CallerMemberName] string columnName = "", string? foreignKey = null)
: this(model, includeInQuery, ignoreOnInsert, ignoreOnUpdate, joinType == JoinType.Inner, columnName,
public ReferenceAttribute(Type model, JoinType joinType, bool includeInQuery = true,
[CallerMemberName] string columnName = "", string? foreignKey = null)
: this(model, includeInQuery, joinType == JoinType.Inner, columnName,
foreignKey)
{
}

/// <summary>Establishes a reference between two tables</summary>
/// <param name="model">Model referenced</param>
/// <param name="includeInQuery">Should referenced be included in queries?</param>
/// <param name="ignoreOnInsert">Should reference data be excluded from inserts/upserts?</param>
/// <param name="ignoreOnUpdate">Should reference data be excluded from updates?</param>
/// <param name="useInnerJoin">As to whether the query will filter top-level rows.</param>
/// <param name="propertyName">The Property Name on the C# Model</param>

Check warning on line 100 in Postgrest/Attributes/ReferenceAttribute.cs

View workflow job for this annotation

GitHub Actions / build-and-test

XML comment has a param tag for 'propertyName', but there is no parameter by that name

Check warning on line 100 in Postgrest/Attributes/ReferenceAttribute.cs

View workflow job for this annotation

GitHub Actions / build-and-test

XML comment has a param tag for 'propertyName', but there is no parameter by that name
/// <param name="columnName">Column this attribute references as specified in Postgres, DOES NOT need to be set if <see cref="ForeignKey"/> is set.</param>
/// <param name="foreignKey">Foreign Key this attribute references as specified in Postgres (only required if the model references the same table multiple times)</param>
/// <exception cref="Exception"></exception>
public ReferenceAttribute(Type model, bool includeInQuery = true, bool ignoreOnInsert = true,
bool ignoreOnUpdate = true, bool useInnerJoin = true,
public ReferenceAttribute(Type model, bool includeInQuery = true, bool useInnerJoin = true,
[CallerMemberName] string? columnName = null, string? foreignKey = null)
{
if (!IsDerivedFromBaseModel(model))
Expand All @@ -115,8 +110,8 @@ public ReferenceAttribute(Type model, bool includeInQuery = true, bool ignoreOnI

Model = model;
IncludeInQuery = includeInQuery;
IgnoreOnInsert = ignoreOnInsert;
IgnoreOnUpdate = ignoreOnUpdate;
IgnoreOnInsert = true;
IgnoreOnUpdate = true;
ColumnName = columnName;
UseInnerJoin = useInnerJoin;
ForeignKey = foreignKey;
Expand Down

0 comments on commit 5563fee

Please sign in to comment.