private void CreateInitContextLazyInstance( FieldBuilder field, TypeHelper fieldType, TypeHelper objectType, EmitHelper emit, object[] parameters) { if (!CheckObjectHolderCtor(fieldType, objectType)) return; LocalBuilder initField = emit.DeclareLocal(InitContextType); emit .newobj (InitContextType.GetPublicDefaultConstructor()) .dup .ldarg_0 .callvirt (InitContextType.GetProperty("Parent").GetSetMethod()) .dup .ldc_i4_1 .callvirt (InitContextType.GetProperty("IsInternal").GetSetMethod()) .dup .ldc_i4_1 .callvirt (InitContextType.GetProperty("IsLazyInstance").GetSetMethod()) ; if (parameters != null) { emit .dup .ldsfld (GetParameterField()) .callvirt (InitContextType.GetProperty("MemberParameters").GetSetMethod()) ; } emit .stloc (initField); if (objectType.IsAbstract) { emit .ldarg_0 .ldsfld (GetTypeAccessorField()) .ldloc (initField) .callvirtNoGenerics (typeof(TypeAccessor), "CreateInstanceEx", _initContextType) .isinst (objectType) ; } else { emit .ldarg_0 .ldloc (initField) .newobj (objectType.GetPublicConstructor(typeof(InitContext))) ; } if (IsObjectHolder) { emit .newobj (fieldType, objectType) ; } emit .stfld (field) ; }