Skip to content

Commit

Permalink
Preliminary WIP on dotnet#30630
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Jul 12, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 8eed073 commit 99a882b
Showing 2 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -79,11 +79,6 @@ public virtual Task Array_of_enum()

private enum MyEnum { Label1, Label2 }

// This ensures that collections of Geometry (e.g. Geometry[]) aren't mapped; NTS has GeometryCollection for that.
// See SQL Server/SQLite for a sample implementation.
[ConditionalFact] // #30630
public abstract Task Array_of_geometry_is_not_supported();

[ConditionalFact]
public virtual async Task Array_of_array_is_not_supported()
{
@@ -213,12 +208,16 @@ public virtual async Task Inline_collection_in_query_filter()
protected async Task TestArray<TElement>(
TElement value1,
TElement value2,
Action<ModelBuilder> onModelCreating = null)
Action<ModelBuilder> onModelCreating = null,
Action<DbContextOptionsBuilder> onConfiguring = null,
Action<IServiceCollection> addServices = null)
{
var arrayClrType = typeof(TElement).MakeArrayType();

var contextFactory = await InitializeAsync<TestContext>(
onModelCreating: onModelCreating ?? (mb => mb.Entity<TestEntity>().Property(arrayClrType, "SomeArray")),
onConfiguring: onConfiguring,
addServices: addServices,
seed: context =>
{
var instance1 = new TestEntity { Id = 1 };
Original file line number Diff line number Diff line change
@@ -241,17 +241,12 @@ FROM OPENJSON([t].[SomeArray]) WITH ([value] int '$') AS [s]
""");
}

[ConditionalFact] // #30630
public override async Task Array_of_geometry_is_not_supported()
{
var exception = await Assert.ThrowsAsync<InvalidOperationException>(
() => InitializeAsync<TestContext>(
onConfiguring: options => options.UseSqlServer(o => o.UseNetTopologySuite()),
addServices: s => s.AddEntityFrameworkSqlServerNetTopologySuite(),
onModelCreating: mb => mb.Entity<TestEntity>().Property<Point[]>("Points")));

Assert.Equal(CoreStrings.PropertyNotMapped("Point[]", "TestEntity", "Points"), exception.Message);
}
[ConditionalFact]
public virtual Task Array_of_geometry()
=> TestArray(
new Point(1, 2), new Point(2, 3),
onConfiguring: options => options.UseSqlServer(o => o.UseNetTopologySuite()),
addServices: s => s.AddEntityFrameworkSqlServerNetTopologySuite());

[ConditionalFact]
public override Task Array_of_array_is_not_supported()

0 comments on commit 99a882b

Please sign in to comment.