public static MyDescriptorContext Create(IServiceProvider services)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            var naming =
                (INamingConventions)services.GetService(
                    typeof(INamingConventions));

            if (naming == null)
            {
                naming = new DefaultNamingConventions();
            }

            var inspector =
                (ITypeInspector)services.GetService(
                    typeof(ITypeInspector));

            if (inspector == null)
            {
                inspector = new DefaultTypeInspector();
            }

            return(new MyDescriptorContext(naming, inspector));
        }
Ejemplo n.º 2
0
 public MessagingConfig()
 {
     PublishFailureReAttempts     = JustSayingConstants.DefaultPublisherRetryCount;
     PublishFailureBackoff        = JustSayingConstants.DefaultPublisherRetryInterval;
     AdditionalSubscriberAccounts = new List <string>();
     MessageSubjectProvider       = new NonGenericMessageSubjectProvider();
     TopicNamingConvention        = new DefaultNamingConventions();
     QueueNamingConvention        = new DefaultNamingConventions();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AccountAddressProvider"/> class with the default naming convention.
        /// </summary>
        /// <param name="accountId">The AWS account ID the topics and queues belong in.</param>
        /// <param name="regionEndpoint">The AWS region the topics and queues belong in.</param>
        public AccountAddressProvider(string accountId, RegionEndpoint regionEndpoint)
        {
            _accountId      = accountId;
            _regionEndpoint = regionEndpoint;
            var namingConventions = new DefaultNamingConventions();

            _queueNamingConvention = namingConventions;
            _topicNamingConvention = namingConventions;
        }
        public void GetFieldNameForProperty_returns_right_name_for_property_with_JsonProperty_attribute()
        {
            // Arrange
            var namingConventions = new DefaultNamingConventions(new PluralizationService());

            // Act
            var name = namingConventions.GetFieldNameForProperty(typeof(Band).GetProperty("Genre"));

            // Assert
            name.Should().Be("THE-GENRE");
        }
        public void GetFieldNameForProperty_returns_right_name_for_camel_cased_property()
        {
            // Arrange
            var namingConventions = new DefaultNamingConventions(new PluralizationService());

            // Act
            var name = namingConventions.GetFieldNameForProperty(typeof(SomeClass).GetProperty("SomeKey"));

            // Assert
            name.Should().Be("some-key");
        }
        public void GetFieldNameForProperty_returns_right_name_for_id()
        {
            // Arrange
            var namingConventions = new DefaultNamingConventions(new PluralizationService());

            // Act
            var name = namingConventions.GetFieldNameForProperty(typeof(Author).GetProperty("Id"));

            // Assert
            name.Should().Be("id");
        }
Ejemplo n.º 7
0
        public static void AddContentSchemaFromAssemblyOf <TApp>(this IServiceCollection services)
        {
            var namingConventions   = new DefaultNamingConventions();
            var fieldTypeConvention = ContentTypeFieldTypeConvention.Default;
            var validationProviders = new[]
            {
                new LinkContentTypeValidatorProvider()
            };

            var discoveryService = new SchemaDiscoveryService(
                namingConventions,
                namingConventions,
                DefaultPropertyIgnoreConvention.Default,
                fieldTypeConvention, DefaultFieldControlConvention.Default, validationProviders);

            var schema = discoveryService.DiscoverSchema(typeof(TApp).GetTypeInfo().Assembly.GetTypes());

            services.AddSingleton(schema);
        }
Ejemplo n.º 8
0
 public TestNamingConvention()
 {
     _default = new DefaultNamingConventions();
 }