4

I need to know the equivalent SQL Server data types for EF. I found 2 similar online references, but their definitions appear inconsistent. Which reference should I refer to if I'm using Entity Framework?

1) Data Type Mappings in ADO.NET

http://msdn.microsoft.com/en-us/library/cc716729%28v=vs.110%29.aspx

2) SQL Server Data Types in the .NET Framework

http://msdn.microsoft.com/en-us/library/ms131092.aspx

3
  • What kind of EF? Database-First, Code-First? Code-First to an existing DB? What do you want to do? What have you tried so far? Commented Oct 18, 2014 at 8:18
  • Which of the two links above would you refer to for Code-First? I need to know the equivalent SQL Server data types for EF. But the Microsoft provides 2 different online references... which one is right? Commented Oct 18, 2014 at 8:28
  • 1
    You could do as Julie has done here thedatafarm.com/data-access/… and create an entity with every data type and see how it works out. Commented Oct 18, 2014 at 9:00

1 Answer 1

6

Neither of those.

Entity Framework maps SQL Server data types to conceptual model types ("Edm types"). The mapping can be found here:

Edm types in turn translate to .NET types in a straightforward way (Boolean -> Boolean, Int32 -> Int32, Binary -> Byte array, etc.) and can be found in the reference code:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.