/// <summary>
        /// Configures the factory to use in-memory relying parties.
        /// </summary>
        /// <param name="factory">The factory.</param>
        /// <param name="relyingParties">The relying parties.</param>
        /// <returns></returns>
        public static WsFederationServiceFactory UseInMemoryRelyingParties(this WsFederationServiceFactory factory, IEnumerable <RelyingParty> relyingParties)
        {
            factory.Register(new Registration <IEnumerable <RelyingParty> >(relyingParties));
            factory.RelyingPartyService = new Registration <IRelyingPartyService, InMemoryRelyingPartyService>();

            return(factory);
        }
        public static void RegisterRelyingPartyService(this WsFederationServiceFactory factory,
                                                       EntityFrameworkServiceOptions options)
        {
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            if (options.SynchronousReads)
            {
                factory.Register(new Registration <EntityFrameworkServiceOptions>(options));
            }

            factory.Register(
                new Registration <IRelyingPartyConfigurationDbContext>(
                    resolver => new RelyingPartyConfigurationDbContext(options.ConnectionString, options.Schema)));
            factory.RelyingPartyService = new Registration <IRelyingPartyService, RelyingPartyService>();
        }