Skip to content

Commit 5563fee

Browse files
committed
Re: #81, Removes IgnoreOnInsert and IgnoreOnUpdate from ReferenceAttribute as changing these properties to false does not currently provide the expected functionality.
1 parent a57246f commit 5563fee

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

Diff for: Postgrest/Attributes/ReferenceAttribute.cs

+6-11
Original file line numberDiff line numberDiff line change
@@ -82,31 +82,26 @@ public enum JoinType
8282
/// <summary>Establishes a reference between two tables</summary>
8383
/// <param name="model">Model referenced</param>
8484
/// <param name="includeInQuery">Should referenced be included in queries?</param>
85-
/// <param name="ignoreOnInsert">Should reference data be excluded from inserts/upserts?</param>
86-
/// <param name="ignoreOnUpdate">Should reference data be excluded from updates?</param>
8785
/// <param name="joinType">Specifies the join type for this relationship</param>
8886
/// <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>
8987
/// <param name="foreignKey">Foreign Key this attribute references as specified in Postgres (only required if the model references the same table multiple times)</param>
9088
/// <exception cref="Exception"></exception>
91-
public ReferenceAttribute(Type model, JoinType joinType, bool includeInQuery = true, bool ignoreOnInsert = true,
92-
bool ignoreOnUpdate = true, [CallerMemberName] string columnName = "", string? foreignKey = null)
93-
: this(model, includeInQuery, ignoreOnInsert, ignoreOnUpdate, joinType == JoinType.Inner, columnName,
89+
public ReferenceAttribute(Type model, JoinType joinType, bool includeInQuery = true,
90+
[CallerMemberName] string columnName = "", string? foreignKey = null)
91+
: this(model, includeInQuery, joinType == JoinType.Inner, columnName,
9492
foreignKey)
9593
{
9694
}
9795

9896
/// <summary>Establishes a reference between two tables</summary>
9997
/// <param name="model">Model referenced</param>
10098
/// <param name="includeInQuery">Should referenced be included in queries?</param>
101-
/// <param name="ignoreOnInsert">Should reference data be excluded from inserts/upserts?</param>
102-
/// <param name="ignoreOnUpdate">Should reference data be excluded from updates?</param>
10399
/// <param name="useInnerJoin">As to whether the query will filter top-level rows.</param>
104100
/// <param name="propertyName">The Property Name on the C# Model</param>
105101
/// <param name="columnName">Column this attribute references as specified in Postgres, DOES NOT need to be set if <see cref="ForeignKey"/> is set.</param>
106102
/// <param name="foreignKey">Foreign Key this attribute references as specified in Postgres (only required if the model references the same table multiple times)</param>
107103
/// <exception cref="Exception"></exception>
108-
public ReferenceAttribute(Type model, bool includeInQuery = true, bool ignoreOnInsert = true,
109-
bool ignoreOnUpdate = true, bool useInnerJoin = true,
104+
public ReferenceAttribute(Type model, bool includeInQuery = true, bool useInnerJoin = true,
110105
[CallerMemberName] string? columnName = null, string? foreignKey = null)
111106
{
112107
if (!IsDerivedFromBaseModel(model))
@@ -115,8 +110,8 @@ public ReferenceAttribute(Type model, bool includeInQuery = true, bool ignoreOnI
115110

116111
Model = model;
117112
IncludeInQuery = includeInQuery;
118-
IgnoreOnInsert = ignoreOnInsert;
119-
IgnoreOnUpdate = ignoreOnUpdate;
113+
IgnoreOnInsert = true;
114+
IgnoreOnUpdate = true;
120115
ColumnName = columnName;
121116
UseInnerJoin = useInnerJoin;
122117
ForeignKey = foreignKey;

0 commit comments

Comments
 (0)