/// <inheritdoc /> public void Execute(GeneratorExecutionContext context) { try { var options = SourceGenerationOptions.From(context); var compilation = context.Compilation .AddSource(ref context, MapFromAttributeSource.Generate(options)) .AddSource(ref context, IgnorePropertyAttributeSource.Generate(options)) .AddSource(ref context, ITypeConverterSource.Generate(options)) .AddSource(ref context, MapTypeConverterAttributeSource.Generate(options)) .AddSource(ref context, MapPropertyAttributeSource.Generate(options)) .AddSource(ref context, MappingContextSource.Generate(options)); if (context.SyntaxReceiver is MapToSyntaxReceiver receiver && receiver.CandidateTypes.Any()) { AddGeneratedMappingsClasses(context, compilation, receiver.CandidateTypes, options); } } catch (Exception ex) { Console.WriteLine(ex); throw; } }
public SourcedTypeConverter(ITypeConverterSource typeConverterSource) { if (typeConverterSource == null) { throw new ArgumentNullException(nameof(typeConverterSource)); } this.typeConverterSource = typeConverterSource; }
public CachingTypeConverterSource( IDictionary <Type, TypeConverter> typeConverterCache, ITypeConverterSource typeConverterSource) { if (typeConverterCache == null) { throw new ArgumentNullException(nameof(typeConverterCache)); } if (typeConverterSource == null) { throw new ArgumentNullException(nameof(typeConverterSource)); } this.typeConverterCache = typeConverterCache; this.typeConverterSource = typeConverterSource; }
public CachingTypeConverterSource(ITypeConverterSource typeConverterSource) : this(new Dictionary <Type, TypeConverter>(), typeConverterSource) { }