2

This question relates to a new class library project created in Visual Studio 2012.

I have added a SQL Server view to my entity framework model.

In the properties of the PromisedDate column, I have changed Nullable from (None) to False as there will never be a null value returned in this column. I have double-checked there are no null values with a select statement.

Screenshot of edmx showing nullable set to false

However, even after a save, closing all open tabs in Visual Studio and doing a full clean and rebuild of the solution, PromisedDate is still a DateTime? and I have to keep using .Value in code to get the value of it.

It's frustrating, what am I doing wrong?!

Here is a screenshot of the generated .CS file:

Screenshot of generated class showing still nullable

bgs264
  • 4,572
  • 6
  • 38
  • 72

1 Answers1

0

You should do the following steps.

1) Save designer file and generate your database from designer
2) Click on Context file and Code Generation file(T4) and click run custom tool.
3) make sure you save the file again, an * will appear after you generate the database.

radu florescu
  • 4,315
  • 10
  • 60
  • 92
  • 1
    Hi there, thanks! For future searchers, step 1 was not necessary. All that was necessary was steps 2 and 3. – bgs264 Oct 29 '12 at 10:39
  • 1
    More info: http://blog.jongallant.com/2012/08/entity-framework-manual-update.html#.UI5oEcUxoWA – bgs264 Oct 29 '12 at 11:28