Example #1
0
 /// <summary>
 ///     Adds the specified type.
 /// </summary>
 /// <param name="type">The type.</param>
 public void Add(Type type)
 {
     try
     {
         if (type.IsInterface)
         {
             _typeConstructor.GetOrAdd(type, _typeBuilder.CreateTypeFrom(type).GetConstructor(Type.EmptyTypes));
         }
         else
         {
             ConstructorInfo constructorInfo = type.GetConstructor(Type.EmptyTypes) ?? type.GetConstructors()[0];
             _typeConstructor.GetOrAdd(type, constructorInfo);
         }
     }
     catch (Exception)
     {
         LoggerManager.Instance.Error(string.Format("Error al crear el tipo: {0}", type.FullName));
         throw;
     }
 }