Mapster icon indicating copy to clipboard operation
Mapster copied to clipboard

Support XML documentation comments?

Open codelovercc opened this issue 3 years ago • 7 comments

Hi, Mapster is a very nice Mapper. Support XML documentation comments will be nicer, this will make happier and easier when coding with Mapster.

codelovercc avatar Nov 02 '22 12:11 codelovercc

Hi @codelovercc, Good suggestion. Pull requests are very welcome on this one :) I know there are large parts of the API that are not covered by appropriate comments.

andrerav avatar Jan 09 '23 21:01 andrerav

@andrerav I think you did not understand what he means by that, from my point of view he is trying to say that we should include XML comments in the destination model and you are talking about the Mapster source code @codelovercc can you explain more?

stormaref avatar Feb 19 '23 08:02 stormaref

You are right :), XML comments in the destination model and also in the Mapster source code.

codelovercc avatar Feb 20 '23 03:02 codelovercc

Can you give me an example with a source and destination model?

stormaref avatar Feb 20 '23 05:02 stormaref

Documentation comments https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/

codelovercc avatar Mar 09 '23 14:03 codelovercc

@codelovercc Can you explain exactly what it is you are missing in Mapster? I still don't understand.

andrerav avatar Mar 09 '23 16:03 andrerav

Here is an example. file: https://github.com/MapsterMapper/Mapster/blob/master/src/Mapster/Interfaces/IMapper.cs

Adding XML documentation comments for IMapper

using System;
using Mapster;

// ReSharper disable once CheckNamespace
namespace MapsterMapper
{
    /// <summary>
    /// Provide basic mapping methods
    /// </summary>
    public interface IMapper
    {
        /// <summary>
        /// GET TYPE ADAPTER CONFIG
        /// </summary>
        TypeAdapterConfig Config { get; }

        /// <summary>
        /// Create a <see cref="TypeAdapterBuilder"/> from TSource type
        /// </summary>
        /// <param name="source"></param>
        /// <typeparam name="TSource"></typeparam>
        /// <returns></returns>
        TypeAdapterBuilder<TSource> From<TSource>(TSource source);

        /// <summary>
        /// Map a object to <see cref="TDestination"/>
        /// </summary>
        /// <param name="source">the object</param>
        /// <typeparam name="TDestination">Destination type</typeparam>
        /// <returns></returns>
        TDestination Map<TDestination>(object source);

        /// <summary>
        /// Map from <see cref="TSource"/> to <see cref="TDestination"/>
        /// </summary>
        /// <param name="source">The source object</param>
        /// <typeparam name="TSource">The type of source</typeparam>
        /// <typeparam name="TDestination">The type of destination</typeparam>
        /// <returns>return a instance of <see cref="TDestination"/></returns>
        TDestination Map<TSource, TDestination>(TSource source);

        TDestination Map<TSource, TDestination>(TSource source, TDestination destination);
        object Map(object source, Type sourceType, Type destinationType);
        object Map(object source, object destination, Type sourceType, Type destinationType);
    }
}

image

I was trying to say that the sources should have XML documentation comments.

Sorry to bother you :)

codelovercc avatar Mar 15 '23 06:03 codelovercc