EntityFramework database first - type mapping - map binary(8) from SQL to int in C#
<p>Inside SQL I have table that have primary key as binary(8). When I add that table to my model using <code>Update Model from Database</code> I can see that this column has type=<code>Binary</code></p>
<p><a href="https://i.stack.imgur.com/C7H8K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C7H8K.png" alt="enter image description here" /></a></p>
<p>and in C# I get that column as <code>byte[]</code>.</p>
<p>Can I map that column to int?</p>
<p>I know I can create a view with <code>CAST</code> in SQL:</p>
<pre><code>SELECT
    Client_Id,
    CAST(Client_Id AS INT) AS NewClient_Id,
    * /*other columns*/
FROM
    dbo.Clients
</code></pre>
<p>but this isn't a solution, because I must be able to write, not just read from that table. I know I can create stored procedure for inserts but I'd like to avoid that.</p>
<p>I'm usinf EntityFramewor 6.1.3.</p>