private static Func <IStateFormatter> GetFormatterGenerator(bool encrypt, bool sign)
        {
            Link <Func <IStateFormatter> > factory = new Link <Func <IStateFormatter> >(
                () => TokenPersister.CreateFormatterGenerator(encrypt, sign)
                );

            return(() => {
                return factory.Value();
            });
        }
Ejemplo n.º 2
0
        private static Func <IStateFormatter> LazilyGetFormatterGenerator(bool encrypt, bool sign)
        {
            Lazy <Func <IStateFormatter> > generatorFactory = new Lazy <Func <IStateFormatter> >(
                () => TokenPersister.CreateFormatterGenerator(encrypt, sign)
                );

            return(() => {
                Func <IStateFormatter> generator = generatorFactory.Eval();
                return generator();
            });
        }