Skip to content

Instantly share code, notes, and snippets.

@xperiandri
Created December 4, 2020 10:42
Show Gist options
  • Save xperiandri/be28b68c76142f04926b795fbdb73a54 to your computer and use it in GitHub Desktop.
Save xperiandri/be28b68c76142f04926b795fbdb73a54 to your computer and use it in GitHub Desktop.
type Root (serviceProvider : IServiceProvider,
user : Lazy<Result<GraphQLUser, ErrorMessage>>,
facebookService : Lazy<Result<IFacebookService, ErrorMessage>>,
securityOptions : IOptions<SecurityOptions>) =
let securityOptions = securityOptions.Value
member val RequestId = System.Guid.NewGuid () with get
member __.ServiceProvider : IServiceProvider = serviceProvider
member __.UserResult : Result<GraphQLUser, ErrorMessage> = user.Value
member __.BibliotekoDatabase = serviceProvider.GetRequiredService<CosmosBibliotekoDatabase>()
// static var RootType = Define.Object<Root>(...)
let RootType =
Define.Object<Root>
(name = "Root", description = "The Root type to be passed to all our resolvers.",
isTypeOf = (fun o -> o :? Root),
fields =
[ Define.Field("requestId", Guid, "Id of the request.", (fun _ (r : Root) -> r.RequestId)) ])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment