示例#1
0
        public override bool Equals(object obj)
        {
            MapperContextKey other = obj as MapperContextKey;

            return(other != null &&
                   Equals(other.EntityType, EntityType) &&
                   Equals(other.KeyValue, KeyValue));
        }
示例#2
0
        public TEntity OnMapperAction <TEntity, TSource, TKey>(TEntity entity, TSource source, TKey key, MapperActionType actionType)
            where TEntity : class
            where TSource : class
            where TKey : IEntityKey
        {
            MapperContextKey mapperKey = new MapperContextKey(typeof(TEntity), key);

            _entries.AddOrUpdate(mapperKey,
                                 key =>
            {
                return(new MapperContextEntry {
                    Entity = entity, ActionType = actionType
                });
            },
                                 (key, entry) =>
            {
                entry.ActionType = actionType;
                return(entry);
            });

            return(entity);
        }