diff --git a/README.md b/README.md
index fcb33d2..d53b0b7 100644
--- a/README.md
+++ b/README.md
@@ -1,33 +1,21 @@
-
+
-# Repositories
+
+
Repositories
+
-[![Build Status](https://dev.azure.com/dimesoftware/Utilities/_apis/build/status/dimesoftware.repository?branchName=master)](https://dev.azure.com/dimesoftware/Utilities/_build/latest?definitionId=182&branchName=master)
+Implementation of the repository pattern with Entity Framework.
-## Introduction
-
-Implementation of the repository pattern with Entity Framework (Core).
-
-## Getting Started
-
-- You must have Visual Studio 2019 Community or higher.
-- The dotnet cli is also highly recommended.
## About this project
Generic repository pattern with an implementation using Entity Framework. This project revolves around the `IRepository` interface. This interfaces defines the capabilities of a repository which - rather unsurprisingly - are simple CRUD operations.
-In addition, this project is also concerned with instantiating the repositories. Rather than accessing the repository's implementation directly, a repository factory (defined by `IRepositoryFactory`) can be used and injected into the application. Support for multi-tenancy is built-in with the `IMultiTenantRepositoryFactory` interface.
+In addition, this project is also concerned with instantiating the repositories. Rather than accessing the repository's implementation directly, a repository factory (defined by `IRepositoryFactory`) can be used and injected into the application.
The projects in the `Providers` folder provide the implementation of the contracts defined in the Dime.Repositories assembly.
-## Build and Test
-
-- Run dotnet restore
-- Run dotnet build
-- Run dotnet test
-
-## Installation
+## Getting started
Use the package manager NuGet to install Dime.Repositories:
@@ -39,55 +27,33 @@ Here's a simple example which demonstrates the usage of the repository.
``` csharp
using Dime.Repositories;
-...
public class CustomerService
{
- private readonly IRepositoryFactory _repositoryFactory;
-
- public CustomerService(IRepositoryFactory repositoryFactory)
+ private readonly IRepository _repository;
+ public CustomerService(IRepository repository)
{
- _repositoryFactory = repositoryFactory;
+ _repository = repository;
}
public async IEnumerable GetCustomers()
- {
- using IRepository customerRepository = _repositoryFactory.Create();
- return await customerRepository.FindAllAsync(x => x.IsActive == true);
- }
+ => await _repository_.FindAllAsync(x => x.IsActive == true);
}
```
-This is an example of the dependency injection registration in Unity:
+## Build and Test
-```csharp
-public sealed class UnityConfig
-{
- public static void RegisterTypes(IUnityContainer container)
- {
- container.RegisterType>(
- new PerRequestOrTransientLifeTimeManager(),
- new InjectionConstructor(new MyDbContextEfContextFactory()));
- }
-}
+To run the solution, you will need:
-public class MyDbContextEfContextFactory : MultiTenantContextFactory
-{
- ...
-
- protected override SchedulerContext ConstructContext()
- {
- MyDbContext ctx = new MyDbContext();
- ctx.Configuration.ProxyCreationEnabled = false;
- ctx.Configuration.LazyLoadingEnabled = false;
- ctx.Configuration.AutoDetectChangesEnabled = false;
- ctx.Configuration.UseDatabaseNullSemantics = true;
- ctx.Database.CommandTimeout = 60;
- return ctx;
- }
-}
-```
+- You must have Visual Studio 2022 Community or higher.
+- The dotnet cli is also highly recommended.
+
+To run the tests, you can use the trustee dotnet cli commands:
+- Run dotnet restore
+- Run dotnet build
+- Run dotnet test
+
## Contributing
![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)
diff --git a/assets/db.svg b/assets/db.svg
deleted file mode 100644
index ad486de..0000000
--- a/assets/db.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/assets/logo.png b/assets/logo.png
new file mode 100644
index 0000000..6b236fa
Binary files /dev/null and b/assets/logo.png differ
diff --git a/azure-pipelines.yaml b/azure-pipelines.yaml
deleted file mode 100644
index 5ec55e0..0000000
--- a/azure-pipelines.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
-trigger:
- - master
-
-pool:
- vmImage: windows-latest
-
-variables:
- BuildConfiguration: 'Release'
-
-steps:
-- task: DotNetCoreCLI@2
- displayName: Restore
- inputs:
- command: restore
- projects: '**/*.csproj'
-
-- task: DotNetCoreCLI@2
- displayName: Build
- inputs:
- projects: '**/*.csproj'
- arguments: '--configuration $(BuildConfiguration)'
-
-- task: DotNetCoreCLI@2
- displayName: Test
- inputs:
- command: test
- projects: '**/*.csproj'
- arguments: '--configuration $(BuildConfiguration) --collect "Code coverage" -s "src/test.runsettings"'
\ No newline at end of file
diff --git a/src/Dime.Repositories.sln b/src/Dime.Repositories.sln
index 42628a5..0d2e866 100644
--- a/src/Dime.Repositories.sln
+++ b/src/Dime.Repositories.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30011.22
+# Visual Studio Version 17
+VisualStudioVersion = 17.7.34031.279
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dime.Repositories", "core\Dime.Repositories\Dime.Repositories.csproj", "{72A74CEB-EC06-43A8-85C2-E4CFDA8DFCE9}"
EndProject
@@ -9,23 +9,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{F753A01F
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dime.Repositories.Sql", "core\Dime.Repositories.Sql\Dime.Repositories.Sql.csproj", "{0FB51C4F-7198-40CF-8442-9A09BF016C42}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dime.Repositories.Sql.EntityFramework.NetCore", "providers\EntityFramework.NetCore\Dime.Repositories.Sql.EntityFramework.NetCore.csproj", "{B501E673-CC10-4BFF-A086-CFF1DF482816}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dime.Repositories.Sql.EntityFramework", "providers\EntityFramework\Dime.Repositories.Sql.EntityFramework.csproj", "{B501E673-CC10-4BFF-A086-CFF1DF482816}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dime.Repositories.Sql.EntityFramework.NetFramework", "providers\EntityFramework.NetFramework\Dime.Repositories.Sql.EntityFramework.NetFramework.csproj", "{4536C116-0C7B-40AD-A2FC-3ED6D0EB1149}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dime.Repositories.Sql.EntityFramework.NetCore.Tests", "test\Dime.Repositories.Sql.EntityFramework.NetCore.Tests\Dime.Repositories.Sql.EntityFramework.NetCore.Tests.csproj", "{4C40805D-D4F3-4D49-B2C4-F464FE4CD833}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dime.Repositories.Sql.EntityFramework.Tests", "test\Dime.Repositories.Sql.EntityFramework.Tests\Dime.Repositories.Sql.EntityFramework.Tests.csproj", "{4C40805D-D4F3-4D49-B2C4-F464FE4CD833}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "providers", "providers", "{BF5B6AB2-33CF-494B-9D49-1A00ACF42729}"
EndProject
-Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Dime.Repositories.Sql.EntityFramework.Shared", "providers\EntityFramework.Shared\Dime.Repositories.Sql.EntityFramework.Shared.shproj", "{E2C7ADE6-23D8-4897-A156-05DCD901E2D0}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dime.Repositories.Sql.EntityFramework.NetFramework.Tests", "test\Dime.Repositories.Sql.EntityFramework.NetFramework.Tests\Dime.Repositories.Sql.EntityFramework.NetFramework.Tests.csproj", "{719B5ACC-8EA5-47B7-A8DA-B54A47E5ACA4}"
-EndProject
Global
- GlobalSection(SharedMSBuildProjectFiles) = preSolution
- providers\EntityFramework.Shared\Dime.Repositories.Sql.EntityFramework.Shared.projitems*{b501e673-cc10-4bff-a086-cff1df482816}*SharedItemsImports = 5
- providers\EntityFramework.Shared\Dime.Repositories.Sql.EntityFramework.Shared.projitems*{e2c7ade6-23d8-4897-a156-05dcd901e2d0}*SharedItemsImports = 13
- EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
@@ -43,28 +33,17 @@ Global
{B501E673-CC10-4BFF-A086-CFF1DF482816}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B501E673-CC10-4BFF-A086-CFF1DF482816}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B501E673-CC10-4BFF-A086-CFF1DF482816}.Release|Any CPU.Build.0 = Release|Any CPU
- {4536C116-0C7B-40AD-A2FC-3ED6D0EB1149}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4536C116-0C7B-40AD-A2FC-3ED6D0EB1149}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4536C116-0C7B-40AD-A2FC-3ED6D0EB1149}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4536C116-0C7B-40AD-A2FC-3ED6D0EB1149}.Release|Any CPU.Build.0 = Release|Any CPU
{4C40805D-D4F3-4D49-B2C4-F464FE4CD833}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4C40805D-D4F3-4D49-B2C4-F464FE4CD833}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C40805D-D4F3-4D49-B2C4-F464FE4CD833}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C40805D-D4F3-4D49-B2C4-F464FE4CD833}.Release|Any CPU.Build.0 = Release|Any CPU
- {719B5ACC-8EA5-47B7-A8DA-B54A47E5ACA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {719B5ACC-8EA5-47B7-A8DA-B54A47E5ACA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {719B5ACC-8EA5-47B7-A8DA-B54A47E5ACA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {719B5ACC-8EA5-47B7-A8DA-B54A47E5ACA4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{B501E673-CC10-4BFF-A086-CFF1DF482816} = {BF5B6AB2-33CF-494B-9D49-1A00ACF42729}
- {4536C116-0C7B-40AD-A2FC-3ED6D0EB1149} = {BF5B6AB2-33CF-494B-9D49-1A00ACF42729}
{4C40805D-D4F3-4D49-B2C4-F464FE4CD833} = {F753A01F-2E0C-4036-9DEF-6047253255D2}
- {E2C7ADE6-23D8-4897-A156-05DCD901E2D0} = {BF5B6AB2-33CF-494B-9D49-1A00ACF42729}
- {719B5ACC-8EA5-47B7-A8DA-B54A47E5ACA4} = {F753A01F-2E0C-4036-9DEF-6047253255D2}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EFEF8275-DA5B-4493-8BB7-32E760B05267}
diff --git a/src/Dime.Repositories.sln.DotSettings.user b/src/Dime.Repositories.sln.DotSettings.user
deleted file mode 100644
index 1d8a50f..0000000
--- a/src/Dime.Repositories.sln.DotSettings.user
+++ /dev/null
@@ -1,20 +0,0 @@
-
- C:\Users\hendr\AppData\Local\Temp\JetBrains\ReSharperPlatformVs16\vAny_16eaa788\CoverageData\_Dime.Repositories.288376933\Snapshot\snapshot.utdcvr
- <SessionState ContinuousTestingMode="0" IsActive="True" Name="Repository_Count_NoPredicate_ShouldCountAll #4" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
- <Solution />
-</SessionState>
- <SessionState ContinuousTestingMode="0" Name="Repository_Count_NoPredicate_ShouldCountAll #3" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
- <TestAncestor>
- <TestId>MSTest::4C40805D-D4F3-4D49-B2C4-F464FE4CD833::.NETCoreApp,Version=v3.1::Dime.Repositories.Sql.EntityFramework.NetCore.Tests.RepositoryTests.Repository_Count_NoPredicate_ShouldCountAll</TestId>
- </TestAncestor>
-</SessionState>
- <SessionState ContinuousTestingMode="0" Name="Repository_Count_NoPredicate_ShouldCountAll #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
- <TestAncestor>
- <TestId>MSTest::4C40805D-D4F3-4D49-B2C4-F464FE4CD833::.NETCoreApp,Version=v3.1::Dime.Repositories.Sql.EntityFramework.NetCore.Tests.RepositoryTests.Repository_Count_NoPredicate_ShouldCountAll</TestId>
- </TestAncestor>
-</SessionState>
- <SessionState ContinuousTestingMode="0" Name="Repository_Count_NoPredicate_ShouldCountAll" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
- <TestAncestor>
- <TestId>MSTest::4C40805D-D4F3-4D49-B2C4-F464FE4CD833::.NETCoreApp,Version=v3.1::Dime.Repositories.Sql.EntityFramework.NetCore.Tests.RepositoryTests.Repository_Count_NoPredicate_ShouldCountAll</TestId>
- </TestAncestor>
-</SessionState>
\ No newline at end of file
diff --git a/src/NuGet.Config b/src/NuGet.Config
deleted file mode 100644
index 3f0e003..0000000
--- a/src/NuGet.Config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/core/Dime.Repositories.Sql/Dime.Repositories.Sql.csproj b/src/core/Dime.Repositories.Sql/Dime.Repositories.Sql.csproj
index 3ac1eaf..227acf9 100644
--- a/src/core/Dime.Repositories.Sql/Dime.Repositories.Sql.csproj
+++ b/src/core/Dime.Repositories.Sql/Dime.Repositories.Sql.csproj
@@ -5,9 +5,9 @@
2.0.0.0
2.0.0.0
Dime Software
- 2.0.0.0-alpha.38
+ 2.0.0.0
Dime Software
- net461;net7.0
+ net8.0
Dime.Repositories.Sql
Dime.Repositories.Sql
https://cdn.dime-software.com/dime-software/logo-shape.png
@@ -19,7 +19,7 @@
Repository contracts with support for SQL databases
True
True
- Copyright © 2022
+ Copyright © 2023
https://github.com/dimesoftware/repository
https://github.com/dimesoftware/repository
@@ -31,17 +31,7 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
-
diff --git a/src/core/Dime.Repositories.Sql/IStoredProcedureRepository.cs b/src/core/Dime.Repositories.Sql/IStoredProcedureRepository.cs
index c13f3ba..50d45a9 100644
--- a/src/core/Dime.Repositories.Sql/IStoredProcedureRepository.cs
+++ b/src/core/Dime.Repositories.Sql/IStoredProcedureRepository.cs
@@ -1,16 +1,7 @@
using System.Collections.Generic;
using System.Data.Common;
-
-#if NET461
-
-using System.Data.SqlClient;
-
-#else
-
using Microsoft.Data.SqlClient;
-#endif
-
namespace Dime.Repositories
{
public interface IStoredProcedureRepository
diff --git a/src/core/Dime.Repositories/Dime.Repositories.csproj b/src/core/Dime.Repositories/Dime.Repositories.csproj
index fe07a13..00a0a6a 100644
--- a/src/core/Dime.Repositories/Dime.Repositories.csproj
+++ b/src/core/Dime.Repositories/Dime.Repositories.csproj
@@ -4,8 +4,8 @@
2.0.0.0
2.0.0.0
Dime Software
- 2.0.0.0-alpha.48
- net461;net7.0
+ 2.0.0.0
+ net8.0
Dime.Repositories
Dime.Repositories
https://cdn.dime-software.com/dime-software/logo-shape.png
@@ -17,7 +17,7 @@
true
True
True
- Copyright © 2022
+ Copyright © 2023
https://github.com/dimesoftware/repository
https://github.com/dimesoftware/repository
git
@@ -25,9 +25,4 @@
MIT
-
-
-
-
-
diff --git a/src/core/Dime.Repositories/Models/Order.cs b/src/core/Dime.Repositories/Models/Order.cs
index 4ac5650..686fc56 100644
--- a/src/core/Dime.Repositories/Models/Order.cs
+++ b/src/core/Dime.Repositories/Models/Order.cs
@@ -1,9 +1,5 @@
namespace Dime.Repositories
{
- ///
- ///
- ///
- ///
public class Order : IOrder
{
public Order(string property, bool isAscending)
@@ -12,14 +8,8 @@ public Order(string property, bool isAscending)
IsAscending = isAscending;
}
- ///
- /// Gets or sets the sorting property
- ///
public string Property { get; set; }
- ///
- /// Gets or sets the sorting direction
- ///
public bool IsAscending { get; set; }
public void Deconstruct(out string property, out bool isAscending)
diff --git a/src/core/Dime.Repositories/Models/Page.cs b/src/core/Dime.Repositories/Models/Page.cs
index b47c761..d8c75d4 100644
--- a/src/core/Dime.Repositories/Models/Page.cs
+++ b/src/core/Dime.Repositories/Models/Page.cs
@@ -4,84 +4,43 @@
namespace Dime.Repositories
{
- ///
- ///
- ///
- ///
[KnownType(typeof(Page<>))]
public class Page : IPage
{
- ///
- /// Default constructor
- ///
public Page()
{
}
- ///
- ///
- ///
- ///
public Page(IEnumerable data)
{
Data = data;
Summary = new List();
}
- ///
- ///
- ///
- ///
- ///
public Page(IEnumerable data, int total)
: this(data)
{
Total = total;
}
- ///
- ///
- ///
- ///
- ///
- ///
public Page(IEnumerable data, int total, string message)
: this(data, total)
{
Message = message;
}
- ///
- ///
- ///
- ///
- ///
- ///
- ///
public Page(IEnumerable data, int total, string message, IEnumerable summary)
: this(data, total, message)
{
Summary = summary != null ? summary.ToList() : new List();
}
- ///
- ///
- ///
public IEnumerable Data { get; set; }
- ///
- ///
- ///
public int Total { get; set; }
- ///
- ///
- ///
public string Message { get; set; }
- ///
- ///
- ///
public List Summary { get; }
}
}
\ No newline at end of file
diff --git a/src/providers/EntityFramework.NetFramework/Configuration/RepositoryConfiguration.cs b/src/providers/EntityFramework.NetFramework/Configuration/RepositoryConfiguration.cs
deleted file mode 100644
index d58c617..0000000
--- a/src/providers/EntityFramework.NetFramework/Configuration/RepositoryConfiguration.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-namespace Dime.Repositories
-{
- ///
- /// Represents a repository configuration object
- ///
- public class RepositoryConfiguration
- {
- ///
- /// Gets or sets the identifier of the tenant
- ///
- public string Tenant { get; set; }
-
- ///
- /// Gets or sets the database connection
- ///
- public string Connection { get; set; }
-
- ///
- /// Gets or sets the flag to indicate whether to leverage the UOW pattern and save in batch
- ///
- public bool SaveInBatch { get; set; }
-
- ///
- /// Gets or sets the database save strategy
- ///
- public ConcurrencyStrategy SaveStrategy { get; set; }
-
- ///
- /// Gets or sets the flag to indicate whether to leverage the caching mechanism
- ///
- public bool Cached { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/providers/EntityFramework.NetFramework/DbContext Factory/CachedNamedDbContextFactory.cs b/src/providers/EntityFramework.NetFramework/DbContext Factory/CachedNamedDbContextFactory.cs
deleted file mode 100644
index 1c9ce86..0000000
--- a/src/providers/EntityFramework.NetFramework/DbContext Factory/CachedNamedDbContextFactory.cs
+++ /dev/null
@@ -1,121 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Data.Common;
-using System.Data.Entity;
-using System.Data.Entity.Infrastructure;
-using System.Diagnostics.CodeAnalysis;
-
-namespace Dime.Repositories
-{
- ///
- ///
- ///
- ///
- [ExcludeFromCodeCoverage]
- public abstract class CachedNamedDbContextFactory : INamedDbContextFactory where TContext : DbContext
- {
- ///
- /// Initializes a new instance of the class
- ///
- protected CachedNamedDbContextFactory()
- {
- }
-
- ///
- /// Initializes a new instance of the class
- ///
- /// The connection string
- protected CachedNamedDbContextFactory(string connectionString) : this()
- {
- Connection = connectionString;
- }
-
- ///
- ///
- ///
- ///
- ///
- protected CachedNamedDbContextFactory(string connectionString, string tenant) : this(connectionString)
- {
- Tenant = tenant;
- }
-
- protected static ConcurrentDictionary, DbCompiledModel> ModelCache = new();
- protected static ConcurrentDictionary, DbCompiledModel> NamedModelCache = new();
-
- protected string Connection { get; }
- protected string Tenant { get; }
-
- ///
- /// Creates the instance of with the default settings
- ///
- ///
- public virtual TContext Create()
- => !string.IsNullOrEmpty(Tenant) && !string.IsNullOrEmpty(Connection) ?
- Create(Tenant, Connection) :
- Create("dbo", Connection);
-
- ///
- /// Creates the specified connection.
- ///
- /// The connection.
- ///
- public virtual TContext Create(string nameOrConnectionString) => Create("dbo", nameOrConnectionString);
-
- ///
- /// Creates the specified tenant.
- ///
- /// The tenant.
- /// The connection.
- ///
- ///
- public virtual TContext Create(string tenant, string connection, string context)
- {
- if (string.IsNullOrEmpty(context))
- return Create(tenant, connection);
-
- SqlConnectionFactory connectionFactory = new();
- DbConnection dbConnection = connectionFactory.CreateConnection(connection);
- Database.SetInitializer(null);
-
- DbCompiledModel compiledModel = NamedModelCache.GetOrAdd(
- Tuple.Create(tenant, dbConnection.ConnectionString, context),
- _ => GetContextModel(dbConnection, tenant));
-
- return ConstructContext(dbConnection, compiledModel, false);
- }
-
- ///
- /// Creates the specified tenant.
- ///
- /// The tenant.
- /// The connection.
- ///
- public virtual TContext Create(string tenant, string nameOrConnectionString)
- {
- SqlConnectionFactory connectionFactory = new();
- DbConnection dbConnection = connectionFactory.CreateConnection(nameOrConnectionString);
- Database.SetInitializer(null);
-
- DbCompiledModel compiledModel = ModelCache.GetOrAdd(
- Tuple.Create(tenant, dbConnection.ConnectionString),
- _ => GetContextModel(dbConnection, tenant));
-
- return ConstructContext(dbConnection, compiledModel, false);
- }
-
- ///
- /// Constructs the context.
- ///
- ///
- protected abstract TContext ConstructContext(DbConnection existingConnection, DbCompiledModel model, bool contextOwnsConnection);
-
- ///
- /// Gets the scheduler context model.
- ///
- /// The database connection.
- ///
- ///
- protected abstract DbCompiledModel GetContextModel(DbConnection dbConnection, string schema);
- }
-}
\ No newline at end of file
diff --git a/src/providers/EntityFramework.NetFramework/DbContext Factory/INamedDbContextFactory.cs b/src/providers/EntityFramework.NetFramework/DbContext Factory/INamedDbContextFactory.cs
deleted file mode 100644
index f20fde3..0000000
--- a/src/providers/EntityFramework.NetFramework/DbContext Factory/INamedDbContextFactory.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System.Data.Entity;
-using System.Data.Entity.Infrastructure;
-
-namespace Dime.Repositories
-{
- ///
- /// Entity Framework context factory
- ///
- ///
- public interface INamedDbContextFactory : IDbContextFactory where TContext : DbContext
- {
- ///
- /// Creates the context by name
- ///
- /// The name
- /// The instantiated context
- TContext Create(string nameOrConnectionString);
- }
-}
\ No newline at end of file
diff --git a/src/providers/EntityFramework.NetFramework/Dime.Repositories.Sql.EntityFramework.NetFramework.csproj b/src/providers/EntityFramework.NetFramework/Dime.Repositories.Sql.EntityFramework.NetFramework.csproj
deleted file mode 100644
index 08a0c24..0000000
--- a/src/providers/EntityFramework.NetFramework/Dime.Repositories.Sql.EntityFramework.NetFramework.csproj
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
- Dime.Repositories.Sql.EntityFramework.NetFramework
- Dime.Repositories.Sql.EntityFramework.NetFramework
- net7.0;net461
- Dime.Repositories.Sql.EntityFramework.NetFramework
- Dime Software
- Dime.Repositories.Sql.EntityFramework.NetFramework
- en
- Implementation of the repository pattern with Entity Framework
- Copyright © 2021
- 2.0.0.0-alpha.45
- 2.0.0.0
- 2.0.0.0
- latest
- Dime Software
- https://cdn.dime-software.com/dime-software/logo-shape.png
- https://github.com/dimesoftware/repository
- https://github.com/dimesoftware/repository
- Dime.Scheduler
- true
- MIT
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/providers/EntityFramework.NetFramework/Exceptions/ConcurrencyException.cs b/src/providers/EntityFramework.NetFramework/Exceptions/ConcurrencyException.cs
deleted file mode 100644
index 902a14b..0000000
--- a/src/providers/EntityFramework.NetFramework/Exceptions/ConcurrencyException.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.Serialization;
-
-namespace Dime.Repositories
-{
- [Serializable]
- [Obsolete("Use shared project")]
- [ExcludeFromCodeCoverage]
- public class ConcurrencyException : Exception
- {
- public ConcurrencyException()
- {
- }
-
- public ConcurrencyException(string message) : base(message)
- {
- }
-
- public ConcurrencyException(string message, Exception innerException) : base(message, innerException)
- {
- }
-
- protected ConcurrencyException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/providers/EntityFramework.NetFramework/Exceptions/ConstraintViolationException.cs b/src/providers/EntityFramework.NetFramework/Exceptions/ConstraintViolationException.cs
deleted file mode 100644
index 0a7ed95..0000000
--- a/src/providers/EntityFramework.NetFramework/Exceptions/ConstraintViolationException.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.Serialization;
-
-namespace Dime.Repositories
-{
- ///
- /// Exception to indicate an error with constraints such as PK and FK
- ///
- [Serializable]
- [Obsolete("Use shared project")]
- [ExcludeFromCodeCoverage]
- public class ConstraintViolationException : Exception
- {
- ///
- /// Default constructor
- ///
- public ConstraintViolationException()
- {
- }
-
- ///
- /// Constructor accepting the message
- ///
- /// The exception message
- public ConstraintViolationException(string message) : base(message)
- {
- }
-
- ///
- ///
- ///
- /// The exception message
- /// The exception that was caught
- public ConstraintViolationException(string message, Exception innerException) : base(message, innerException)
- {
- }
-
- ///
- ///
- ///
- /// SerializationInfo for the exception
- /// The Streaming Context
- protected ConstraintViolationException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/providers/EntityFramework.NetFramework/Exceptions/DatabaseAccessException.cs b/src/providers/EntityFramework.NetFramework/Exceptions/DatabaseAccessException.cs
deleted file mode 100644
index fca3e69..0000000
--- a/src/providers/EntityFramework.NetFramework/Exceptions/DatabaseAccessException.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.Serialization;
-
-namespace Dime.Repositories
-{
- ///
- /// Exception to indicate a general error with the database
- ///
- [Serializable]
- [Obsolete("Use shared project")]
- [ExcludeFromCodeCoverage]
- public class DatabaseAccessException : Exception
- {
- ///
- /// Initializes a new instance of the System.Exception class.
- ///
- public DatabaseAccessException()
- {
- }
-
- ///
- /// Initializes a new instance of the System.Exception class with a specified error message
- ///
- /// The error message that explains the reason for the exception.
- public DatabaseAccessException(string message)
- : base(message)
- {
- }
-
- ///
- /// Initializes a new instance of the System.Exception class with a specified error
- /// message and a reference to the inner exception that is the cause of this exception.
- ///
- /// The error message that explains the reason for the exception.
- /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.
- public DatabaseAccessException(string message, Exception innerException)
- : base(message, innerException)
- {
- }
-
- ///
- /// Initializes a new instance of the System.Exception class with a specified error
- /// message and a reference to the inner exception that is the cause of this exception.
- ///
- /// SerializationInfo for the exception
- /// The Streaming Context
- protected DatabaseAccessException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/providers/EntityFramework.NetFramework/Model Builder/DbContextModelBuilder.cs b/src/providers/EntityFramework.NetFramework/Model Builder/DbContextModelBuilder.cs
deleted file mode 100644
index d5dbc82..0000000
--- a/src/providers/EntityFramework.NetFramework/Model Builder/DbContextModelBuilder.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-using System.Data.Entity;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Reflection;
-
-namespace Dime.Repositories
-{
- ///
- ///
- ///
- [ExcludeFromCodeCoverage]
- public static class DbContextModelBuilder
- {
- ///
- ///
- ///
- ///
- ///
- public static void BuildModel(this DbModelBuilder modelBuilder, string schema) where T : DbContext
- {
- Type foundType = Assembly.GetCallingAssembly()
- .GetTypes()
- .FirstOrDefault(x => typeof(IModelBuilder).IsAssignableFrom(x) && !x.IsAbstract && !x.IsInterface);
-
- if (foundType == null)
- throw new ArgumentException("No model builder found for context in assembly {0}", Assembly.GetCallingAssembly().FullName);
-
- object o = Activator.CreateInstance(foundType);
- IModelBuilder concreteModelBuilder = (IModelBuilder)o;
- concreteModelBuilder.BuildContext(modelBuilder, schema);
- }
- }
-}
\ No newline at end of file
diff --git a/src/providers/EntityFramework.NetFramework/Model Builder/IModelBuilder.cs b/src/providers/EntityFramework.NetFramework/Model Builder/IModelBuilder.cs
deleted file mode 100644
index 51a7685..0000000
--- a/src/providers/EntityFramework.NetFramework/Model Builder/IModelBuilder.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System.Data.Entity;
-
-namespace Dime.Repositories
-{
- ///
- /// Represents a model builder for
- ///
- /// The db context type
- public interface IModelBuilder where T : DbContext
- {
- ///
- /// Builds the default context
- ///
- /// The code first model builder
- void BuildContext(DbModelBuilder builder);
-
- ///
- /// Builds the context for a schema other than the default dbo schema
- ///
- /// The code first model builder
- /// The schema name
- void BuildContext(DbModelBuilder builder, string schema);
- }
-}
\ No newline at end of file
diff --git a/src/providers/EntityFramework.NetFramework/Repository/Async/CreateRepositoryAsync.cs b/src/providers/EntityFramework.NetFramework/Repository/Async/CreateRepositoryAsync.cs
deleted file mode 100644
index 2a46f51..0000000
--- a/src/providers/EntityFramework.NetFramework/Repository/Async/CreateRepositoryAsync.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Data.Entity;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Threading.Tasks;
-
-namespace Dime.Repositories
-{
- public partial class EfRepository
- {
- public virtual async Task CreateAsync(TEntity entity)
- {
- using TContext ctx = Context;
- ctx.Entry(entity).State = EntityState.Added;
- TEntity createdItem = ctx.Set().Add(entity);
- await SaveChangesAsync(ctx);
-
- return createdItem;
- }
-
- public virtual async Task CreateAsync(TEntity entity, Expression> condition)
- {
- using TContext ctx = Context;
- ctx.Entry(entity).State = EntityState.Added;
- TEntity createdItem = ctx.Set().AddIfNotExists(entity, condition);
- await SaveChangesAsync(ctx);
-
- return createdItem;
- }
-
- public virtual async Task CreateAsync(TEntity entity, Func beforeSaveAction)
- {
- using TContext ctx = Context;
-
- await beforeSaveAction(entity, ctx);
-
- ctx.Entry(entity).State = EntityState.Added;
- TEntity createdItem = ctx.Set().Add(entity);
- await SaveChangesAsync(ctx);
-
- return createdItem;
- }
-
- public virtual async Task CreateAsync(TEntity entity, bool commit)
- {
- using TContext ctx = Context;
- ctx.Entry(entity).State = EntityState.Added;
- TEntity createdItem = ctx.Set().Add(entity);
-
- if (commit)
- await SaveChangesAsync(ctx);
-
- return createdItem;
- }
-
- public virtual async Task> CreateAsync(IQueryable entities)
- {
- if (!entities.Any())
- return entities;
-
- List newEntities = new();
-
- using TContext ctx = Context;
- foreach (TEntity entity in entities.ToList())
- {
- ctx.Entry(entity).State = EntityState.Added;
- TEntity newEntity = ctx.Set().Add(entity);
- newEntities.Add(newEntity);
- }
-
- await SaveChangesAsync(ctx);
-
- return newEntities.AsQueryable();
- }
- }
-}
\ No newline at end of file
diff --git a/src/providers/EntityFramework.NetFramework/Repository/Async/DeleteRepositoryAsync.cs b/src/providers/EntityFramework.NetFramework/Repository/Async/DeleteRepositoryAsync.cs
deleted file mode 100644
index 5d45e6d..0000000
--- a/src/providers/EntityFramework.NetFramework/Repository/Async/DeleteRepositoryAsync.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Data.Entity;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Threading.Tasks;
-
-namespace Dime.Repositories
-{
- public partial class EfRepository
- {
- public virtual async Task DeleteAsync(object? id)
- {
- using TContext ctx = Context;
- TEntity item = await ctx.Set().FindAsync(id);
- if (item != default(TEntity))
- {
- ctx.Set().Remove(item);
- await SaveChangesAsync(ctx);
- }
- }
-
- public virtual async Task DeleteAsync(IEnumerable