How can I bind an Enum to a DbType of bit or int?
Posted
by uriDium
on Stack Overflow
See other posts from Stack Overflow
or by uriDium
Published on 2010-04-21T19:39:19Z
Indexed on
2010/04/21
19:43 UTC
Read the original article
Hit count: 208
linq-to-sql
|asp.net-mvc
Hi
I am using Linq2Sql and want to bind an objects field (which is enum) to either a bit or a int type in the database. For example I want have a gender field in my model. I have already edited the DBML and changed the Type to point to my enum. I want to create Radio buttons (which I think I have figured out) for gender and dropdown lists for other areas using the same idea. My enum looks like this
public enum Gender
{
Male,
Female
}
Mapping between DbType 'int' and Type 'Project.Models.Gender' in Column 'Gender' of Type 'Candidate' is not supported.
Any ideas on how to do this mapping. Am I missing something on the enums.
© Stack Overflow or respective owner