Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4038754
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:30:43+00:00 2026-05-20T12:30:43+00:00

Table Definition Model Definition Code using MyRandomizer.Models; namespace MyRandomizer { class Program { static

  • 0

Table Definition

enter image description here

Model Definition

enter image description here

Code

using MyRandomizer.Models;

namespace MyRandomizer
{
    class Program
    {
        static void Main(string[] args)
        {
            using (Database1Entities db = new Database1Entities())
            {

                Category c = new Category();
                c.Name = "Integral";

                db.Categories.AddObject(c);
                db.SaveChanges();

            }
        }
    }
}

Output

enter image description here

Question

Why does my default value column automatically get populated by a date of January 1, 0001?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T12:30:44+00:00Added an answer on May 20, 2026 at 12:30 pm

    If you set StoreGeneratedPattern="Computed" in designer it is only included in conceptual model (CSDL). But you also need this in storage model (SSDL). If you don’t do it EF will generate INSERT statement which will contain current value of date which is DataTime.MinValue. Storage model cannot be edited from designer. You must open EDMX file as XML and manually update row definition.

    Final definition should look like:

    <edmx:Edmx ...>
      <edmx:Runtime>
        <edmx:StorageModels> 
          <Schema ...>
            <EntityContainer Name="...">
              <EntitySet Name="Categories" EntityType="...Categories" store:Type="Tables" Schema="dbo" />
              ...
            </EntityContainer>
            <EntityType Name="Categories"/>
              ...
              <!-- Here you must add StoreGeneratedPattern -->
              <Property Name="CreationDate" Type="datetime" Nullable="false" StoreGeneratedPattern="Computed" /> 
            </EntityType>
          </Schema>
        </edmx:StorageModels>
        ...
      </edmx:Runtime>
    </edmx:Edmx>
    

    But this solution has one big problem. Once you manually modify SSDL part you should not use “Update from database” or you will have to perform this change after each call of “Update from database”. The reason is that “Update from database” deletes current SSDL part of EDMX and creates new one based on current DB structure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using a code-first approach I'd like to map a single model to multiple table
I have a sqlite (v3) table with this column definition: timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
A table row is generated using an asp:Repeater: <asp:repeater ID=announcementsRepeater OnItemDataBound=announcementsRepeater_ItemDataBound runat=Server> <itemtemplate> <tr
Recently thanks to rails' popularity, many people start using activerecord as model. however, before
I'm trying to generate an entity model from a Firebird database using the Entity
At the moment, I am setting my table charset and collation like this: class
Suppose I have the following table definition: CREATE TABLE x (i serial primary key,
I have a XAMl string table that is working a treat when i need
Table: UserId, Value, Date. I want to get the UserId, Value for the max(Date)
table data of 2 columns category and subcategory i want to get a collection

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.