public object CreateWrapper(IEntityContainer container, object owner, object real, Type type) { var elemType = GenericTypeUtil.GetGenericArgumentOfGenericCollection(type); var specifiedCollectionWrapperType = typeof(CollectionWrapper <>).MakeGenericType(elemType); var con = specifiedCollectionWrapperType.GetConstructor( new Type[] { typeof(IEntityContainer), typeof(object), typeof(Collection <>).MakeGenericType(elemType) } ); return(con.Invoke(new object[] { container, owner, real })); }