Exemple #1
0
        public Task <NestedDataModelSchema> ExecuteAsync(GetNestedDataModelSchemaByNameQuery query, IExecutionContext executionContext)
        {
            NestedDataModelSchema result = null;

            if (string.IsNullOrWhiteSpace(query.Name))
            {
                return(Task.FromResult(result));
            }

            var dataModelType = _nestedDataModelRepository.GetByName(query.Name);

            if (dataModelType == null)
            {
                return(Task.FromResult(result));
            }

            result = _nestedDataModelSchemaMapper.Map(dataModelType);

            return(Task.FromResult(result));
        }
Exemple #2
0
        public Task <IDictionary <string, NestedDataModelSchema> > ExecuteAsync(GetNestedDataModelSchemaByNameRangeQuery query, IExecutionContext executionContext)
        {
            IDictionary <string, NestedDataModelSchema> result = null;

            if (EnumerableHelper.IsNullOrEmpty(query.Names))
            {
                return(Task.FromResult(result));
            }

            result = new Dictionary <string, NestedDataModelSchema>(StringComparer.OrdinalIgnoreCase);

            foreach (var name in query.Names.Distinct(StringComparer.OrdinalIgnoreCase))
            {
                var dataModelType            = _nestedDataModelRepository.GetByName(name);
                NestedDataModelSchema schema = null;
                if (dataModelType != null)
                {
                    schema = _nestedDataModelSchemaMapper.Map(dataModelType);
                }
                result.Add(name, schema);
            }

            return(Task.FromResult(result));
        }