mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-06-21 20:52:15 +00:00
Updated readme and added new sample project
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using EntityFrameworkCore.Projections;
|
||||
using ReadmeSample.Entities;
|
||||
|
||||
namespace ReadmeSample.Extensions
|
||||
{
|
||||
public static class UserExtensions
|
||||
{
|
||||
[Projectable]
|
||||
public static Order GetMostRecentOrderForUser(this User user, DateTime? cutoffDate)
|
||||
=> user.Orders.Where(x => x.CreatedDate >= cutoffDate).OrderByDescending(x => x.CreatedDate).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user