Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class YobaFactory: IYobaFactory
  2. {
  3.     private IDatabase database;
  4.  
  5.     public YobaFactory(IDatabase database)
  6.     {
  7.         this.typeDatabase = database;
  8.     }
  9.  
  10.     public Guid RegisterType<T>()
  11.     {
  12.         return typeDatabase.RegisterType(typeof(T));
  13.     }
  14.  
  15.     public object CreateYoba(Guid guid)
  16.     {
  17.         var type = Type.GetType(database.GetTypeNameFor(guid));
  18.         return Activator.CreateInstance(type);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement