我有兩個表。 Word
表包含單詞列表,然後WordForm
表包含每個單詞的詞性列表。我怎樣才能得到從LINQ的父/子表的數據「平」輸出
public class Word
{
public Word()
{
CategoryId = 1;
WordForms = new System.Collections.Generic.List<WordForm>();
}
public string WordId { get; set; } // WordId (Primary key) (length: 20)
public int CategoryId { get; set; } // CategoryId
public virtual System.Collections.Generic.ICollection<WordForm> WordForms { get; set; } // WordForm.FK_WordFormWord
public virtual WordCategory WordCategory { get; set; } // FK_WordWordCategory
}
public class WordForm
{
public string WordFormId { get; set; } // WordFormId (Primary key) (length: 20)
public string WordId { get; set; } // WordId (length: 20)
public int PosId { get; set; } // PosId
public string Definition { get; set; } // Definition
public virtual Pos Pos { get; set; } // FK_WordFormPos
public virtual Word Word { get; set; } // FK_WordFormWord
}
我想加入這兩個表是這樣的:
var word = db.Words
.Include(wf => wf.WordForms)
.AsNoTracking()
.FirstOrDefaultAsync();
這給了我對象的形式輸出。
我怎樣才能看到什麼是表中,這樣我又回到了我這個樣子,其中每行有所有這些列的數據:
WordId CategoryId WordFormId PosId Definition
WordId CategoryId WordFormId PosId Definition
WordId CategoryId WordFormId PosId Definition
WordId CategoryId WordFormId PosId Definition
你最終需要在哪裏放置數據? – Efrain