public SchemaStore GetSchemas() { RelationMetadataBuilder relationBuilder = new RelationMetadataBuilder(); BindingMetadataBuilder bindingBuilder = new BindingMetadataBuilder(); ReferenceMetadataBuilder referenceBuilder = new ReferenceMetadataBuilder(); SchemaStore store = new SchemaStore(new DotNotation(), relationBuilder, bindingBuilder, referenceBuilder); bindingBuilder.Add(new SqliteContractResolver()); return(store); }
public static ISchemaStore Use(this ISchemaStore store, IBindingContractResolver resolver) { if (store == null) { throw new ArgumentNullException(nameof(store)); } if (resolver == null) { throw new ArgumentNullException(nameof(resolver)); } BindingMetadataBuilder builder = store.Builders.FirstOfType <BindingMetadataBuilder>(); builder?.Add(resolver); return(store); }
public static void AddContract(this ISchemaStore schemas, IBindingContractResolver contract) { if (schemas == null) { throw new ArgumentNullException(nameof(schemas)); } if (contract == null) { throw new ArgumentNullException(nameof(contract)); } BindingMetadataBuilder builder = schemas.OfType <BindingMetadataBuilder>().FirstOrDefault(); if (builder == null) { throw new InvalidOperationException("No binding metadata builder found."); } builder.Add(contract); }