Exemplo n.º 1
0
        public static IServiceCollection AddServicesDependency(this IServiceCollection services, FirestoreAppSettings firestoreSettings)
        {
            services.AddApplicationDependencies(firestoreSettings);
            services.AddSingleton <IUserFacade, UserFacade>();

            return(services);
        }
Exemplo n.º 2
0
        public static IServiceCollection AddApplicationDependencies(this IServiceCollection services, FirestoreAppSettings firestoreSettings)
        {
            services.AddSingleton <IUserService, UserService>();
            services.AddSingleton <IJwtService <User, UserToken>, UserJwtService>();
            services.AddSingleton <ICryptographyService, CryptographSHA512Service>();

            services.AddSingleton <IFirestoreRepository, FirestoreRepository>();

            var builder = new FirestoreClientBuilder();

            builder.JsonCredentials = firestoreSettings.Credentials;

            // Add Firestore singleton
            services.AddSingleton(FirestoreDb.Create(firestoreSettings.ProjectId, builder.Build()).Collection(firestoreSettings.CollectionName));

            services.AddSingleton(AddMappers());

            return(services);
        }