Click here to Skip to main content
16,020,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I am getting result set from Stored procedure. And filed name contains blank spaces
ex : "First Name" "Second Name"
But EF renames fields. how can i maintain same field name?
Posted

1 solution

I'm pretty sure you can't. If you are talking about the way that EF creates an object with properties that map to field names, like:

C#
MyTable.First_Name


You can't have a property name with a space in it. This is the way that the language is designed, whitespace marks the end of an identifier or language element. You can't have whitespace inside elements, so it has to make it one long name.

I know somebody will jump on me for saying this, but in every database I've done, I go through great lengths to:

1. Avoid spaces in table and column names. This also messes up SQL statements.
2. Avoid common keywords (column name Date, for example)

This helps out a lot later.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900