Abioc.Generation.CodeGeneration.GenerateComposeMapInitializer(bool, (string name, System.Type type, bool requiresContext))

Here are the examples of the csharp api class Abioc.Generation.CodeGeneration.GenerateComposeMapInitializer(bool, (string name, System.Type type, bool requiresContext)) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: abioc
Source File: CodeGeneration.cs
View license
private static string GenerateComposeMapMethod(GenerationContext context)
        {
            if (context == null)
                throw new ArgumentNullException(nameof(context));

            string composeMapType = context.HasConstructionContext
                ? $"System.Collections.Generic.Dictionary<System.Type, System.Func<{context.ConstructionContext}, object>>"
                : "System.Collections.Generic.Dictionary<System.Type, System.Func<object>>";

            var builder = new StringBuilder(1024);
            builder.AppendFormat(
                "public {0} GetCreateMap(){1}{{{1}    return new {0}{1}    {{",
                composeMapType,
                NewLine);

            string initializers =
                string.Join(
                    NewLine,
                    context.ComposeMethodsNames.Select(c => GenerateComposeMapInitializer(context.HasConstructionContext, c)));
            initializers = CodeGen.Indent(NewLine + initializers, 2);
            builder.Append(initializers);

            builder.AppendFormat("{0}    }};{0}}}", NewLine);
            return builder.ToString();
        }