6e8ec02ac0b1a1c2b2ea2362b4ce83f9c79a6825
FAQ/Izenda-API-Tip-Constraints-Joins-Best-Practices.md
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +#Izenda API Tip: Constraints & Joins Best Practices |
|
| 2 | + |
|
| 3 | +- All constraints are unidirectional (or anisotropic). |
|
| 4 | + |
|
| 5 | +- Do not use simple table name without brackets, e.g. ***"Cases-Status"*** instead of ***"[Cases-Status]"***. |
|
| 6 | + |
|
| 7 | +- Please make sure that you have two constraints for the target table relationship. e.g.: |
|
| 8 | +```csharp |
|
| 9 | +AdHocContext.Driver. |
|
| 10 | + AddConstraint("[dbo].[Cases-Status].[CaseID]","[dbo].[Cases-Payments].[CaseID]"); |
|
| 11 | +AdHocContext.Driver. |
|
| 12 | + AddConstraint("[dbo].[Cases-Payments].[CaseID]","[dbo].[Cases-Status].[CaseID]"); |
|
| 13 | +``` |
|
| 14 | + |
|
| 15 | +- LEFT JOIN syntax is also dependent on the 'direction' of the join. A->B produces different results than B->A. If you specify only one LEFT JOIN for Cases-Status and Cases-Payments tables then it will be used only in case when Cases-Payments table is joined to the Cases-Status table in that specific direction. |
|
| 16 | + |
|
| 17 | + If you want it to work in **both directions** you should specify two joins: |
|
| 18 | +```csharp |
|
| 19 | + AdHocContext.Driver.AddForcedLeftJoin("Cases-Status","Cases-Payments"); |
|
| 20 | + AdHocContext.Driver.AddForcedLeftJoin("Cases-Payments","Cases-Status"); |
|
| 21 | +``` |
Izenda-API-Tip-Constraints-Joins-Best-Practices.md
| ... | ... | @@ -1,21 +0,0 @@ |
| 1 | -#Izenda API Tip: Constraints & Joins Best Practices |
|
| 2 | - |
|
| 3 | -- All constraints are unidirectional (or anisotropic). |
|
| 4 | - |
|
| 5 | -- Do not use simple table name without brackets, e.g. ***"Cases-Status"*** instead of ***"[Cases-Status]"***. |
|
| 6 | - |
|
| 7 | -- Please make sure that you have two constraints for the target table relationship. e.g.: |
|
| 8 | -```csharp |
|
| 9 | -AdHocContext.Driver. |
|
| 10 | - AddConstraint("[dbo].[Cases-Status].[CaseID]","[dbo].[Cases-Payments].[CaseID]"); |
|
| 11 | -AdHocContext.Driver. |
|
| 12 | - AddConstraint("[dbo].[Cases-Payments].[CaseID]","[dbo].[Cases-Status].[CaseID]"); |
|
| 13 | -``` |
|
| 14 | - |
|
| 15 | -- LEFT JOIN syntax is also dependent on the 'direction' of the join. A->B produces different results than B->A. If you specify only one LEFT JOIN for Cases-Status and Cases-Payments tables then it will be used only in case when Cases-Payments table is joined to the Cases-Status table in that specific direction. |
|
| 16 | - |
|
| 17 | - If you want it to work in **both directions** you should specify two joins: |
|
| 18 | -```csharp |
|
| 19 | - AdHocContext.Driver.AddForcedLeftJoin("Cases-Status","Cases-Payments"); |
|
| 20 | - AdHocContext.Driver.AddForcedLeftJoin("Cases-Payments","Cases-Status"); |
|
| 21 | -``` |