NodaTime DateInterval Array and List (or any NodaTime type) are not mapped to datemultirange
See original GitHub issueFor NodaTime, it appears that both NodaTime.DateInterval[]
and List<NodaTime.DateInterval>
do not map to a datemultirange
.
Example from a migration script for properties:
local_date_should_be_of_type_date = table.Column<LocalDate>(type: "date", nullable: false),
npgsql_range_local_date_should_be_of_type_date_range = table.Column<NpgsqlRange<LocalDate>>(type: "daterange", nullable: false),
npgsql_range_local_date_array_should_be_of_type_date_multi_range = table.Column<NpgsqlRange<LocalDate>[]>(type: "daterange[]", nullable: false),
date_interval_should_be_of_type_date_range = table.Column<DateInterval>(type: "daterange", nullable: false),
date_interval_array_should_be_of_type_multi_date_range = table.Column<DateInterval[]>(type: "daterange[]", nullable: false),
list_date_interval_should_be_of_type_multi_date_range = table.Column<List<DateInterval>>(type: "daterange[]", nullable: false),
npgsql_range_date_time_should_be_of_type_tstzmultirange = table.Column<NpgsqlRange<DateTime>[]>(type: "tstzmultirange", nullable: false),
npgsql_range_date_only_should_be_of_type_date_multi_range = table.Column<NpgsqlRange<DateOnly>[]>(type: "datemultirange", nullable: false),
Only the System.
types are converted to multiranges.
I expected:
local_date_should_be_of_type_date = table.Column<LocalDate>(type: "date", nullable: false),
npgsql_range_local_date_should_be_of_type_date_range = table.Column<NpgsqlRange<LocalDate>>(type: "daterange", nullable: false),
npgsql_range_local_date_array_should_be_of_type_date_multi_range = table.Column<NpgsqlRange<LocalDate>[]>(type: "datemultirange", nullable: false),
date_interval_should_be_of_type_date_range = table.Column<DateInterval>(type: "daterange", nullable: false),
date_interval_array_should_be_of_type_multi_date_range = table.Column<DateInterval[]>(type: "datemultirange", nullable: false),
list_date_interval_should_be_of_type_multi_date_range = table.Column<List<DateInterval>>(type: "datemultirange", nullable: false),
npgsql_range_date_time_should_be_of_type_tstzmultirange = table.Column<NpgsqlRange<DateTime>[]>(type: "tstzmultirange", nullable: false),
npgsql_range_date_only_should_be_of_type_date_multi_range = table.Column<NpgsqlRange<DateOnly>[]>(type: "datemultirange", nullable: false),
I don’t see anything that would be doing it in code either Storage/Internal/NpgsqlNodaTimeTypeMappingSourcePlugin.cs and the tests don’t seem to address NodaTime for example at EFCore.PG.FunctionalTests/Query/MultirangeQueryNpgsqlTest.cs whereas Npgsql proper appears to support it as seen Npgsql.NodaTime/Internal/NodaTimeTypeHandlerResolver.cs. Is NodaTime support for datemultirange simply not implemented currently? or is this a bug? (or am I doing something wrong?)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How do I accurately represent a Date Range in NodaTime?
I have a list of LocalDate items that represent sets of start dates and end dates. I would like to be able to...
Read more >Class DateInterval | Noda Time
Returns the hash code for this interval, consistent with Equals(DateInterval). See the type documentation for a description of equality semantics.
Read more >Namespace NodaTime | Noda Time
A calendar system maps the non-calendar-specific "local time line" to human concepts such as years, months and days. DateAdjusters. Factory class for date ......
Read more >Noda Time | Date and time arithmetic
There are two types of arithmetic in Noda Time: arithmetic on the time line (in some sense "absolute" arithmetic), and calendrical arithmetic.
Read more >Noda Time | Jon Skeet's coding blog
Posts about Noda Time written by jonskeet. ... NET built-in types – a signature of IsChargingEnabled(DateTime dateTime) would have needed ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@erichiller great to hear. In the meantime I released 6.0.2 including this change, so you can just try that.
Shoot, looks like I missed the NodaTime multirange mappings - these were done in the underlying ADO.NET driver but not in EFCore.PG. I’ll do that for 6.0.2.