title: Using an SPMetal entity class
body: <p>I'm executing the code below to get information about a page via <a href="http://en.wikipedia.org/wiki/Language_Integrated_Query" rel="nofollow">LINQ</a>. It works fine, but how do I convert this and using the entity class generated by the <a href="http://msdn.microsoft.com/en-us/library/ee538255.aspx" rel="nofollow">SPMetal</a> command?</p>
  
  <pre><code>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") &amp;&amp; page.ModerationInformation.Status.Equals(SPModerationStatusType.Approved)
                         select page;
  
          foreach (SPListItem r in resultat)
          {
              contenu += "_ModerationStatus: " + r["_ModerationStatus"] + "&lt;br&gt;";
              contenu += "FileLeafRef: " + r["FileLeafRef"] + "&lt;br&gt;";
              contenu += "PublishingPageContent: " + r["PublishingPageContent"] + "&lt;br&gt;";
              contenu += "ContentType: " + r["ContentType"] + "&lt;br&gt;";
              contenu += "Categorie: " + r["Categorie"] + "&lt;br&gt;";
          }
          PanelResultat.Controls.Add(new LiteralControl(contenu));
      }
  }
  </code></pre>