-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #1044, revert the changes for duplicated left JOIN changes. Add…
… the regression tests. Update the version to 8.2.3 (#1045)
- Loading branch information
Showing
11 changed files
with
310 additions
and
165 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
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
96 changes: 96 additions & 0 deletions
96
test/Microsoft.AspNetCore.OData.E2E.Tests/Regressions/RegressionsController.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,96 @@ | ||
//----------------------------------------------------------------------------- | ||
// <copyright file="RegressionsController.cs" company=".NET Foundation"> | ||
// Copyright (c) .NET Foundation and Contributors. All rights reserved. | ||
// See License.txt in the project root for license information. | ||
// </copyright> | ||
//------------------------------------------------------------------------------ | ||
|
||
using System.Linq; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.OData.Query; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace Microsoft.AspNetCore.OData.E2E.Tests.Regressions | ||
{ | ||
public class UsersController : Controller | ||
{ | ||
private readonly RegressionsDbContext _dbContext; | ||
|
||
public UsersController(RegressionsDbContext dbContext) | ||
{ | ||
dbContext.Database.EnsureCreated(); | ||
_dbContext = dbContext; | ||
if (!_dbContext.Users.Any()) | ||
{ | ||
_dbContext.DataFiles.Add(new DataFile | ||
{ | ||
FileId = 1, | ||
FileName = "76x473626.pdf" | ||
}); | ||
|
||
DataFile dataFile2 = new DataFile | ||
{ | ||
FileId = 2, | ||
FileName = "uyr65euit5.pdf" | ||
}; | ||
_dbContext.DataFiles.Add(dataFile2); | ||
|
||
_dbContext.DataFiles.Add(new DataFile | ||
{ | ||
FileId = 3, | ||
FileName = "hj7x87643.pdf" | ||
}); | ||
|
||
_dbContext.Users.Add(new User | ||
{ | ||
UserId = 1, | ||
Name = "Alex", | ||
Age = 35, | ||
DataFileRef = null, | ||
Files = null | ||
}); | ||
|
||
_dbContext.Users.Add(new User | ||
{ | ||
UserId = 2, | ||
Name = "Amanda", | ||
Age = 29, | ||
DataFileRef = 2, | ||
Files = dataFile2 | ||
}); | ||
|
||
_dbContext.Users.Add(new User | ||
{ | ||
UserId = 3, | ||
Name = "Lara", | ||
Age = 25, | ||
DataFileRef = null, | ||
Files = null | ||
}); | ||
|
||
_dbContext.SaveChanges(); | ||
} | ||
} | ||
|
||
[HttpGet] | ||
[EnableQuery] | ||
public IQueryable<User> Get() | ||
{ | ||
IQueryable<User> data = _dbContext.Users.AsQueryable(); | ||
return data; | ||
} | ||
|
||
[HttpGet] | ||
[EnableQuery] | ||
public IActionResult Get(int key) | ||
{ | ||
User data = _dbContext.Users.Include(c => c.Files).FirstOrDefault(c => c.UserId == key); | ||
if (data == null) | ||
{ | ||
return NotFound(); | ||
} | ||
|
||
return Ok(data); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
test/Microsoft.AspNetCore.OData.E2E.Tests/Regressions/RegressionsDataModel.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,39 @@ | ||
//----------------------------------------------------------------------------- | ||
// <copyright file="RegressionsDataModel.cs" company=".NET Foundation"> | ||
// Copyright (c) .NET Foundation and Contributors. All rights reserved. | ||
// See License.txt in the project root for license information. | ||
// </copyright> | ||
//------------------------------------------------------------------------------ | ||
|
||
using System.ComponentModel.DataAnnotations.Schema; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace Microsoft.AspNetCore.OData.E2E.Tests.Regressions | ||
{ | ||
public class User | ||
{ | ||
[Key] | ||
public int UserId { get; set; } | ||
|
||
[Required] | ||
public string Name { get; set; } | ||
|
||
[Required] | ||
public int Age { get; set; } | ||
|
||
//Navigations | ||
[ForeignKey("Files")] | ||
public int? DataFileRef { get; set; } | ||
|
||
public virtual DataFile Files { get; set; } | ||
} | ||
|
||
public class DataFile | ||
{ | ||
[Key] | ||
public int FileId { get; set; } | ||
|
||
[Required] | ||
public string FileName { get; set; } | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
test/Microsoft.AspNetCore.OData.E2E.Tests/Regressions/RegressionsDbContext.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,23 @@ | ||
//----------------------------------------------------------------------------- | ||
// <copyright file="RegressionsDbContext.cs" company=".NET Foundation"> | ||
// Copyright (c) .NET Foundation and Contributors. All rights reserved. | ||
// See License.txt in the project root for license information. | ||
// </copyright> | ||
//------------------------------------------------------------------------------ | ||
|
||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace Microsoft.AspNetCore.OData.E2E.Tests.Regressions | ||
{ | ||
public class RegressionsDbContext : DbContext | ||
{ | ||
public RegressionsDbContext(DbContextOptions<RegressionsDbContext> options) | ||
: base(options) | ||
{ | ||
} | ||
|
||
public DbSet<User> Users { get; set; } | ||
|
||
public DbSet<DataFile> DataFiles { get; set; } | ||
} | ||
} |
Oops, something went wrong.