From 031c3a6ee05ecc2970c84c9a794b6e154e35335a Mon Sep 17 00:00:00 2001 From: David Lebee Date: Wed, 13 Feb 2019 20:07:07 -0600 Subject: [PATCH] updated documentation. --- README.md | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b6fb812..f12d1f4 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,9 @@ One of the most obvious reason is to be able to execute async/await operations o Full Version | NuGet | NuGet Install ------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------: PoweredSoft.Data.Core | [![NuGet](https://img.shields.io/nuget/v/PoweredSoft.Data.Core.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/PoweredSoft.Data.Core/) | ```PM> Install-Package PoweredSoft.Data.Core``` +PoweredSoft.Data | [![NuGet](https://img.shields.io/nuget/v/PoweredSoft.Data.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/PoweredSoft.Data/) | ```PM> Install-Package PoweredSoft.Data``` PoweredSoft.Data.EntityFrameworkCore | [![NuGet](https://img.shields.io/nuget/v/PoweredSoft.Data.EntityFrameworkCore.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/PoweredSoft.Data.EntityFrameworkCore/) | ```PM> Install-Package PoweredSoft.Data.EntityFrameworkCore``` +PoweredSoft.Data.MongoDB | [![NuGet](https://img.shields.io/nuget/v/PoweredSoft.Data.MongoDB.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/PoweredSoft.Data.MongoDB/) | ```PM> Install-Package PoweredSoft.Data.MongoDB``` # In your application you may do the following @@ -21,7 +23,11 @@ public class Startup { public void ConfigureServices(IServiceCollection services) { - services.AddPoweredSoftDataServices(); + // for mongo. + services.AddPoweredSoftMongoDBDataServices(); + + // for ef core + services.AddPoweredSoftEntityFrameworkCoreDataServices(); } } ``` @@ -45,12 +51,34 @@ public class SomeClass Also as the same kind of goal, will slowly add support for a non dependant to orm async method. ```csharp -public interface IAsyncQueryableFactory +public interface IAsyncQueryableHandlerService { Task FirstOrDefaultAsync(IQueryable queryable, CancellationToken cancellationToken = default(CancellationToken)); Task FirstOrDefaultAsync(IQueryable queryable, Expression> predicate, CancellationToken cancellationToken = default(CancellationToken)); Task> ToListAsync(IQueryable queryable, CancellationToken cancellationToken = default(CancellationToken)); Task CountAsync(IQueryable queryable, CancellationToken cancellationToken = default(CancellationToken)); Task LongCountAsync(IQueryable queryable, CancellationToken cancellationToken = default(CancellationToken)); + Task AnyAsync(IQueryable queryable, Expression> predicate, CancellationToken cancellationToken = default(CancellationToken)); + Task AnyAsync(IQueryable queryable, CancellationToken cancellationToken = default(CancellationToken)); + bool CanHandle(IQueryable queryable); } -``` \ No newline at end of file +``` + +How to use + +```csharp +public class SomeClass +{ + private readonly IAsyncQueryableService asyncQueryableService; + public SomeClass(IDbContextFactoryProvider asyncQueryableService) + { + this.asyncQueryableService = asyncQueryableService; + } + + public async Task GetFirstAsync(IQueryable query) { + return await this.asyncQueryableService.FirstOrDefaultAsync(query); + } +} + +``` +