<commit_before>﻿using System;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using Mantle.Configuration.Attributes;
using Mantle.Extensions;
using Mantle.FaultTolerance.Interfaces;
using Mantle.Identity.Azure.Entities;
using Mantle.Identity.Interfaces;
using Microsoft.AspNet.Identity;
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;

namespace Mantle.Identity.Azure.Repositories
{
    public class DocumentDbMantleUserRepository : IDisposable, IMantleUserRepository<MantleUser>
    {
        private static readonly MapperConfiguration mapperConfiguration;

        private readonly ITransientFaultStrategy transientFaultStrategy;

        private DocumentClient documentClient;
        private bool doesCollectionExist;

        private bool doesDbExist;

        static DocumentDbMantleUserRepository()
        {
            mapperConfiguration = new MapperConfiguration(mc =>
            {
                mc.CreateMap<MantleUser, DocumentDbMantleUser>().ReverseMap();
                mc.CreateMap<MantleUserClaim, DocumentDbMantleUserClaim>().ReverseMap();
                mc.CreateMap<MantleUserLogin, DocumentDbMantleUserLogin>().ReverseMap();
            });
        }

        public DocumentDbMantleUserRepository(ITransientFaultStrategy transientFaultStrategy)
        {
            AutoSetup = true;
            DocumentDbDatabaseId = "MantleUsers";<commit_msg>Well, that was dumb.<commit_after>﻿using System;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using Mantle.Configuration.Attributes;
using Mantle.Extensions;
using Mantle.FaultTolerance.Interfaces;
using Mantle.Identity.Azure.Entities;
using Mantle.Identity.Interfaces;
using Microsoft.AspNet.Identity;
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;

namespace Mantle.Identity.Azure.Repositories
{
    public class DocumentDbMantleUserRepository : IDisposable, IMantleUserRepository<MantleUser>
    {
        private static readonly MapperConfiguration mapperConfiguration;

        private readonly ITransientFaultStrategy transientFaultStrategy;

        private DocumentClient documentClient;
        private bool doesCollectionExist;

        private bool doesDbExist;

        static DocumentDbMantleUserRepository()
        {
            mapperConfiguration = new MapperConfiguration(mc =>
            {
                mc.CreateMap<MantleUser, DocumentDbMantleUser>().ReverseMap();
                mc.CreateMap<MantleUserClaim, DocumentDbMantleUserClaim>().ReverseMap();
                mc.CreateMap<MantleUserLogin, DocumentDbMantleUserLogin>().ReverseMap();
            });
        }

        public DocumentDbMantleUserRepository(ITransientFaultStrategy transientFaultStrategy)
        {
            this.transientFaultStrategy = transientFaultStrategy;

            AutoSetup = true;
            DocumentDbDatabaseId = "MantleUsers";
{'fraction_non_alphanumeric': 0.0711340206185567, 'fraction_numerical': 0.0, 'mean_word_length': 3.5484375, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7490594', 'n_tokens_mistral': 800, 'n_tokens_neox': 751, 'n_words': 138}