public Imports(Func <string, TypeDefinition> findType, ModuleDefinition moduleDefinition, ProcessAssemblyTask processAssemblyTask) { System = new SystemImport(findType, moduleDefinition); DependencyInjection = new DependencyInjectionImport(findType, moduleDefinition); AutoDI = new AutoDIImport(findType, moduleDefinition, processAssemblyTask, this); }
public AutoDIImport(Func <string, TypeDefinition> findType, ModuleDefinition moduleDefinition, ProcessAssemblyTask processAssemblyTask, Imports imports) { Exceptions = new AutoDIExceptionsImport(findType, moduleDefinition); IApplicationBuilder = new IApplicationBuilderImport(findType, moduleDefinition, processAssemblyTask, imports); ApplicationBuilder = new ApplicationBuilderImport(findType, moduleDefinition); GlobalDI = new GlobalDIImport(findType, moduleDefinition); ServiceCollectionMixins = new ServiceCollectionMixinsImport(findType, moduleDefinition, imports); DependencyAttributeType = moduleDefinition.ImportReference(findType("AutoDI.DependencyAttribute")); }
public IApplicationBuilderImport(Func <string, TypeDefinition> findType, ModuleDefinition moduleDefinition, ProcessAssemblyTask processAssemblyTask, Imports imports) { Type = moduleDefinition.ImportReference(findType(TypeName)); TypeDefinition resolved = Type.Resolve(); var configureServices = resolved .GetMethods() .Single(x => x.Name == "ConfigureServices"); configureServices.Parameters[0].ParameterType = imports.System.Action.Type.MakeGenericInstanceType(imports.DependencyInjection .IServiceCollection); ConfigureServices = moduleDefinition.ImportReference(configureServices); Build = moduleDefinition.ImportReference(resolved.GetMethods().Single(x => x.Name == "Build")); }