Esempio n. 1
0
 static EntityFactory()
 {
     definitions  = new DefinitionCollection();
     constructors = new Dictionary <string, ComponentActivator>();
     foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
     {
         foreach (var type in assembly.GetTypes())
         {
             if (!type.GetInterfaces().Contains(typeof(IComponent)))
             {
                 continue;
             }
             if (type.GetConstructor(Type.EmptyTypes) == null)
             {
                 continue;
             }
             var ctr    = Expression.New(type);
             var lambda = Expression.Lambda <ComponentActivator>(ctr).Compile();
             constructors.Add(type.Name, lambda);
         }
     }
 }
Esempio n. 2
0
 public Map()
 {
     Assets      = new AssetCollection();
     Definitions = new DefinitionCollection();
     Instances   = new InstanceCollection();
 }