我正在执行以下代码,以通过LINQ获取有关网页的信息。它工作正常,但我如何转换它并使用SPMetal命令生成的实体类?
Guid siteGuid = SPContext.Current.Site.ID;
using (SPSite site = new SPSite(siteGuid))
{
using (SPWeb web = site.OpenWeb())
{
SPList lespages = web.Lists["Pages"];
var resultat = from SPListItem page
in lespages.Items
where page.ContentType.Name.Equals("PageNews") && page.ModerationInformation.Status.Equals(SPModerationStatusType.Approved)
select page;
foreach (SPListItem r in resultat)
{
contenu += "_ModerationStatus: " + r["_ModerationStatus"] + "<br>";
contenu += "FileLeafRef: " + r["FileLeafRef"] + "<br>";
contenu += "PublishingPageContent: " + r["PublishingPageContent"] + "<br>";
contenu += "ContentType: " + r["ContentType"] + "<br>";
contenu += "Categorie: " + r["Categorie"] + "<br>";
}
PanelResultat.Controls.Add(new LiteralControl(contenu));
}
}