Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite Scaffolding: Use column type and values to provide a better CLR type #30816

Merged
merged 1 commit into from
May 10, 2023

Conversation

bricelam
Copy link
Contributor

@bricelam bricelam commented May 2, 2023

"If it looks like a duck, quacks like a duck, it's a duck!" (Robin Cook)

Here's a table highlighting some of the improvements.

Column type Sample value Before After
BOOLEAN 0 byte[] bool
SMALLINT 0 long short
INT 0 long int
BIGINT 0 long long
TEXT '0.0' string decimal
TEXT '1970-01-01' string DateOnly
TEXT '1970-01-01 00:00:00' string DateTime
TEXT '00:00:00' string TimeSpan
TEXT '00000000-0000-0000-0000-000000000000' string Guid
STRING 'ABC' byte[] string

Resolves #8824

@bricelam bricelam requested a review from a team May 2, 2023 22:03
@bricelam bricelam changed the title SQLite Scaffolding: Use column values and type name to provide a better CLR type SQLite Scaffolding: Use column type and values to provide a better CLR type May 4, 2023
@bricelam bricelam force-pushed the duck branch 2 times, most recently from 794e31c to a392e70 Compare May 9, 2023 22:38
…R type

Here's a table highlighting some of the improvements.

Column type | Sample value                           | Before | After
----------- | -------------------------------------- | ------ | -----
BOOLEAN     | 0                                      | byte[] | bool
SMALLINT    | 0                                      | long   | short
INT         | 0                                      | long   | int
BIGINT      | 0                                      | long   | long
TEXT        | '0.0'                                  | string | decimal
TEXT        | '1970-01-01'                           | string | DateOnly
TEXT        | '1970-01-01 00:00:00'                  | string | DateTime
TEXT        | '00:00:00'                             | string | TimeSpan
TEXT        | '00000000-0000-0000-0000-000000000000' | string | Guid
STRING      | 'ABC'                                  | byte[] | string

Resolves dotnet#8824
@bricelam
Copy link
Contributor Author

Looks like this also dramatically improves views (where column types aren't available)

@bricelam
Copy link
Contributor Author

bricelam commented May 10, 2023

I manually tested this on the Northwind and Chinook sample databases, and the improvements are incredible. So many string-to-DateTime and byte-array-to-something-actually-useful changes.

@ErikEJ
Copy link
Contributor

ErikEJ commented May 10, 2023

Where are those sample SQLite Databases?

@bricelam bricelam merged commit 2d7c4a4 into dotnet:main May 10, 2023
@bricelam bricelam deleted the duck branch May 10, 2023 16:14
@bricelam
Copy link
Contributor Author

0xced added a commit to 0xced/EFCore.Scaffolding that referenced this pull request Sep 27, 2023
It has much better scaffolding capabilities for SQLite since dotnet/efcore#30816
0xced added a commit to 0xced/EFCore.Scaffolding that referenced this pull request Oct 13, 2023
It has much better scaffolding capabilities for SQLite since dotnet/efcore#30816
0xced added a commit to 0xced/EFCore.Scaffolding that referenced this pull request Nov 27, 2023
It has much better scaffolding capabilities for SQLite since dotnet/efcore#30816

TODO: Wait for Oracle, see oracle/dotnet-db-samples#328
0xced added a commit to 0xced/EFCore.Scaffolding that referenced this pull request Nov 27, 2023
It has much better scaffolding capabilities for SQLite since dotnet/efcore#30816

TODO: Wait for Oracle, see oracle/dotnet-db-samples#328
0xced added a commit to 0xced/EFCore.Scaffolding that referenced this pull request Jan 25, 2024
It has much better scaffolding capabilities for SQLite since dotnet/efcore#30816
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQLite RevEng: Sample data to determine CLR type
4 participants