private static void AddTypeCreators(IBuildConfiguration configuration)
        {
            var factoryTypeCreator = new FactoryTypeCreator(CacheLevel.Global);

            configuration.Add(factoryTypeCreator);

            var singletonTypeCreator = new SingletonTypeCreator(CacheLevel.Global);

            configuration.Add(singletonTypeCreator);

            configuration.AddTypeCreator <ArrayTypeCreator>();
            configuration.AddTypeCreator <EnumerableTypeCreator>();
            configuration.AddTypeCreator <StructTypeCreator>();
            configuration.AddTypeCreator <DefaultTypeCreator>();
        }
예제 #2
0
        /// <summary>
        ///     Appends a new <see cref="TypeMappingRule" /> to the build configuration using the specified types.
        /// </summary>
        /// <typeparam name="TSource">The source type to use for type mapping.</typeparam>
        /// <typeparam name="TTarget">The target type to use for type mapping.</typeparam>
        /// <param name="buildConfiguration">The build configuration to update.</param>
        /// <returns>The build configuration with the new rule.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="buildConfiguration" /> parameter is <c>null</c>.</exception>
        public static IBuildConfiguration Mapping <TSource, TTarget>(this IBuildConfiguration buildConfiguration)
        {
            buildConfiguration = buildConfiguration ?? throw new ArgumentNullException(nameof(buildConfiguration));

            var sourceType = typeof(TSource);
            var targetType = typeof(TTarget);

            var rule = new TypeMappingRule(sourceType, targetType);

            return(buildConfiguration.Add(rule));
        }
예제 #3
0
 public void Configure(IBuildConfiguration configuration)
 {
     configuration.Add(new DummyExecuteOrderRule());
     configuration.Add(new DummyIgnoreRule());
     configuration.Add(new DummyPostBuildAction());
     configuration.Add(new DummyCreationRule());
     configuration.Add(new DummyTypeCreator());
     configuration.Add(new DummyValueGenerator());
 }