0

私は次のものを持っています:

var questions = questionService.Details(pk, rk);
var topics = contentService.GetTitles("0006000")
                .Where(x => x.RowKey.Substring(2, 2) != "00");
model = (
    from q in questions
    join t in topics on q.RowKey.Substring(0, 4) equals t.RowKey into topics2
    from t in topics2.DefaultIfEmpty()
    select new Question.Grid {
        PartitionKey = q.PartitionKey,
        RowKey = q.RowKey,
        Topic = t == null ? "No matching topic" : t.Title,
        ...

次に、以下を追加する必要があります。

var types = referenceService.Get("07");

questions.typeとの間にリンクがある場所types.RowKey

この 3 番目のデータ ソースをリンクして、タイプ テーブルに一致するものが何もない場合に「一致するタイプがありません」というメッセージを表示させる方法はありますか? 私の問題は、次の参加方法がよくわからないことです。

4

2 に答える 2

0
        var questions = questionService.Details(pk, rk);
        var topics = contentService.GetTitles("0006000")
                        .Where(x => x.RowKey.Substring(2, 2) != "00");
        var types = referenceService.Get("07");
        model = (from q in questions
            join t in topics on q.RowKey.Substring(0, 4) equals t.RowKey into topics2
            from t in topics2.DefaultIfEmpty())
            select new Question.Grid {
                PartitionKey = q.PartitionKey,
                RowKey = q.RowKey,
                Topic = t == null ? "No matching topic" : t.Title,
                ...
            }).Union
            (from a in types
             join q in questions on q.type equals a.RowKey 
             where a.ID != null
             select new Question.Grid {
                    PartitionKey = q.PartitionKey,
                    RowKey = q.RowKey,
                    Topic = t == null ? "No matching topic" : t.Title,
                    ...
            })
于 2012-08-07T18:25:50.053 に答える
0

最初の結合の結果を 3 番目のデータソースに結合できると思います。

var questions = questionService.Details(pk, rk);
var topics = contentService.GetTitles("0006000")
                .Where(x => x.RowKey.Substring(2, 2) != "00");
var  types = referenceService.Get("07");

model = (
    from q in questions
    join t in topics on q.RowKey.Substring(0, 4) equals t.RowKey into topics2
    from t in topics2.DefaultIfEmpty()
    join type in types on q.type equals type.RowKey into types2
    from type in types2.DefaultIfEmpty()
    select new Question.Grid {
        PartitionKey = q.PartitionKey,
        RowKey = q.RowKey,
        Topic = t == null ? "No matching topic" : t.Title,
        Type = type == null ? "No matching type" : type.Title,
        ...
于 2012-08-07T20:39:25.547 に答える