Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions net/Sample/Controllers/NorthwindController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public async Task<IActionResult> Orders(DataSourceLoadOptions loadOptions) {
//----------------------------------------
o.OrderDateOnly,
o.OrderTimeOnly,
o.OrderDateTimeOffset,
//----------------------------------------
o.Freight,
o.ShipCountry,
Expand Down
2 changes: 2 additions & 0 deletions net/Sample/Models/Order.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public Order() {

public TimeOnly? OrderTimeOnly { get; set; }

public DateTimeOffset? OrderDateTimeOffset { get; set; }

//----------------------------------------

[Column(TypeName = "datetime")]
Expand Down
17 changes: 15 additions & 2 deletions net/Sample/SQL.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,23 @@ ALTER TABLE [Orders]
ADD [OrderTimeOnly] time NULL
GO
UPDATE [Orders] SET [OrderTimeOnly] = CONVERT(time, DATEADD(hour, ([OrderID] + 1), [OrderDate]))
GO
ALTER TABLE [Orders]
ADD [OrderDateTimeOffset] datetimeoffset NULL
GO
-- (-14:00..+14:00)
-- IF EXISTS (
-- SELECT 1
-- FROM [Orders]
-- WHERE ([OrderID] - 10247) NOT BETWEEN -840 AND 840
-- )
-- THROW 50000, 'OrderDateTimeOffset offset minutes must be between -840 and 840.', 1
-- GO
UPDATE [Orders] SET [OrderDateTimeOffset] = TODATETIMEOFFSET([OrderDate], ([OrderID] - 10247))

---

dotnet add package Microsoft.EntityFrameworkCore.Tools
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet package add Microsoft.EntityFrameworkCore.Tools --project Sample
dotnet package add Microsoft.EntityFrameworkCore.SqlServer --project Sample

Scaffold-DbContext "Data Source=(localdb)\MSSQLLocalDB; Database=Northwind; Integrated Security=True; MultipleActiveResultSets=True; App=EntityFramework" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
8 changes: 8 additions & 0 deletions net/Sample/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@
//groupInterval: "quarter" // N|A
}
},
{
dataField: "orderDateTimeOffset",
dataType: "date",
headerFilter: {
groupInterval: "quarter"
}
},

{
dataField: "freight",
headerFilter: {
Expand Down
Loading