-
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.
Add API and tests for value converters
Part of issue #242 As always, fluent API names subject to change in API review. This PR also makes a change to never pass nulls to value converters. This makes it significantly easier to write custom converters that compose well with built-in converters and can be used for both PKs and FKs where the nullability is different.
- Loading branch information
1 parent
5c46824
commit d4bc77c
Showing
49 changed files
with
2,328 additions
and
871 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
41 changes: 41 additions & 0 deletions
41
samples/OracleProvider/test/OracleProvider.FunctionalTests/ConvertToStoreTypesOracleTest.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,41 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using Microsoft.EntityFrameworkCore.Diagnostics; | ||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
using Xunit.Abstractions; | ||
|
||
namespace Microsoft.EntityFrameworkCore | ||
{ | ||
public class ConvertToStoreTypesOracleTest : ConvertToStoreTypesTestBase<ConvertToStoreTypesOracleTest.ConvertToStoreTypesOracleFixture> | ||
{ | ||
public ConvertToStoreTypesOracleTest(ConvertToStoreTypesOracleFixture fixture, ITestOutputHelper testOutputHelper) | ||
: base(fixture) | ||
{ | ||
fixture.TestSqlLoggerFactory.Clear(); | ||
//fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); | ||
} | ||
|
||
public override void Can_perform_query_with_max_length() | ||
{ | ||
// Disabled--sample Oracle cannot query against large data types | ||
} | ||
|
||
public class ConvertToStoreTypesOracleFixture : ConvertToStoreTypesFixtureBase | ||
{ | ||
protected override ITestStoreFactory TestStoreFactory => OracleTestStoreFactory.Instance; | ||
public TestSqlLoggerFactory TestSqlLoggerFactory => (TestSqlLoggerFactory)ServiceProvider.GetRequiredService<ILoggerFactory>(); | ||
|
||
public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) | ||
=> base.AddOptions(builder).ConfigureWarnings( | ||
c => c.Log(RelationalEventId.QueryClientEvaluationWarning)); | ||
|
||
public override bool SupportsBinaryKeys => true; | ||
|
||
public override DateTime DefaultDateTime => new DateTime(); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
samples/OracleProvider/test/OracleProvider.FunctionalTests/CustomConvertersOracleTest.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,37 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using Microsoft.EntityFrameworkCore.Diagnostics; | ||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore | ||
{ | ||
public class CustomConvertersOracleTest : CustomConvertersTestBase<CustomConvertersOracleTest.CustomConvertersOracleFixture> | ||
{ | ||
public CustomConvertersOracleTest(CustomConvertersOracleFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
public override void Can_perform_query_with_max_length() | ||
{ | ||
// Disabled--sample Oracle cannot query against large data types | ||
} | ||
|
||
public class CustomConvertersOracleFixture : CustomConvertersFixtureBase | ||
{ | ||
protected override ITestStoreFactory TestStoreFactory => OracleTestStoreFactory.Instance; | ||
|
||
public override bool SupportsBinaryKeys => true; | ||
|
||
public override DateTime DefaultDateTime => new DateTime(); | ||
|
||
public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) | ||
=> base | ||
.AddOptions(builder) | ||
.ConfigureWarnings( | ||
c => c.Log(RelationalEventId.QueryClientEvaluationWarning)); | ||
} | ||
} | ||
} |
Oops, something went wrong.