title: Unable to cast object of type 'System.Guid' to type 'System.String' Whilst I am only using Guid
body: <p>I am trying to get an object of type 'DocumentationPage' out of my database with the following function:</p>
  <pre class="lang-cs prettyprint-override"><code>CurrentDocumentationPage = await documentationPageService.GetDocumentationPageById(DocumentID);
  </code></pre>
  <p>in this case I am using</p>
  <pre class="lang-cs prettyprint-override"><code>[Parameter] public Guid DocumentID { get; set; }
  </code></pre>
  <p>This gets passed along with a <code>NavigateTo</code> function</p>
  <pre class="lang-cs prettyprint-override"><code>public void OnNavItemClick(Guid Id)
          {
              navMan.NavigateTo($&quot;/View/&quot; + Id);
          }
  </code></pre>
  <p>To get this with the corresponding Guid out of my database.
  My <code>DocumentationPage</code> class looks like the following:</p>
  <pre class="lang-cs prettyprint-override"><code>public class DocumentationPage : Entity
      {
          public string UserId { get; set; }
          public string Title { get; set; }
          public string Content { get; set; }
          public DateTime Published { get; set; }
          public DateTime Updated { get; set; }
      }
  </code></pre>
  <p>Where Entity is:</p>
  <pre class="lang-cs prettyprint-override"><code>public class Entity
      {
          public Guid Id;
      }
  </code></pre>
  <p>Now the following should happen:</p>
  <ul>
  <li>Click NavMenu item which holds an <code>Guid ID</code> to pass along in the <code>OnClick</code> function.</li>
  <li>Fires the function with the ID that has passed along:</li>
  </ul>
  <pre class="lang-cs prettyprint-override"><code>CurrentDocumentationPage = await documentationPageService.GetDocumentationPageById(DocumentID);
  </code></pre>
  <ul>
  <li>After that it reaches the method:</li>
  </ul>
  <pre class="lang-cs prettyprint-override"><code>public async Task&lt;DocumentationPage&gt; GetByIdAsync(Guid id)
          {
              DocumentationPage documentationPage = context.DocumentationPages.FirstOrDefault(c =&gt; c.Id == id);
  
              return documentationPage;
          }
  </code></pre>
  <p>Which at that point prompts me with the error
  <code>Unable to cast object of type 'System.Guid' to type 'System.String</code></p>
  <p>When theres no point I am trying to use it as a string.</p>
  <p>This is my stacktrace:</p>
  <pre><code>  HResult=0x80004002
    Message=Unable to cast object of type 'System.Guid' to type 'System.String'.
    Source=System.Private.CoreLib
    StackTrace:
     at System.Runtime.CompilerServices.CastHelpers.ChkCast_Helper(Void* toTypeHnd, Object obj)
     at Microsoft.Data.SqlClient.SqlBuffer.get_String()
     at Microsoft.Data.SqlClient.SqlDataReader.GetString(Int32 i)
     at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.MoveNext()
     at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
     at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
     at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)
     at System.Linq.Queryable.First[TSource](IQueryable`1 source)
     at TerceraDeveloperSite.Repositories.DocumentationPageRepository.&lt;GetByIdAsync&gt;d__2.MoveNext() in C:\Users\Rowin\source\repos\TerceraDeveloperSite\Repositories\DocumentationPageRepository.cs:line 21
  
    This exception was originally thrown at this call stack:
      [External Code]
      TerceraDeveloperSite.Repositories.DocumentationPageRepository.GetByIdAsync(System.Guid) in DocumentationPageRepository.cs
  </code></pre>
  <p>Now, I did find
  <code>at Microsoft.Data.SqlClient.SqlDataReader.GetString(Int32 i)</code>
  which wouldn't make sense either way, but as far as I know I'm not changing anything regarding the SqlDataReader.</p>
  <p>It just doesn't make sense to me as why it has problems with this method.</p>