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

  • SEARCH
  • Home
  • 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 6092069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:24:01+00:00 2026-05-23T12:24:01+00:00

I have a table with the following: CREATE TABLE [Location]([ADDRESS1] [nvarchar](50) NOT NULL DEFAULT

  • 0

I have a table with the following:

CREATE TABLE [Location]([ADDRESS1] [nvarchar](50) NOT NULL DEFAULT (' '));

I import it into Entity Framework 4.1.

Entity Framework’s designer shows this:

[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ADDRESS1
        {
            get
            {
                return _ADDRESS1;
            }
            set
            {
                OnADDRESS1Changing(value);
                ReportPropertyChanging("ADDRESS1");
                _ADDRESS1 = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ADDRESS1");
                OnADDRESS1Changed();
            }
        }
        private global::System.String _ADDRESS1 = " ";
        partial void OnADDRESS1Changing(global::System.String value);
        partial void OnADDRESS1Changed();

When I build it, I get a *.web.g.cs file in my Silverlight application and the field looks like this:

 [DataMember()]
        [Required()]
        [StringLength(50)]
        public string ADDRESS1
        {
            get
            {
                return this._address1;
            }
            set
            {
                if ((this._address1 != value))
                {
                    this.OnADDRESS1Changing(value);
                    this.RaiseDataMemberChanging("ADDRESS1");
                    this.ValidateProperty("ADDRESS1", value);
                    this._address1 = value;
                    this.RaiseDataMemberChanged("ADDRESS1");
                    this.OnADDRESS1Changed();
                }
            }
        }

Am I missing a setting in Entity Framework? It appears to me that if the field is NOT NULL code generation is flagging the field as required, even though I am telling it the default is string.empty (or blank).

  • 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-23T12:24:02+00:00Added an answer on May 23, 2026 at 12:24 pm

    NOT NULL means required. That’s the only thing that controls where a value must be supplied.

    An empty string for new records does not mean you can’t explicitly insert a NULL value, but NOT NULL will stop you doing that.

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

Sidebar

Related Questions

I have the following table: CREATE TABLE TEST(ID TINYINT NULL, COL1 CHAR(1)) INSERT INTO
I have the following table structure CREATE TABLE `table` ( `id` int(11) NOT NULL
I have the following table schema; CREATE TABLE `db1`.`sms_queue` ( `Id` INTEGER UNSIGNED NOT
I have the following table: create table ARDebitDetail(ID_ARDebitDetail int identity, ID_Hearing int, ID_AdvancedRatePlan int)
I have a table defined by the following SQL: CREATE TABLE test ( id
I have the following table: $sql = CREATE TABLE received_queries ( sender_screen_name varchar(50), text
I have the following table in a SQLite3 database: CREATE TABLE overlap_results ( neighbors_of_annotation
I have the following table and data in SQL Server 2005: create table LogEntries
I have a string like following: CREATE GLOBAL TEMPORARY TABLE some_temp_table_name or CREATE GLOBAL
I have the following table DROP TABLE IF EXISTS `test`.`foo`; CREATE TABLE `test`.`foo` (

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.