<commit_before>﻿using System;
using System.Collections.Generic;

namespace Runtime.Mapper
{
    public static class Mapper
    {
        private static Dictionary<Tuple<Type, Type>, Func<object, object, object>> mappingFunctions = new Dictionary<Tuple<Type, Type>, Func<object, object, object>>();

        public static TDestination DeepCopyTo<TDestination>(this object source)
        {
            return default(TDestination);
        }

        public static void Map<TSource, TDestination>(TSource source, TDestination destination)
        {

        }
    }
}<commit_msg>store and get mapping function<commit_after>﻿using System;
using System.Collections.Concurrent;

namespace Runtime.Mapper
{
    public static class Mapper
    {
        private static ConcurrentDictionary<Tuple<Type, Type>, Func<object, object, object>> mappingFunctions = new ConcurrentDictionary<Tuple<Type, Type>, Func<object, object, object>>();

        public static TDestination DeepCopyTo<TDestination>(this object source)
        {
            Type sourceType = source.GetType();
            Type destinationType = typeof(TDestination);

            Tuple<Type, Type> key = new Tuple<Type, Type>(sourceType, destinationType);

            Func<object, object, object> mappingFunction = mappingFunctions.GetOrAdd(key, GetMappingFunction());

            return (TDestination)mappingFunction(source, null);
        }

        public static void Map<TSource, TDestination>(TSource source, TDestination destination)
        {
            Type sourceType = source.GetType();
            Type destinationType = typeof(TDestination);

            Tuple<Type, Type> key = new Tuple<Type, Type>(sourceType, destinationType);

            Func<object, object, object> mappingFunction = mappingFunctions.GetOrAdd(key, GetMappingFunction());

            mappingFunction(source, destination);
        }


        private static Func<object, object, object> GetMappingFunction()
        {
            return null;
        }
    }
}
{'fraction_non_alphanumeric': 0.09376558603491272, 'fraction_numerical': 0.0, 'mean_word_length': 3.1022494887525562, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5274895', 'n_tokens_mistral': 502, 'n_tokens_neox': 495, 'n_words': 133}