-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Orm): Masa.Contrib.Data.Contracts.EFCore -> Masa.Contrib.Dat…
…a.Contracts (#346)
- Loading branch information
1 parent
4b7fe58
commit 0ceb50b
Showing
60 changed files
with
166 additions
and
212 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
11 changes: 11 additions & 0 deletions
11
src/BuildingBlocks/Data/Masa.BuildingBlocks.Data/IMasaDbContextBuilder.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,11 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.BuildingBlocks.Data; | ||
|
||
public interface IMasaDbContextBuilder | ||
{ | ||
public bool EnableSoftDelete { get; set; } | ||
|
||
public IServiceCollection Services { get; } | ||
} |
27 changes: 0 additions & 27 deletions
27
src/Contrib/Data/Contracts/Masa.Contrib.Data.Contracts.EFCore/Internal/InstanceBuilder.cs
This file was deleted.
Oops, something went wrong.
69 changes: 0 additions & 69 deletions
69
...ata/Contracts/Masa.Contrib.Data.Contracts.EFCore/MasaDbContextOptionsBuilderExtensions.cs
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
src/Contrib/Data/Contracts/Masa.Contrib.Data.Contracts.EFCore/_Imports.cs
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...tracts.EFCore/DataFiltering/DataFilter.cs → ...ata.Contracts/DataFiltering/DataFilter.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
2 changes: 1 addition & 1 deletion
2
...tracts.EFCore/Internal/DataFilterState.cs → ...ata.Contracts/Internal/DataFilterState.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
2 changes: 1 addition & 1 deletion
2
...ontracts.EFCore/Internal/DisposeAction.cs → ....Data.Contracts/Internal/DisposeAction.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
6 changes: 5 additions & 1 deletion
6
...ntracts.EFCore/Internal/NullDisposable.cs → ...Data.Contracts/Internal/NullDisposable.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
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
29 changes: 29 additions & 0 deletions
29
src/Contrib/Data/Contracts/Masa.Contrib.Data.Contracts/MasaDbContextBuilderExtensions.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,29 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
// ReSharper disable once CheckNamespace | ||
|
||
namespace Microsoft.EntityFrameworkCore; | ||
|
||
public static class MasaDbContextBuilderExtensions | ||
{ | ||
public static IMasaDbContextBuilder UseFilter( | ||
this IMasaDbContextBuilder masaDbContextBuilder, | ||
Action<FilterOptions>? options = null) | ||
=> masaDbContextBuilder.UseFilterCore(options); | ||
|
||
private static IMasaDbContextBuilder UseFilterCore( | ||
this IMasaDbContextBuilder masaDbContextBuilder, | ||
Action<FilterOptions>? options = null) | ||
{ | ||
var filterOptions = new FilterOptions(); | ||
options?.Invoke(filterOptions); | ||
|
||
masaDbContextBuilder.Services.TryAddScoped(typeof(DataFilter<>)); | ||
masaDbContextBuilder.Services.TryAddScoped<IDataFilter, DataFilter>(); | ||
|
||
masaDbContextBuilder.EnableSoftDelete = filterOptions.EnableSoftDelete; | ||
|
||
return masaDbContextBuilder; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...Contracts.EFCore/Options/FilterOptions.cs → ...b.Data.Contracts/Options/FilterOptions.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
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
12 changes: 12 additions & 0 deletions
12
src/Contrib/Data/Contracts/Masa.Contrib.Data.Contracts/_Imports.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,12 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
global using Masa.BuildingBlocks.Data; | ||
global using Masa.Contrib.Data.Contracts.DataFiltering; | ||
global using Masa.Contrib.Data.Contracts.Internal; | ||
global using Masa.Contrib.Data.Contracts.Options; | ||
global using Masa.Utils.Caching.Memory; | ||
global using Microsoft.Extensions.DependencyInjection; | ||
global using Microsoft.Extensions.DependencyInjection.Extensions; | ||
global using System.Linq.Expressions; | ||
global using System.Reflection; |
2 changes: 1 addition & 1 deletion
2
...Contracts.EFCore.Tests/CustomDbContext.cs → ...b.Data.Contracts.Tests/CustomDbContext.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
4 changes: 1 addition & 3 deletions
4
....Contracts.EFCore.Tests/DataFilterTest.cs → ...ib.Data.Contracts.Tests/DataFilterTest.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
2 changes: 1 addition & 1 deletion
2
...rations/AddressEntityTypeConfiguration.cs → ...rations/AddressEntityTypeConfiguration.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
2 changes: 1 addition & 1 deletion
2
...rations/StudentEntityTypeConfiguration.cs → ...rations/StudentEntityTypeConfiguration.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
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
2 changes: 1 addition & 1 deletion
2
....Contracts.EFCore.Tests/Models/Address.cs → ...ib.Data.Contracts.Tests/Models/Address.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
2 changes: 1 addition & 1 deletion
2
...ta.Contracts.EFCore.Tests/Models/Hobby.cs → ...trib.Data.Contracts.Tests/Models/Hobby.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
2 changes: 1 addition & 1 deletion
2
....Contracts.EFCore.Tests/Models/LogItem.cs → ...ib.Data.Contracts.Tests/Models/LogItem.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
2 changes: 1 addition & 1 deletion
2
....Contracts.EFCore.Tests/Models/Student.cs → ...ib.Data.Contracts.Tests/Models/Student.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
Oops, something went wrong.