Beispiel #1
0
        private static T New <T>() where T : Entity, new()
        {
            var entity = new T();

            entity.InstanceId = IdFactory.NewInstanceId();
            if (!Master.Entities.ContainsKey(typeof(T)))
            {
                Master.Entities.Add(typeof(T), new List <Entity>());
            }
            Master.Entities[typeof(T)].Add(entity);
            return(entity);
        }
Beispiel #2
0
        private static Entity NewEntity(Type entityType)
        {
            var entity = Activator.CreateInstance(entityType) as Entity;

            entity.InstanceId = IdFactory.NewInstanceId();
            if (!Master.Entities.ContainsKey(entityType))
            {
                Master.Entities.Add(entityType, new List <Entity>());
            }
            Master.Entities[entityType].Add(entity);
            return(entity);
        }