Exemplo n.º 1
0
        public virtual IQueryable <TEntity> Set <TEntity>()
            where TEntity : class
        {
            if (typeof(TEntity) == typeof(City))
            {
                return((IQueryable <TEntity>)Cities.AsQueryable());
            }

            if (typeof(TEntity) == typeof(CogTag))
            {
                return((IQueryable <TEntity>)Tags.AsQueryable());
            }

            if (typeof(TEntity) == typeof(Faction))
            {
                return((IQueryable <TEntity>)Factions.AsQueryable());
            }

            if (typeof(TEntity) == typeof(LocustHorde))
            {
                return((IQueryable <TEntity>)Factions.OfType <LocustHorde>().AsQueryable());
            }

            if (typeof(TEntity) == typeof(Gear))
            {
                return((IQueryable <TEntity>)Gears.AsQueryable());
            }

            if (typeof(TEntity) == typeof(Officer))
            {
                return((IQueryable <TEntity>)Gears.OfType <Officer>().AsQueryable());
            }

            if (typeof(TEntity) == typeof(Mission))
            {
                return((IQueryable <TEntity>)Missions.AsQueryable());
            }

            if (typeof(TEntity) == typeof(Squad))
            {
                return((IQueryable <TEntity>)Squads.AsQueryable());
            }

            if (typeof(TEntity) == typeof(SquadMission))
            {
                return((IQueryable <TEntity>)SquadMissions.AsQueryable());
            }

            if (typeof(TEntity) == typeof(Weapon))
            {
                return((IQueryable <TEntity>)Weapons.AsQueryable());
            }

            if (typeof(TEntity) == typeof(LocustLeader))
            {
                return((IQueryable <TEntity>)LocustLeaders.AsQueryable());
            }

            if (typeof(TEntity) == typeof(LocustHighCommand))
            {
                return((IQueryable <TEntity>)LocustHighCommands.AsQueryable());
            }

            throw new InvalidOperationException("Invalid entity type: " + typeof(TEntity));
        }