-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify to fix issue for #2076, Containment expand problem
- Loading branch information
Showing
8 changed files
with
170 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 17 additions & 6 deletions
23
samples/AspNetCore3xEndpointSample.Web/Models/CustomerOrderContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,35 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore; | ||
//using Microsoft.EntityFrameworkCore; | ||
|
||
using System.Data.Entity; | ||
|
||
namespace AspNetCore3xEndpointSample.Web.Models | ||
{ | ||
public class CustomerOrderContext : DbContext | ||
{ | ||
public CustomerOrderContext(DbContextOptions<CustomerOrderContext> options) | ||
: base(options) | ||
//public CustomerOrderContext(DbContextOptions<CustomerOrderContext> options) | ||
// : base(options) | ||
//{ | ||
//} | ||
|
||
public CustomerOrderContext(string connectString) | ||
: base(connectString) | ||
{ | ||
} | ||
|
||
public DbSet<Customer> Customers { get; set; } | ||
|
||
public DbSet<Order> Orders { get; set; } | ||
// public DbSet<Order> Orders { get; set; } | ||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder) | ||
protected override void OnModelCreating(DbModelBuilder modelBuilder) | ||
{ | ||
modelBuilder.Entity<Customer>().OwnsOne(c => c.HomeAddress).WithOwner(); | ||
modelBuilder.Entity<CustomerPhone>().HasOptional(a => a.Formatted).WithRequired(); | ||
modelBuilder.Entity<Customer>() | ||
.HasMany(c => c.CustomerReferrals) | ||
.WithRequired(c => c.Customer) | ||
.HasForeignKey(c => c.CustomerID); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters