I am a novice in EF6. I defined a SP with variables of the input type. In the SP specifies which variable is associated with which column. Then, why do we set the "Property" in stored procedure mapping? Differ?
Asked
Active
Viewed 127 times
0

Reza Hatami
- 102
- 6
1 Answers
1
Whats happening is that there is a mapping from the SQL
type to the .NET
type.
.NET
has different types than SQL
has.
You can find a list here.
The entity framework will handle the conversions for you.
Here's a part of the table:
SQL Server Database Engine type .NET Framework type SqlDbType
-------------------------------------------------------------------------------
bigint Int64 BigInt
binary Byte[] VarBinary
bit Boolean Bit
char String Char
date 1 DateTime Date 1
datetime DateTime DateTime
datetime2 DateTime DateTime2
As for the naming of the property: EF has some (sometimes annoying) naming conventions.
More on that here: https://learn.microsoft.com/en-us/ef/ef6/modeling/code-first/conventions/built-in
And here: Database Naming Conventions by Microsoft?
Take special note to:
"Do not prefix stored procedures with sp_, because this prefix is reserved for identifying system-stored procedures."
https://blogs.msdn.microsoft.com/robcaron/2005/01/27/prefixing-stored-procedure-names-with-sp_/

Stefan
- 17,448
- 11
- 60
- 79