A bit of example, howto
varassemblyName=newAssemblyName{Name="AssemblyName"};varassembly=AssemblyBuilder.DefineDynamicAssembly(assemblyName,AssemblyBuilderAccess.RunAndSave);varmodule=assembly.DefineDynamicModule("Module",assemblyFile,true);varmappingsType=module.DefineType("MainMappingsType",TypeAttributes.Public|TypeAttributes.Abstract|TypeAttributes.Sealed);MapperConfigurationExpressionconfig=// init;config.MustBeGeneratedCompatible=true;Pro.MethodBuilderFactory= r =>{// Anything can be there. You can concat two FullName's// if you want to reflect get it, or create a special// method that finds a mapper for given <T1, T2>stringname=ConvertMethodToName(r.RequestedTypes);varmethod=mappingType.DefineMethod(name,MethodAttributes.Public|MethodAttributes.Static);returnmethod;};varmapperConfiguration=newMapperConfiguration(config);mapperConfiguration.AssertConfigurationIsValid();varmapper=mapperConfiguration.CreateMapper();mapper.CompileMappings();assembly.Save(assemblyFile);Note, that since it's not compiling in runtime, it dosen't have permissions to access to any of yours private or internal fields or methods. You can use internal fields if you specify the InternalsVisibleToAttribute to your assembly.