You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Primary Keys and Identity Columns](#primary-keys-and-identity-columns)
58
+
-[Primary Key Special Cases](#primary-key-special-cases)
59
+
-[Identity Columns](#identity-columns)
60
+
-[Columns with Default Values](#columns-with-default-values)
59
61
-[Trigger Binding](#trigger-binding)
60
62
-[Change Tracking](#change-tracking)
61
63
-[Internal State Tables](#internal-state-tables)
@@ -829,20 +831,26 @@ public static IActionResult Run(
829
831
}
830
832
```
831
833
832
-
#### Primary Keys and Identity Columns
834
+
#### Primary Key Special Cases
833
835
834
836
Normally Output Bindings require two things :
835
837
836
838
1. The table being upserted to contains a Primary Key constraint (composed of one or more columns)
837
839
2. Each of those columns must be present in the POCO object used in the attribute
838
840
839
-
If either of these are falsethen an error will be thrown.
841
+
Normally ifeither of these are falsethen an error will be thrown. Below are the situations in which this is not the case:
840
842
841
-
This changes if one of the primary key columns is an identity column though. In that case there are two options based on how the functiondefines the output object:
843
+
##### Identity Columns
844
+
In the case where one of the primary key columns is an identity column, there are two options based on how the functiondefines the output object:
842
845
843
846
1. If the identity column isn't included in the output object then a straight insert is always performed with the other column values. See [AddProductWithIdentityColumn](./samples/samples-csharp/OutputBindingSamples/AddProductWithIdentityColumn.cs) for an example.
844
847
2. If the identity column is included (even if it's an optional nullable value) then a merge is performed similar to what happens when no identity column is present. This merge will either insert a new row or update an existing row based on the existence of a row that matches the primary keys (including the identity column). See [AddProductWithIdentityColumnIncluded](./samples/samples-csharp/OutputBindingSamples/AddProductWithIdentityColumnIncluded.cs) for an example.
845
848
849
+
##### Columns with Default Values
850
+
In the case where one of the primary key columns has a default value, there are also two options based on how the functiondefines the output object:
851
+
1. If the column with a default value is not included in the output object, then a straight insert is always performed with the other values. See [AddProductWithDefaultPK](./samples/samples-csharp/OutputBindingSamples/AddProductWithDefaultPK.cs) for an example.
852
+
2. If the column with a default value is included then a merge is performed similar to what happens when no default column is present. If there is a nullable column with a default value, then the provided column value in the output object will be upserted even if it is null.
853
+
846
854
### Trigger Binding
847
855
848
856
>**NOTE:** Trigger binding support is only available for C# functions at present.
0 commit comments