Meadow.SQLite
1.0.0
See the version list below for details.
dotnet add package Meadow.SQLite --version 1.0.0
NuGet\Install-Package Meadow.SQLite -Version 1.0.0
<PackageReference Include="Meadow.SQLite" Version="1.0.0" />
<PackageVersion Include="Meadow.SQLite" Version="1.0.0" />
<PackageReference Include="Meadow.SQLite" />
paket add Meadow.SQLite --version 1.0.0
#r "nuget: Meadow.SQLite, 1.0.0"
#:package Meadow.SQLite@1.0.0
#addin nuget:?package=Meadow.SQLite&version=1.0.0
#tool nuget:?package=Meadow.SQLite&version=1.0.0
Meadow
M<nothing>anaged/<nothing>E<nothing>nhanced<nothing>Ado<nothing>W<nothing>rapper
This library is designed to help using ado.net easier and with some good practices consistently.
Features
- It Supports MS-SqlServer, My Sql and SQLite database frameworks.
- The application would create/buildup and update database by itself after deployments.
- Your data access logic will be fully implemented in SQL language, therefore:
- You would have access to what ever feature your database framework provides with no limitations.
- Non of your data-access business would be transported to server as pure sql text
- Like Migrations in EntityFramework, each change in the database would be maintained as the project source code.
- There will be no object-tracing and each data-access operation closes the connection which helps reducing the chance of concurrency and improves performance in load peaks.
- The conversion of data to/from POCOs are internally covered so working with data is easy.
The Practice
Meadow is designed to help implementing a practice as follows:
- Design and Maintain the database, step by step, by creating build-up scripts (They would be treated like source code)
- For each data access operation, Create a Stored Procedure in a build-up script.
- For each data access operation, drive a well named request class, from
MeadowRequest
class. - Perform the request and receive the results (if any) whenever needed, using
MeadowEngine
and an instance of corresponding request.
The MeadowEngine
can take some configurations. It also performs some useful operations
for you like creating/deleting and building up the database.
- NOTE: The best practice would be to use Meadow behind your Repository Pattern implementation.
In summery
- You would use meadow for retrieving/manipulating data through the MeadowRequests
- You would use meadow for creation/deletion or building up your database (usually at the startup section of the application) via
MeadowEngine
How to Use
- Prepare your connection string, regarding your database-framework of choice. (Ms-Sql-server, MySql, SQLite)
- Setup "Build-up scripts"
- Add Meadow library to your project. (You can install the NuGet package)
- Create a MeadowRequest and it's required models To use each of your procedures in your c# code.
- Use meadow!
Build-up Scripts
Create a directory in your source codes for your build-up scripts. Directory name does not matter. Make sure this directory will be copied alongside your binaries when you build/publish your project.
ex: your-project.csproj
<ItemGroup>
<Content Include="Scripts\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
For each set of changes during the process of evolving your database, Create a script inside the build-up scripts directory. It's best to create script files, regarding you data structure changes, and in a way that i's easy to read and find where to look for scripts related to a specific part of the data base. It this sense, it would be similar to migrations in ORMs. Also try to avoid manipulating last scripts, and always create new scripts for manipulation of already existing db-objects.
- ⚠️ NOTE: MANIPULATING PREVIOUSLY ADDED SCRIPTS, WOULD REQUIRE THE DATABASE TO BE RE-CREATED WHICH IS A BIG COST FOR PRODUCTION, VERSA KEEPING THE CHANGES IN A ALWAYS FORWARDING MANNER MAKES IT SMOOTHER AND SAFER FOR PRODUCT UPDATE WITHOUT DOWN-TIME.
Each build-up script file should has .sql extension and Start with 4 digit number. The numbers would represent the files order. smaller numbers will be applied before larger numbers. (ie.: 0000_initial-database.sql or 0001-AddUserInformationTables.sql)
Creating MeadowRequests
For creating a request, you can drive from MeadowRequest
class. Its a better practice to keep your request classes under a grouped and managed directory/namespace. You can use Conventions to write minimum code. By Convention, a MeadowRequest named AbcRequest
, would be resolved for to execute a procedure named: spAbc
. If you prefer not to rely on conventions, you can provide procedure name manually by overriding the the property RequestText
in your meadow request.
Using Meadow In Your Project
Create and configure MeadowEngine
by passing a MeadowConfiguration
object to its constructor. A MeadowConfiguration object has a ConnectionString property and a BuildupScriptDirectory property which is where you save build-up scripts.
Then all you need to do is to instantiate an object of your meadow request, and call MeadowEngine.PerformRequest(request)
. Meadow creates and disposes resources per request, therefore it's not
necessary to keep the engine object. You can keep the engine object or instantiate it per request.
You can also instantiate the MeadowEngine
also by passing an object of Type IMeadowConfigurationProvider
. This would be helpful when you want to use different configurations controlled by your DI.
Examples
Meadow can be used to connect to Ms-SqlServer, My-Sql and SQLite. For each of these databases, these is an examples in the project. You can see that using Meadow is the same in each example, but the only difference is in the actual sql scripts written for each database.
ℹ️ NOTE: SQLITE, DOES NOT SUPPORT STORED PROCEDURES, AND MEADOW IS BASED ON STORED PROCEDURES. SO MEADOW DOES STORE YOUR PROCEDURES SEAMLESSLY.
When The Darkness Caresses The Meadows...[^1] (Bugs and Issues)
Meadow For Ms-SqlServer is currently being tested in my other projects, but for MySql and SQLite, It still has not being tested in practice. So Please consider dropping a mail or comment if you faced a bug or an issue. Very Thanks.
Contact
Please feel free to contact me about meadow, or any related questions.
acidmanic.moayedi@gmail.com
https://www.linkedin.com/in/mani-moayedi
https://www.instagram.com/acidmanix/
Thanks And Regards. Mani.
[^1]: IGNEA, Jahi.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Meadow.Framework (>= 1.0.1)
- Microsoft.Data.Sqlite (>= 7.0.0-preview.5.22302.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.3.0-b53 | 87 | 8/9/2024 |
1.3.0-b52 | 87 | 8/8/2024 |
1.3.0-b51 | 81 | 7/18/2024 |
1.3.0-b50 | 74 | 7/17/2024 |
1.3.0-b49 | 73 | 7/15/2024 |
1.3.0-b48 | 79 | 7/10/2024 |
1.3.0-b47 | 75 | 7/7/2024 |
1.3.0-b46 | 76 | 7/5/2024 |
1.3.0-b45 | 76 | 7/5/2024 |
1.3.0-b44 | 79 | 7/5/2024 |
1.3.0-b43 | 73 | 7/5/2024 |
1.3.0-b42 | 73 | 7/4/2024 |
1.3.0-b41 | 76 | 7/4/2024 |
1.3.0-b40 | 85 | 3/15/2024 |
1.3.0-b39 | 80 | 2/25/2024 |
1.3.0-b38 | 80 | 2/25/2024 |
1.3.0-b37 | 84 | 2/25/2024 |
1.3.0-b36 | 217 | 10/28/2023 |
1.3.0-b35 | 95 | 10/28/2023 |
1.3.0-b34 | 93 | 10/28/2023 |
1.3.0-b33 | 102 | 10/21/2023 |
1.3.0-b32 | 108 | 10/21/2023 |
1.3.0-b31 | 93 | 10/4/2023 |
1.3.0-b30 | 111 | 9/15/2023 |
1.3.0-b29 | 104 | 9/15/2023 |
1.3.0-b28 | 117 | 9/14/2023 |
1.3.0-b27 | 111 | 9/14/2023 |
1.3.0-b26 | 108 | 9/14/2023 |
1.3.0-b25 | 111 | 9/12/2023 |
1.3.0-b23 | 109 | 9/12/2023 |
1.3.0-b22 | 127 | 9/7/2023 |
1.3.0-b21 | 117 | 9/6/2023 |
1.3.0-b20 | 118 | 9/2/2023 |
1.3.0-b19 | 118 | 9/2/2023 |
1.3.0-b18 | 122 | 8/31/2023 |
1.3.0-b17 | 112 | 8/31/2023 |
1.3.0-b16 | 107 | 8/30/2023 |
1.3.0-b15 | 120 | 8/30/2023 |
1.3.0-b14 | 118 | 8/30/2023 |
1.3.0-b13 | 125 | 8/30/2023 |
1.3.0-b12 | 120 | 8/30/2023 |
1.3.0-b11 | 115 | 8/29/2023 |
1.3.0-b10 | 125 | 8/29/2023 |
1.3.0-b1 | 116 | 8/30/2023 |
1.3.0-b09 | 122 | 8/29/2023 |
1.3.0-b08 | 117 | 8/29/2023 |
1.3.0-b07 | 114 | 8/28/2023 |
1.3.0-b06 | 115 | 8/26/2023 |
1.3.0-b05 | 117 | 8/26/2023 |
1.3.0-b04 | 148 | 3/16/2023 |
1.3.0-b03 | 154 | 3/6/2023 |
1.3.0-b02 | 162 | 2/27/2023 |
1.3.0-b01 | 153 | 2/20/2023 |
1.2.0 | 248 | 10/4/2022 |
1.1.3 | 192 | 9/6/2022 |
1.1.2 | 185 | 9/5/2022 |
1.1.1 | 187 | 9/3/2022 |
1.1.0 | 194 | 8/28/2022 |
1.0.0 | 200 | 8/9/2022 |