コード例 #1
0
ファイル: DbViewerApi.cs プロジェクト: skbkontur/db-viewer
        public ObjectDescription GetMeta(string objectIdentifier)
        {
            var type     = schemaRegistry.GetTypeByTypeIdentifier(objectIdentifier);
            var schema   = schemaRegistry.GetSchemaByTypeIdentifier(objectIdentifier);
            var typeMeta = PropertyHelpers.BuildTypeMetaInformation(null, type, type, schema.PropertyDescriptionBuilder, schema.CustomPropertyConfigurationProvider);

            return(new ObjectDescription
            {
                Identifier = objectIdentifier,
                SchemaDescription = schema.Description,
                TypeMetaInformation = typeMeta,
            });
        }
コード例 #2
0
ファイル: DbViewerApi.cs プロジェクト: skbkontur/db-viewer
        public async Task <ObjectDetails> ReadObject(string objectIdentifier, ObjectReadRequest query)
        {
            var type   = schemaRegistry.GetTypeByTypeIdentifier(objectIdentifier);
            var schema = schemaRegistry.GetSchemaByTypeIdentifier(objectIdentifier);
            var result = await schemaRegistry.GetConnector(objectIdentifier).Read(query.Conditions).ConfigureAwait(false);

            var typeMeta = PropertyHelpers.BuildTypeMetaInformation(result, type, type, schema.PropertyDescriptionBuilder, schema.CustomPropertyConfigurationProvider);
            var obj      = ObjectsConverter.StoredToApiDeep(result, schema.CustomPropertyConfigurationProvider);

            return(new ObjectDetails
            {
                Object = obj,
                Meta = new ObjectDescription
                {
                    Identifier = objectIdentifier,
                    SchemaDescription = schema.Description,
                    TypeMetaInformation = typeMeta,
                }
            });
        }
コード例 #3
0
ファイル: DbViewerApi.cs プロジェクト: fakefeik/db-viewer
        public async Task <ObjectDetails> ReadObject([NotNull] string objectIdentifier, [NotNull][FromBody] ObjectSearchRequest query)
        {
            var type     = schemaRegistry.GetTypeByTypeIdentifier(objectIdentifier);
            var schema   = schemaRegistry.GetSchemaByTypeIdentifier(objectIdentifier);
            var typeMeta = PropertyHelpers.BuildTypeMetaInformation(type, schema.PropertyDescriptionBuilder, schema.CustomPropertyConfigurationProvider);
            var result   = await schemaRegistry.GetConnector(objectIdentifier).Read(query.GetFilters()).ConfigureAwait(false);

            var typeInfo = TypeInfoExtractor.Extract(result, type, schema.PropertyDescriptionBuilder, schema.CustomPropertyConfigurationProvider);
            var obj      = ObjectsConverter.StoredToApi(typeInfo, type, result, schema.CustomPropertyConfigurationProvider);

            return(new ObjectDetails
            {
                Object = obj,
                Meta = new ObjectDescription
                {
                    Identifier = objectIdentifier,
                    SchemaDescription = schema.Description,
                    TypeMetaInformation = typeMeta,
                }
            });
        }
コード例 #4
0
 public void Test_Primitives(Type type, TypeMetaInformation expected)
 {
     CheckResult(PropertyHelpers.BuildTypeMetaInformation(null, type, type, new SamplePropertyDescriptionBuilder(), new CustomPropertyConfigurationProvider()), expected);
 }