示例#1
0
        public async Task <IDictionary <string, object> > GetFeatures(Guid applicationId, string environmentName, string privateKey)
        {
            var environments = unitOfWork.Repository <ApplicationEnvironment, Guid>();

            var environment = await environments.FirstOrDefaultAsync(new DirectSpecification <ApplicationEnvironment>(x => x.ApplicationId == applicationId && x.Name == environmentName));

            Guard.IsNotNull(environment, "Invalid environment name");
            Guard.IsTrue(await hasValidAccessKey.ToRead(environment.ApplicationId, privateKey), "Invalid access key");

            return(await GetFeatures(applicationId, environment));
        }
        public async Task <long> GetVersion(Guid applicationId, string environmentName, string privateKey)
        {
            Guard.IsTrue(await hasValidAccessKey.ToRead(applicationId, privateKey), "Invalid access key");

            var environments = unitOfWork.Repository <ApplicationEnvironment, Guid>();
            var spec         = ApplicationEnvironment.WithApplication(applicationId).And(ApplicationEnvironment.WithName(environmentName));
            var environment  = await environments.FirstOrDefaultAsync(spec);

            Guard.IsNotNull(environment, "Invalid environment name.");

            return(environment.GetVersion());
        }