コード例 #1
0
        // --------------------------------------------------------------------
        // タイアップ名検索
        // --------------------------------------------------------------------
        private static IQueryable <AvailableSong> SearchByTieUpName(IQueryable <AvailableSong> records, String word)
        {
            Boolean isRuby = YbdCommon.IsRuby(word, out String ruby);

            return(records.Where(x => EF.Functions.Like(x.TieUpName, $"%{word}%") ||
                                 isRuby && EF.Functions.Like(x.TieUpRuby, $"%{ruby}%")));
        }
コード例 #2
0
        // ====================================================================
        // private static メンバー関数
        // ====================================================================

        // --------------------------------------------------------------------
        // AnyWord 検索
        // --------------------------------------------------------------------
        private static IQueryable <AvailableSong> SearchByAnyWord(IQueryable <AvailableSong> records, String word)
        {
            // String.Contains() が StringComparison.OrdinalIgnoreCase 付きで動作しないため、EF.Functions.Like() を使う
            Boolean isRuby = YbdCommon.IsRuby(word, out String ruby);

            return(records.Where(x => EF.Functions.Like(x.Path, $"%{word}%") ||
                                 EF.Functions.Like(x.SongName, $"%{word}%") ||
                                 isRuby && EF.Functions.Like(x.SongRuby, $"%{ruby}%") ||
                                 EF.Functions.Like(x.TieUpName, $"%{word}%") ||
                                 isRuby && EF.Functions.Like(x.TieUpRuby, $"%{ruby}%") ||
                                 EF.Functions.Like(x.ArtistName, $"%{word}%") ||
                                 isRuby && EF.Functions.Like(x.ArtistRuby, $"%{ruby}%") ||
                                 EF.Functions.Like(x.MakerName, $"%{word}%") ||
                                 isRuby && EF.Functions.Like(x.MakerRuby, $"%{ruby}%") ||
                                 EF.Functions.Like(x.Worker, $"%{word}%")));
        }