コード例 #1
0
        internal static void SetConventions(this HarnessConfiguration config, IConventionPack pack, Expression <Func <Type, bool> > filter)
        {
            Guard.AgainstNullArgument(config, nameof(config));
            Guard.AgainstNullArgument(pack, nameof(pack));
            Guard.AgainstNullArgument(filter, nameof(filter));

            var convention = new ConventionConfig
            {
                Name           = "conventions",
                ConventionPack = pack,
                Filter         = filter
            };

            config.Conventions = convention;
        }
コード例 #2
0
        internal static void AddDatabase(this HarnessConfiguration config, string name)
        {
            Guard.AgainstNullArgument(config, nameof(config));
            Guard.AgainstNullEmptyOrWhitespace(name, nameof(name));

            if (config.Databases == null)
            {
                config.Databases = new List <DatabaseConfig>();
            }

            if (config.Databases.SingleOrDefault(x => x.DatabaseName == name) != null)
            {
                throw new SettingsBuilderException(
                          $"Cannot add database with name {name} because it has already been added to this configuration.");
            }

            config.Databases.Add(new DatabaseConfig {
                DatabaseName = name
            });
        }