-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate EF Core DbContext Fluent API code to configure POCO (#70)
- Loading branch information
Showing
39 changed files
with
415 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Data Type Declaration | ||
As you have seen, defining the _Data Type_ of an attribute is pretty straight forward. | ||
|
||
Simply use the following syntax: | ||
~~~ JSON | ||
"AttributeName": "[data type]([constraints])" | ||
~~~ | ||
|
||
where `[constraints]` is _optional_. | ||
|
||
An example: | ||
~~~ JSON | ||
"GivenName": "String" | ||
~~~ | ||
|
||
## Supported Data Types | ||
The following Data Types are supported: | ||
|
||
| Dash data type | .NET | SqlServer | | ||
|-----------------|----------|------------------| | ||
| `string` | String | varchar | | ||
| `unicode` | String | nvarchar | | ||
| `int` | Int | int | | ||
| `bool` | Bool | bit | | ||
| `datetime` | DateTime | datetime | | ||
| `guid` | Guid | uniqueidentifier | | ||
|
||
For your convenience, the target data type (.NET and SqlServer) is also included. | ||
|
||
## Constraints | ||
Dash supports _constraints_ that lets you express the limitations of your Attribute. | ||
|
||
### Optional/Nullable | ||
In Dash, all attributes are _required_ or _Non-Nullable_. | ||
|
||
Similar to C#, use `?` to specify that an attribute is _optional_ or _Nullable_. | ||
|
||
Example: | ||
~~~ JSON | ||
"Nickname": "String?" | ||
~~~ | ||
|
||
### Maximum Length | ||
To specify that an attribute has a maximum length, use `[length]`. | ||
|
||
Example: | ||
~~~ JSON | ||
"Nickname": "String[30]" | ||
~~~ | ||
|
||
### Default Value | ||
To specify that an attribute has a default value, use `(=='default')`. | ||
|
||
Example: | ||
~~~ JSON | ||
"Nickname": "String(=='Foo')" | ||
~~~ | ||
|
||
In the above example, we specified that the default value for `Nickname` is `Foo`. | ||
|
||
### Regular Expression | ||
To use a regular expression as a constraint, use `:[regex]` | ||
|
||
Example: | ||
~~~ JSON | ||
"Nickname": "String:[a-zA-Z0-9]{5}" | ||
~~~ | ||
|
||
### Mixing Constraints | ||
All constraints can be mixed. For instance, you can specify that an attribute is Nullable and has a Maximum Length of 30: | ||
|
||
~~~ JSON | ||
"Nickname": "String?[30]" | ||
~~~ | ||
|
||
You can put the constraints in any order, except for the Regular Expression constraint, which must always be placed as the final constraint. | ||
|
||
~~~ JSON | ||
"Nickname": "String(=='Foo')[30]?:[a-zA-Z0-9]" | ||
~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace Dash.Engine.DataTypes | ||
{ | ||
public class UnknownDataType : IDataType | ||
{ | ||
public UnknownDataType(string unknownDataType) | ||
{ | ||
Name = unknownDataType; | ||
} | ||
|
||
public string Name { get; } | ||
public bool IsNumeric => false; | ||
public bool IsDateTime => false; | ||
public bool IsBoolean => false; | ||
public bool IsUnicode => false; | ||
public bool IsString => false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.