Esempio n. 1
0
        public override ITagadaBuilder DeleteAsync <TCommand, TResult>(string path, Func <TCommand, Task <TResult> > function)
        {
            base.DeleteAsync(path, function);

            Operation addSwaggerOperation(ISchemaRegistry schemaRegistry)
            {
                string topPath = TopPath.Trim('/');
                var    operationSplittedNames = path.Split("/", StringSplitOptions.RemoveEmptyEntries);
                string operationName          = operationSplittedNames[0];

                var commandProperties   = CachedTypes.GetTypeProperties(typeof(TCommand));
                var operationParameters = _getNonBodyParametersFromQueryCommand(schemaRegistry, commandProperties, operationSplittedNames);

                return(new Operation
                {
                    OperationId = topPath.Capitalize() +
                                  string.Join("", operationSplittedNames.Select(n => GetOperationPartName(n))) +
                                  "Delete",
                    Tags = new List <string> {
                        operationName
                    },
                    Consumes = new List <string>(),
                    Produces = _producesJson,
                    Parameters = operationParameters.Cast <IParameter>().ToList(),
                    Responses = _createSuccessResponses(schemaRegistry, function.Method.ReturnType)
                });
            }

            AddSwaggerOperationFunc(path, SwaggerOperationMethod.Delete, addSwaggerOperation);

            return(this);
        }
Esempio n. 2
0
        public async Task LoadAsync()
        {
            IType format;

            if (CachedTypes.ContainsKey(FormatName))
            {
                format = CachedTypes[FormatName];
            }
            else
            {
                using (var formatStream = File.OpenRead($"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}\\Mighty\\{FormatName}.xml"))
                {
                    format = Parser.ParseFromStream(formatStream);
                    CachedTypes.Add(FormatName, format);
                }
            }

            data = await format.Resolve(new Context(Stream));

            await data.ParseAsync();

            await OnLoadAsync();
        }
Esempio n. 3
0
 public virtual Type Get(string path)
 {
     return(CachedTypes.ContainsKey(path) ? CachedTypes[path] : null);
 }
Esempio n. 4
0
 public virtual void Add(string path, Type modelType)
 {
     CachedTypes.TryAdd(path, modelType);
 }
Esempio n. 5
0
        private static void FileSystemWatcher_Changed(object sender, FileSystemEventArgs e)
        {
            Type outType;

            CachedTypes.TryRemove(e.FullPath, out outType);
        }
Esempio n. 6
0
        private static void FileSystemWatcher_Renamed(object sender, RenamedEventArgs e)
        {
            Type outType;

            CachedTypes.TryRemove(e.OldFullPath, out outType);
        }
Esempio n. 7
0
        public virtual Type Get(string path)
        {
            Type retVal;

            return(CachedTypes.TryGetValue(path, out retVal) ? retVal : null);
        }