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); } } }
public Map() { Assets = new AssetCollection(); Definitions = new DefinitionCollection(); Instances = new InstanceCollection(); }