How to ignore a particular field from an Entity model upon insert?

We have a field in our SQL Server database table which is autogenerated by SQL Server, the field is called CreatedTime.

We have mapped the whole database table to our datamodel in Entity Framework, thus also the field CreatedTime.

When we insert a new row in the database, via Entity Framework, we thus do not provide any value for CreatedTime.

This causes the insert to fail with the error:

SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM

So the question is: Is there is a way to to exclude a particular field in the Entity datamodel in the Entity Framework insert statement? So that we will not get the above error?

We would like to keep the field CreatedTime in the Entity model, because we might want to access it later.


I found a simple solution to the problem on this thread:

There Fernando Soto writes:

"If you go to the EDM designer click on the field in the table that is auto-generated by the database, right click on it and select Properties and look at the properties windows click on StoreGeneratedPattern and set its value to Computed, I believe it will give you what you are looking for."

The above solution was super quick and easy and it seems to work.

Also thank you for your contributions guys, but the above solution seems to do the job.

Need Your Help

Broken Pipe from subprocess.Popen.communciate() with stdin


I'm having a strange issue when using subprocess.Popen.communicate(). For background, I want to execute an application from my python script. When I run the program from the command line, I do it...

Java - Asteroids - acceleration in two dimensions

java rotation acceleration

I am currently writing asteroids for extra credit in my computer science class, following a very loose guide that provided some starter code. I have a ship and I can use key presses to change its

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.