more adjusted to support params.

This commit is contained in:
David Lebee
2021-02-02 19:32:39 -05:00
parent ca307194db
commit 30e15e310c
10 changed files with 151 additions and 91 deletions
+3 -17
View File
@@ -1,9 +1,4 @@
using PoweredSoft.CQRS.DynamicQuery.Abstractions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System;
namespace Demo.DynamicQueries
{
@@ -13,17 +8,8 @@ namespace Demo.DynamicQueries
public string DisplayName { get; set; }
}
public class ContactQueryableProvider : IQueryableProvider<Contact>
public class SearchContactParams
{
public Task<IQueryable<Contact>> GetQueryableAsync(object query, CancellationToken cancelllationToken = default)
{
var ret = new List<Contact>
{
new Contact { Id = 1, DisplayName = "David L"},
new Contact { Id = 2, DisplayName = "John Doe"}
};
return Task.FromResult(ret.AsQueryable());
}
public string SearchDisplayName { get; set; }
}
}
@@ -0,0 +1,23 @@
using PoweredSoft.CQRS.DynamicQuery.Abstractions;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Demo.DynamicQueries
{
public class ContactQueryableProvider : IQueryableProvider<Contact>
{
public Task<IQueryable<Contact>> GetQueryableAsync(object query, CancellationToken cancelllationToken = default)
{
var source = new List<Contact>
{
new Contact { Id = 1, DisplayName = "David L"},
new Contact { Id = 2, DisplayName = "John Doe"}
};
var ret = source.AsQueryable();
return Task.FromResult(ret);
}
}
}
+1
View File
@@ -63,6 +63,7 @@ namespace Demo
{
services.AddTransient<IQueryableProvider<Contact>, ContactQueryableProvider>();
services.AddDynamicQuery<Contact, Contact>();
services.AddDynamicQueryWithParams<Contact, Contact, SearchContactParams>(name: "SearchContacts");
}
private void AddCommands(IServiceCollection services)