Entity Framework Model First 1: 0..1 Relations

I created the following model in Designer Model 5 Designer in Visual Studio 2012:

enter image description here

Then I generated the database from the model, which resulted in the following tables in my database:

enter image description here

Please help me understand why the Entity Framework generates a one-to-many relationship for a one-to-zero-one association.


Update # 1

Also, if I change the association from 1: 0..1 to 1: 1 as follows:

enter image description here

Then the database not only does not have a one-to-one relationship, but now the one-to-many relationship is upside down, which seems even stranger to me:

enter image description here


Update # 2

Mystere Man , SQL Server, 1: 0..1, :

enter image description here

, , , :

public class UserMap : EntityTypeConfiguration<User>
{
    public UserMap()
    {
        ToTable("Users");

        HasKey(t => t.UserId);

        Property(t => t.UserId)
            .HasColumnName("UserId");

        Property(t => t.Name)
            .HasColumnName("Name")
            .IsRequired()
            .HasMaxLength(50);

        Property(t => t.EmailAddress)
            .HasColumnName("EmailAddress")
            .IsRequired()
            .HasMaxLength(254);

        Property(t => t.CreatedDateTime)
            .HasColumnName("CreatedDateTime");

        HasOptional(t => t.Subscription)
            .WithRequired(t => t.User);
    }
}

public class SubscriptionMap : EntityTypeConfiguration<Subscription>
{
    public SubscriptionMap()
    {
        ToTable("Subscriptions");

        HasKey(t => t.SubscriptionId);

        Property(t => t.SubscriptionId)
            .HasColumnName("SubscriptionId");

        Property(t => t.TypeValue)
            .HasColumnName("TypeValue");

        Property(t => t.CreatedDateTime)
            .HasColumnName("CreatedDateTime");

        Property(t => t.ExpiresDateTime)
            .HasColumnName("ExpiresDateTime");

        HasRequired(t => t.User)
            .WithOptional(t => t.Subscription);
    }
}

, , Code First Entity Framework. , Model First.

?

!

0
1

SQL 1:1 1: 0..1, , . , 1:1, , 1: 0..1 .

SQL - , EF, 1: *, (, ). EF ( ), .

EDIT:

, First, , .

. , EF 1: 0..1, .

+2

All Articles