将SQL Server查询的结果导入列表<t>对象

时间:2016-05-16 11:30:36

标签: c# sql-server class user-defined-types

我在SQL Server中有一个查询:

openssl x509 -inform PEM -in certificate.cer -out certificate.crt

返回这些结果:

SELECT   
    AC.Author_ID, AC.CoAuthor_ID, AC.Paper_ID, AP.Venue_ID, AC.Year
FROM
    AuthorCoAuthor AC
JOIN     
    AuthorPaper AP ON AP.Author_ID = AC.Author_ID 
                   AND AP.Paper_ID  = AC.Paper_ID
WHERE    
    AC.Year = 2005
ORDER BY 
    AC.Author_ID, AC.Year, AC.CoAuthor_ID, AC.Paper_ID, AP.Venue_ID  

如何在类的单个对象中获取所有这些输出,即Author_ID | CoAuthor_ID | Paper_ID | Venue_ID | Year ---------------------------------------------------- 677 | 901706 | 812229 | 64309 | 2005 677 | 901706 | 812486 | 65182 | 2005 677 | 901706 | 818273 | 185787 | 2005 1359 | 133112 | 812558 | 65182 | 2005 1359 | 133112 | 1346914 | 99789 | 2005 ... | ... | ... | ... | ... ... | ... | ... | ... | ... Author.cs的代码为:

Author.cs

现在,如果我将类型public partial class Author { public Author() { this.AuthorCoAuthors = new HashSet<AuthorCoAuthor>(); this.AuthorPapers = new HashSet<AuthorPaper>(); this.AuthorVenues = new HashSet<AuthorVenue>(); } public int ID { get; set; } public int Author_ID { get; set; } public string Author_Name { get; set; } public virtual ICollection<AuthorCoAuthor> AuthorCoAuthors { get; set; } public virtual ICollection<AuthorPaper> AuthorPapers { get; set; } public virtual ICollection<AuthorVenue> AuthorVenues { get; set; } } 的列表定义为:

Author

如何阅读List<Author> _author = new List<Author>(); 中的所有上述输出?

0 个答案:

没有答案