asp.net mvc 4 - MVC4 Code First Database type "Date" -


I need the database column for a date data type in MS SQL Server There is a requirement for it, it can not be a datetime.

I have in my model:

  [DataType (DataType.Date)] Public Date Time? Requested expiration date {Received; Set; }   

This still creates the column as an empty date time. Is there any way to do this before date ?

In my model, instead of using the very DataType attribute, column attribute is used

My model now looks like this:

  [column (typename = "date")] public date time? Requested expiration date {Received; Set; }   

If anyone is trying to do something similar, although I have used the TypeName = "date" , you should type TypeName whatever you want is a valid SQL Server data type.

Comments

Post a Comment

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -