コード例 #1
0
        /// <summary>
        /// Resolves the equivalent <see cref="IClassHandler{TEntity}"/> object of the .NET CLR type.
        /// </summary>
        /// <param name="type">The .NET CLR type</param>
        /// <returns>The equivalent <see cref="IClassHandler{TEntity}"/> object of the .NET CLR type.</returns>
        public object Resolve(Type type)
        {
            var classHandler = (object)null;

            // Attribute
            var attribute = type.GetCustomAttribute <ClassHandlerAttribute>();

            if (attribute != null)
            {
                classHandler = Converter.ToType <object>(Activator.CreateInstance(attribute.HandlerType));
            }

            // Type Level
            if (classHandler == null)
            {
                classHandler = ClassHandlerMapper.Get <object>(type);
            }

            // Return the value
            return(classHandler);
        }
コード例 #2
0
 public void Cleanup()
 {
     ClassHandlerMapper.Clear();
 }