public BotSeasonPlayerCardCache Get(long id = -1, long osuUserId = -1, string osuUsername = null,
                                            StringComparison userComparer = StringComparison.CurrentCultureIgnoreCase,
                                            string teamName = null, StringComparison teamComparer = StringComparison.CurrentCultureIgnoreCase)
        {
            DBSearchFunc <BotSeasonPlayerCardCache> searchFunc = new DBSearchFunc <BotSeasonPlayerCardCache>();

            if (id > -1)
            {
                searchFunc += new Func <BotSeasonPlayerCardCache, bool>(cc => cc.Id == id);
            }
            if (osuUserId > -1)
            {
                searchFunc += new Func <BotSeasonPlayerCardCache, bool>(cc => cc.OsuUserId == osuUserId);
            }
            if (osuUsername != null)
            {
                searchFunc += new Func <BotSeasonPlayerCardCache, bool>(cc => cc.Username.Equals(osuUsername, userComparer));
            }
            if (teamName != null)
            {
                searchFunc += new Func <BotSeasonPlayerCardCache, bool>(cc => cc.TeamName.Equals(teamName, teamComparer));
            }

            if (searchFunc.IsNull())
            {
                return(null);
            }

            return(base.Get(searchFunc.Get()));
        }
예제 #2
0
        public BotSeasonPlayer Get(long id = -1, long osuUserId = -1, string username = null,
                                   StringComparison usernameComparison = StringComparison.CurrentCultureIgnoreCase)
        {
            DBSearchFunc <BotSeasonPlayer> searchFunc = new DBSearchFunc <BotSeasonPlayer>();

            if (id >= 0)
            {
                searchFunc += new Func <BotSeasonPlayer, bool>(p => p.Id == id);
            }

            if (osuUserId >= 0)
            {
                searchFunc += new Func <BotSeasonPlayer, bool>(p => p.OsuUserId == id);
            }

            if (username != null)
            {
                searchFunc += new Func <BotSeasonPlayer, bool>(p => p.LastOsuUserName.Equals(username, usernameComparison));
            }

            if (searchFunc.IsNull())
            {
                return(null);
            }

            return(base.Get(searchFunc.Get()));
        }
예제 #3
0
 public bool Equals(DBSearchFunc <T> other)
 {
     return(other != default(DBSearchFunc <T>) &&
            EqualityComparer <DBSearchFunc <T> > .Default.Equals(this, other));
 }