Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split the block into separate packages for each database #39

Closed
tsahi opened this issue Sep 28, 2020 · 5 comments
Closed

Split the block into separate packages for each database #39

tsahi opened this issue Sep 28, 2020 · 5 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@tsahi
Copy link
Collaborator

tsahi commented Sep 28, 2020

Is your feature request related to a problem? Please describe.
Today there is one big package that supports SQL Server, Oracle, and SqlCE. There is no reason people using SQL Server will take a dependency on packages supporting Oracle, and vice-versa.

Describe the solution you'd like
We should split the package to several packages, so that:

  1. One base package will carry the base functionality, e.g. the abstract Database class, the caching, etc.
  2. A SQL Server package will depend on the base package, but will also depend on Microsoft.Data.SqlClient.
  3. An Oracle package will depend on the base package, but will also depend on Oracle.ManagedDataAccess[.Core]
  4. A SqlCE package will depend on the base package. This won't bring new dependencies.
  5. A Generic (very small) package will depend on the base package, exposing the GenericDatabase for use with OldDb provider.
@tsahi tsahi added the enhancement New feature or request label Sep 28, 2020
@tsahi tsahi changed the title Split the block into sparate packages for each database Split the block into separate packages for each database Oct 4, 2020
@tsahi tsahi self-assigned this Oct 9, 2020
@tsahi
Copy link
Collaborator Author

tsahi commented Oct 9, 2020

As I see it, the root problem is at DatabaseSyntheticConfigSettings, which has references to three different Database derivatives: SqlDatabase, OracleDatabase and GenericDatabase, which is used for anything else, unless you configured a specific Database derivative. They are used in GetDefaultMapping(string), which tries to guess the right mapping based on the provider name, when a provider is not configured in the <dataConfiguration> section.

This allows users to create a database provider for SQL Server or Oracle even without mapping a provider in the configuration, just by providing a connection string name. DAAB will read the providerName attribute and return the right provider.

We can see how this works in the Data.SqlCe.Tests.VSTS project. If you look at the SqlCeDatabaseFixture test class, you can see how it registers the SqlCeDatabase with the System.Data.SqlServerCe.4.0 in code, and then passes this configuration to DatabaseProviderFactory so it can produce the right provider.

So if we split the Data project to separate projects and assemblies for each database provider, we'll have to require users to map their provider name to database provider in configuration.

@tsahi
Copy link
Collaborator Author

tsahi commented Oct 9, 2020

This is a major change, and I plan to make several PRs for it. But if I merge partial changes to master, we won't be able to make new releases (or it will become difficult). So I suggest I branch from master, update my fork, and work on it on that branch in my fork. Then, I'll make a PR from the branch on my fork to the branch in this fork. What do you think?

@tsahi tsahi added this to the 7.0 milestone Oct 10, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
register OracleDatabase in configuration.
EnterpriseLibrary#39
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 17, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 18, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 30, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 30, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 30, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Oct 30, 2020
@tsahi tsahi mentioned this issue Oct 31, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Nov 3, 2020
tsahi added a commit to tsahi/EnterpriseLibrary-data-access-application-block that referenced this issue Nov 3, 2020
tsahi added a commit that referenced this issue Nov 3, 2020
* move OracleDatabase and related code to a Data.Oracle project.
#39

* remove unused usings, reference to Oracle in XML comments
#39

* move types n OracleConfigurationExtension.cs to their own file
#39

* add reference to Data.Oracle to TestSupport project, so it compiles.
#39

* fix namespace
#39

* use nameof()
#39

* fix config section assembly name
register OracleDatabase in configuration.
#39

* fix package versioning
#39

* add a mapping of OracleDatabase to synthetic configuration.
#39

* add configuration of an oracle database provider
#39

* register OracleDatabase provider; fix assembly name for section handler.
register data provider for .net core.
#39

* map oracle database provider
#39

* add the Data.Oracle project and fix usings
#39

* add oracle database provider configuration

* add oracle database provider registration
#39

* remove reference to oracle nuget package
#39

* move common code to extension method
#39
tsahi added a commit that referenced this issue Dec 20, 2020
remove package from Data project
#39
tsahi added a commit that referenced this issue Dec 20, 2020
tsahi added a commit that referenced this issue Dec 25, 2020
tsahi added a commit that referenced this issue Dec 25, 2020
tsahi added a commit that referenced this issue Dec 25, 2020
tsahi added a commit that referenced this issue Dec 25, 2020
add reference to System.Data.Odbc NuGet package
add links to GlobalAssemblyInfo.cs and DataAccess.licenseheader
include Nuget\readme.txt
fix Data.Odbc namespace
add missing Apache 2.0 license boilerplate on original code.
#39
tsahi added a commit that referenced this issue Dec 25, 2020
tsahi added a commit that referenced this issue Dec 26, 2020
Add ODBC database provider to test config
make OdbcDatabaseData constructor publc
#39
tsahi added a commit that referenced this issue Dec 26, 2020
tsahi added a commit that referenced this issue Jan 1, 2021
replace <devdoc> with <summary>
remove trailing whitespace.
#39
@tsahi
Copy link
Collaborator Author

tsahi commented Jan 2, 2021

As you can see from the commits above, I ended up creating an OleDbDatabase and OdbcDatabase, in two separate projects/packages. This is because each of them carries it's own package dependency, depending on the target framework.

So now we have:

  • Data: common infrastructure, and the GeneralDatabase which can be used for databases not directly supported by DAAB
  • Data.SqlServer: for SQL Server support
  • Data.Oracle: for Oracle support
  • Data.SqlCe: for SQL CE support
  • Data.OleDb: for OLE DB providers support
  • Data.Odbc: for ODBC providers support.

tsahi added a commit that referenced this issue Jan 2, 2021
tsahi added a commit that referenced this issue Jan 2, 2021
tsahi added a commit that referenced this issue Jan 9, 2021
embed icon in package instead of pulling it from another package on nuget.org
#39
tsahi added a commit that referenced this issue Jan 9, 2021
tsahi added a commit that referenced this issue Jan 9, 2021
tsahi added a commit that referenced this issue Jan 9, 2021
add Enterprise Library Open Source Project as copyright owner
#39
tsahi added a commit that referenced this issue Jan 9, 2021
@tsahi
Copy link
Collaborator Author

tsahi commented Jan 9, 2021

This is essentially done. support for Microsoft.Data.SqlClient will be done at #38 .

@tsahi tsahi closed this as completed Jan 9, 2021
tsahi added a commit that referenced this issue Feb 5, 2021
@tsahi tsahi mentioned this issue Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant