Advertisement
meowthsli

Untitled

Oct 14th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. namespace XUYTA.Core.Framework.Unity.Factories
  2. {
  3.     /// <summary>
  4.     /// Calls FactoryGenerator and creates instance of factory.
  5.     /// </summary>
  6.     internal class FactoryActivator
  7.     {
  8.         public object CreateInstance(IUnityContainer container, Type concreteFactoryType)
  9.         {
  10.             var constructor = concreteFactoryType.GetConstructor(new[] {typeof (IUnityContainer)});
  11.             if (constructor == null)
  12.             {
  13.                 throw new FactoryGeneratorException(
  14.                     "Generated factory doesn't have public constructor with IUnityContainer parameter. " +
  15.                     "There's something wrong with FactoryGenerator.");
  16.             }
  17.  
  18.             return constructor.Invoke(new object[] {container});
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement