public string GetScript(ApiProxyGenerationOptions options)
        {
            if (options.UseCache)
            {
                return(this._cache.GetOrAdd(CreateCacheKey(options), (key) => this.CreateScript(options)));
            }

            return(this._cache[CreateCacheKey(options)] = this.CreateScript(options));
        }
        private string CreateScript(ApiProxyGenerationOptions options)
        {
            var model = this._modelProvider.CreateModel();

            if (options.IsPartialRequest())
            {
                model = model.CreateSubModel(options.Modules, options.Controllers, options.Actions);
            }

            var generatorType = this._configuration.Generators.GetOrDefault(options.GeneratorType);

            if (generatorType == null)
            {
                throw new AbpException($"Could not find a proxy script generator with given name: {options.GeneratorType}");
            }

            using (var generator = this._iocResolver.ResolveAsDisposable <IProxyScriptGenerator>(generatorType))
            {
                return(generator.Object.CreateScript(model));
            }
        }
 private static string CreateCacheKey(ApiProxyGenerationOptions options)
 {
     return(options.ToJsonString().ToMd5());
 }