A provider

Still need to test before building a package
This commit is contained in:
Daniel J. Summers
2016-09-27 22:14:10 -05:00
parent 6ae49f2865
commit b46f2a83f0
5 changed files with 294 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
/// Extensions for <see cref="IServiceCollection" /> to add the RethinkDB cache
[<AutoOpen>]
[<System.Runtime.CompilerServices.Extension>]
module RethinkDB.DistributedCache.IServiceCollectionExtensions
open Microsoft.Extensions.Caching.Distributed
open Microsoft.Extensions.DependencyInjection
open System
type IServiceCollection with
member this.AddDistributedRethinkDBCache(options : Action<DistributedRethinkDBCacheOptions>) =
match options with null -> nullArg "options" | _ -> ()
ignore <| this.AddOptions ()
ignore <| this.Configure options
ignore <| this.Add (ServiceDescriptor.Transient<IDistributedCache, DistributedRethinkDBCache>())
this
/// <summary>
/// Add RethinkDB options to the services collection
/// </summary>
/// <param name="options">An action to set the options for the cache</param>
/// <returns>The given <see cref="IServiceCollection" /> for further manipulation</returns>
[<System.Runtime.CompilerServices.Extension>]
let AddDistributedRethinkDBCache (this : IServiceCollection, options : Action<DistributedRethinkDBCacheOptions>) =
this.AddDistributedRethinkDBCache options