ConstructorInfo GetConstructorInfo(IConstructor entity)
{
// If constructor is external, get its existing ConstructorInfo
var external = entity as ExternalConstructor;
if (null != external)
return external.ConstructorInfo;
// If constructor is mapped from a generic type, get its ConstructorInfo on the constructed type
var mapped = entity as GenericMappedConstructor;
if (mapped != null)
return TypeBuilder.GetConstructor(GetSystemType(mapped.DeclaringType), GetConstructorInfo((IConstructor)mapped.SourceMember));
// If constructor is internal, get its MethodBuilder
return GetConstructorBuilder(((InternalMethod)entity).Method);
}