mirror of
https://github.com/Biarity/Sieve.git
synced 2025-10-24 06:17:12 +02:00
* Migrate tests to xunit
* Update sample project to dotnetcore3.1 * Use Sqlite in sample project to run it everywhere * Fix: Filter with escaped comma * Fix: Filter "null" does not work with Contains or StartsWith * Code cleanup: Adjust namespaces, adjust usings
This commit is contained in:
15
Sieve.Sample/Entities/ApplicationDbContext.cs
Normal file
15
Sieve.Sample/Entities/ApplicationDbContext.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Sieve.Sample.Entities
|
||||
{
|
||||
public class ApplicationDbContext : DbContext
|
||||
{
|
||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { }
|
||||
|
||||
public DbSet<Post> Posts { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
31
Sieve.Sample/Entities/Post.cs
Normal file
31
Sieve.Sample/Entities/Post.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Sieve.Attributes;
|
||||
|
||||
namespace Sieve.Sample.Entities
|
||||
{
|
||||
public class Post
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Sieve(CanFilter = true, CanSort = true)]
|
||||
public string Title { get; set; } = Guid.NewGuid().ToString().Replace("-", string.Empty)[..8];
|
||||
|
||||
[Sieve(CanFilter = true, CanSort = true)]
|
||||
public int LikeCount { get; set; } = new Random().Next(0, 1000);
|
||||
|
||||
|
||||
[Sieve(CanFilter = true, CanSort = true)]
|
||||
public int CommentCount { get; set; } = new Random().Next(0, 1000);
|
||||
|
||||
[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;
|
||||
|
||||
[Sieve(CanFilter = true, CanSort = true)]
|
||||
public int? CategoryId { get; set; } = new Random().Next(0, 4);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user