diff --git a/SieveTests/Entities/Post.cs b/SieveTests/Entities/Post.cs
index aae37bf..f52c34f 100644
--- a/SieveTests/Entities/Post.cs
+++ b/SieveTests/Entities/Post.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using Sieve.Attributes;
@@ -21,5 +22,9 @@ namespace SieveTests.Entities
[Sieve(CanFilter = true, CanSort = true)]
public DateTimeOffset DateCreated { get; set; } = DateTimeOffset.UtcNow;
+
+ [Sieve(CanFilter = true, CanSort = true)]
+ [Column(TypeName = "datetime")]
+ public DateTime DateLastViewed { get; set; } = DateTime.UtcNow;
}
}
diff --git a/SieveTests/Migrations/20180522013323_AddDateLastViewedColumn.Designer.cs b/SieveTests/Migrations/20180522013323_AddDateLastViewedColumn.Designer.cs
new file mode 100644
index 0000000..052009c
--- /dev/null
+++ b/SieveTests/Migrations/20180522013323_AddDateLastViewedColumn.Designer.cs
@@ -0,0 +1,47 @@
+//
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage;
+using Microsoft.EntityFrameworkCore.Storage.Internal;
+using SieveTests.Entities;
+using System;
+
+namespace SieveTests.Migrations
+{
+ [DbContext(typeof(ApplicationDbContext))]
+ [Migration("20180522013323_AddDateLastViewedColumn")]
+ partial class AddDateLastViewedColumn
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "2.0.1-rtm-125")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("SieveTests.Entities.Post", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("CommentCount");
+
+ b.Property("DateCreated");
+
+ b.Property("DateLastViewed")
+ .HasColumnType("datetime");
+
+ b.Property("LikeCount");
+
+ b.Property("Title");
+
+ b.HasKey("Id");
+
+ b.ToTable("Posts");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/SieveTests/Migrations/20180522013323_AddDateLastViewedColumn.cs b/SieveTests/Migrations/20180522013323_AddDateLastViewedColumn.cs
new file mode 100644
index 0000000..f702d89
--- /dev/null
+++ b/SieveTests/Migrations/20180522013323_AddDateLastViewedColumn.cs
@@ -0,0 +1,26 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+using System;
+using System.Collections.Generic;
+
+namespace SieveTests.Migrations
+{
+ public partial class AddDateLastViewedColumn : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn(
+ name: "DateLastViewed",
+ table: "Posts",
+ type: "datetime",
+ nullable: false,
+ defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "DateLastViewed",
+ table: "Posts");
+ }
+ }
+}
diff --git a/SieveTests/Migrations/ApplicationDbContextModelSnapshot.cs b/SieveTests/Migrations/ApplicationDbContextModelSnapshot.cs
index 62195f1..4455496 100644
--- a/SieveTests/Migrations/ApplicationDbContextModelSnapshot.cs
+++ b/SieveTests/Migrations/ApplicationDbContextModelSnapshot.cs
@@ -29,6 +29,9 @@ namespace SieveTests.Migrations
b.Property("DateCreated");
+ b.Property("DateLastViewed")
+ .HasColumnType("datetime");
+
b.Property("LikeCount");
b.Property("Title");