public static Dictionary <Type, Type> EmitTypes(BaseClassEmitter emitterToUse, params Type[] typesToMake) { var modelBuilder = GetModelBuilder(); if (typesToMake.Any(x => !x.IsInterface)) { throw new ArgumentException($"Parameter must be type of an interface", nameof(typesToMake)); } if (typesToMake.Any(x => x.GetMethods().Any(m => !m.IsHideBySig))) { throw new ArgumentException("Parameter must be of an interface type that does contain methods.", nameof(typesToMake)); } return(EmitTypes(emitterToUse, modelBuilder, typesToMake).ToDictionary(x => x.Item1, x => x.Item2)); }
public static Type EmitType(Type typeToMake, BaseClassEmitter emitterToUse, string nameForClass = null) { var modelBuilder = GetModelBuilder(); if (!typeToMake.IsInterface) { throw new ArgumentException($"Parameter must be type of an interface", nameof(typeToMake)); } if (typeToMake.GetMethods().Any(m => !m.IsHideBySig)) { throw new ArgumentException("Parameter must be of an interface type that does contain methods.", nameof(typeToMake)); } return(emitterToUse.EmitType(modelBuilder, typeToMake, nameForClass)); }
private static IEnumerable <Tuple <Type, Type> > EmitTypes(BaseClassEmitter emitterToUse, ModuleBuilder modelBuilder, Type[] typesToMake) => typesToMake.Select(x => new Tuple <Type, Type>(x, emitterToUse.EmitType(modelBuilder, x)));