Skip to content

Commit

Permalink
Minor documentation-related changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwaliszko committed May 15, 2014
1 parent cbd32db commit d20ca9a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public string ReasonForTravel { get; set; }

How such an expression should be understood?

```GoAbroad == true && !(NextCountry == "Other") && NextCountry == [value from Country]```
```GoAbroad == true && !(NextCountry == "Other") && NextCountry == value_from_country```

Besides parsing interpretation of the conditional expression, this sample shows as well that instead of hardcoding there is also possibility for dynamic extraction of target values from other fields, by providing their names inside square parentheses `[]`.
Besides parsing interpretation of the conditional expression, this sample shows as well that instead of hardcoding there is also possibility for dynamic extraction of target values from other fields, by providing their names inside square brackets `[]`.

Finally, if we are slightly familiar with this syntax above, let's move to even more enriched use case of the same attribute *(valid from version >= 1.2)*:
Finally, if we are slightly familiar with this syntax above, let's move to even more enriched use case of the same attribute *(available in version >= 1.2)*:

```
[RequiredIfExpression(
Expand All @@ -60,7 +60,7 @@ public string ReasonForTravel { get; set; }

```
GoAbroad == true
&& ( (NextCountry != "Other" && NextCountry == [value from Country])
&& ( (NextCountry != "Other" && NextCountry == value_from_country)
|| Age ∈ (24, 55>
)
```
Expand Down Expand Up @@ -111,11 +111,13 @@ Logical expression is an expression in which relationship between operands is sp
#####Logical expression schematic interpretation:

```
== (default), !=, >, >=, <, <= ||, && !
/---------\ /-----------\ /------------\
(DepProps[0] RelOpers[0] TarVals[0]) BinaryLogOper (UnaryLogOper)(DepProps[1] RelOpers[1] TarVals[1])
\----------------------------------/ \----------------------------------/
{operand 0} (relational expr) {operand 1} (relational expr)
== (by default), !=, >, >=, <, <= binary logical operators
/---------\ /----\
(!)(DependProps[0] RelOpers[0] TargetVals[0]) ||, && (!)(DependProps[1] RelOpers[1] TargetVals[1])
| \----------------------------------------/ | \----------------------------------------/
| {operand 0} (relational expr) | {operand 1} (relational expr)
| |
------------------------------------------------------ > unary logical operators (optional)
```
Notice: Forgive the usage of abbreviated names (due to narrow space).

Expand Down
2 changes: 1 addition & 1 deletion src/ExpressiveAnnotations.MvcWebSample/Models/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public IEnumerable<int?> Years
public string NextCountry { get; set; }

[RequiredIfExpression( /* interpretation => GoAbroad == true
* && ( (NextCountry != "Other" && NextCountry == [value from Country])
* && ( (NextCountry != "Other" && NextCountry == value_from_country)
* || Age ∈ (24, 55>
* )
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<li>
<pre class="code">
[RequiredIfExpression( /* interpretation => GoAbroad == true
* && ( (NextCountry != "Other" && NextCountry == [value from Country])
* && ( (NextCountry != "Other" && NextCountry == value_from_country))
* || Age ∈ (24, 55>
* )
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ private class Model
public string Country { get; set; }
public string NextCountry { get; set; }

[RequiredIfExpression( /* interpretation => GoAbroad == true && NextCountry != "Other" && NextCountry == [value from Country] */
[RequiredIfExpression(
Expression = "{0} && !{1} && {2}",
DependentProperties = new[] {"GoAbroad", "NextCountry", "NextCountry"},
TargetValues = new object[] {true, "Other", "[Country]"})]
public string ReasonForTravel { get; set; }

public Stability? PoliticalStability { get; set; }

[RequiredIfExpression( /* interpretation => PoliticalStability != Stability.High */
[RequiredIfExpression(
Expression = "!{0}",
DependentProperties = new[] {"PoliticalStability"},
TargetValues = new object[] {Stability.High})]
Expand Down

0 comments on commit d20ca9a

Please sign in to comment.