Exemple #1
0
        public static JwtPayload GetJwtPayload(this IResolver <IJwtService> Resolver, HttpContext Context)
        {
            var AuthId = Context.Request.Headers["AuthId"];
            var Token  = Context.Request.Headers["Authorization"];

            return(Resolver.GetById(AuthId).TokenToJwtPayload(Token));
        }
        public int Get()
        {
            string DataStoreId    = HttpContext.Request.Query["DataStoreId"].ToString();
            var    XpoInitializer = _XpoInitializerResolver.GetById(DataStoreId);


            return(XpoInitializer.CreateUnitOfWork().Query <Customer>().Count());

            //return -1;
        }
        public static UnitOfWork GetUnitOfWork(this IResolver <IDataStore> Instance, string Id)
        {
            var DataStore = Instance.GetById(Id);

            if (DataStore != null)
            {
                return(new UnitOfWork(new SimpleDataLayer(DataStore)));
            }
            else
            {
                throw new Exception($"there is no configuration for the DataStore with the ID:{Id}");
            }
        }
 public IJwtService GetById(string Id)
 {
     if (IJwtServices.ContainsKey(Id))
     {
         return(IJwtServices[Id]);
     }
     else
     {
         var JwtInfo    = AppSettingsDictionary.GetById(Id);
         var JwtService = new JwtService(JwtInfo["Key"], JwtInfo["ValidIssuer"]);
         IJwtServices.Add(Id, JwtService);
         return(JwtService);
     }
 }
 private IXpoInitializer Build(string DataStoreId, IResolver <IDataStore> DataStoreResolver)
 {
     return(new XpoInitializer(DataStoreResolver.GetById(DataStoreId), _entityTypes));
 }