-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port simple relationship scenarios from docs samples (#30365)
- Loading branch information
1 parent
da50fcf
commit 2776d31
Showing
12 changed files
with
10,515 additions
and
4 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
10 changes: 10 additions & 0 deletions
10
test/EFCore.InMemory.FunctionalTests/ModelBuilding101InMemoryTest.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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace Microsoft.EntityFrameworkCore; | ||
|
||
public class ModelBuilding101InMemoryTest : ModelBuilding101TestBase | ||
{ | ||
protected override DbContextOptionsBuilder ConfigureContext(DbContextOptionsBuilder optionsBuilder) | ||
=> optionsBuilder.UseInMemoryDatabase(Guid.NewGuid().ToString()); | ||
} |
28 changes: 28 additions & 0 deletions
28
test/EFCore.Relational.Specification.Tests/ModelBuilding101TestBase.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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace Microsoft.EntityFrameworkCore; | ||
|
||
public abstract class ModelBuilding101RelationalTestBase : ModelBuilding101TestBase | ||
{ | ||
protected override ModelMetadata GetModelMetadata(Context101 context) | ||
=> new RelationalModelMetadata(context.Model, context.Database.GenerateCreateScript()); | ||
|
||
protected class RelationalModelMetadata : ModelMetadata | ||
{ | ||
public RelationalModelMetadata(IModel model, string schema) | ||
: base(model) | ||
{ | ||
Schema = schema; | ||
} | ||
|
||
public virtual string Schema { get; } | ||
|
||
protected bool Equals(RelationalModelMetadata other) | ||
=> base.Equals(other) | ||
&& Schema == other.Schema; | ||
|
||
public override int GetHashCode() | ||
=> HashCode.Combine(base.GetHashCode(), Schema); | ||
} | ||
} |
Oops, something went wrong.