title: I am trying to return XML data from Entity Framework
body: <p>I have create a MVC5 web app using Web API.
  I also use Entity Framework 6.</p>
  
  <p>I have a stored procedure:</p>
  
  <pre><code>SELECT * FROM [Group] WHERE CompanyRef = @CompanyRef OR CompanyRef = '00000000-0000-0000-0000-000000000000' AND Active = 1 
  FOR XML PATH('Group'), ROOT ('Groups')
  </code></pre>
  
  <p>It returns this in the query analyzer:</p>
  
  <pre><code>&lt;Groups&gt;
    &lt;Group&gt;
      &lt;GroupId&gt;1&lt;/GroupId&gt;
      &lt;GroupRef&gt;00000000-0000-0000-0000-000000000000&lt;/GroupRef&gt;
      &lt;Name&gt;Todays Work&lt;/Name&gt;
      &lt;Description&gt;System&lt;/Description&gt;
      &lt;CompanyRef&gt;00000000-0000-0000-0000-000000000000&lt;/CompanyRef&gt;    
      &lt;Active&gt;1&lt;/Active&gt;
    &lt;/Group&gt;
    &lt;Group&gt;
      &lt;GroupId&gt;2&lt;/GroupId&gt;
      &lt;GroupRef&gt;00000000-0000-0000-0000-000000000000&lt;/GroupRef&gt; 
      &lt;Name&gt;All&lt;/Name&gt;
      &lt;Description&gt;System&lt;/Description&gt;
      &lt;CompanyRef&gt;00000000-0000-0000-0000-000000000000&lt;/CompanyRef&gt; 
      &lt;Active&gt;1&lt;/Active&gt;
    &lt;/Group&gt;
  &lt;/Groups&gt;
  </code></pre>
  
  <p>The return type declared in Function Imports (EF) is a string.</p>
  
  <p>In my services class I 'connect' to the Entity Model by calling this:</p>
  
  <pre><code>public ObjectResult&lt;string&gt; Get(Guid? companyRef)
  {
      return o.Group_Get(companyRef);
  }
  </code></pre>
  
  <p>In my API Controller I call my Services Function like this:</p>
  
  <pre><code>Compression compression = new Compression();
  var test = groupRepository.Get(companyRef);
  </code></pre>
  
  <p>Inspecting the value of 'test' I get this:</p>
  
  <p><a href="https://i.stack.imgur.com/7PUqX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7PUqX.jpg" alt="enter image description here"></a></p>
  
  <p>There is no sign of my XML?</p>