Mapster icon indicating copy to clipboard operation
Mapster copied to clipboard

TypeAdapter.Adapt was already called, please clone or create new TypeAdapterConfig

Open LemonNoCry opened this issue 1 year ago • 0 comments

Here is my code:

public static TTarget CopyTo<TSource, TTarget>(this TSource source, TTarget target, params Expression<Func<TTarget, object>>[] members)
    {
        if (source == null)
            return default;

        var config = TypeAdapterConfig<TSource, TTarget>
            .NewConfig()
            .IgnoreNullValues(true);

        if (members != null)
        {
            config.Ignore(members);
        }

        return source.Adapt(target, config.Config);
    }

I get some errors image

What's wrong with my writing

LemonNoCry avatar Mar 09 '23 07:03 LemonNoCry