TinyDal 1.0.0
See the version list below for details.
dotnet add package TinyDal --version 1.0.0
NuGet\Install-Package TinyDal -Version 1.0.0
<PackageReference Include="TinyDal" Version="1.0.0" />
<PackageVersion Include="TinyDal" Version="1.0.0" />
<PackageReference Include="TinyDal" />
paket add TinyDal --version 1.0.0
#r "nuget: TinyDal, 1.0.0"
#:package TinyDal@1.0.0
#addin nuget:?package=TinyDal&version=1.0.0
#tool nuget:?package=TinyDal&version=1.0.0
TinyDal
TinyDal is a lightweight and minimal abstraction over ORMs. It provides a convenient abstraction over it.
Usage:
// for some use cases see also the tests project in the solution
private class MyEntity : MultiTenantEntity
{
public override long TenantId { get; set; }
public override bool IsDeleted { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public override long Id { get; set; }
public string Name { get; set; }
}
private class MyEntityRepository : EFBaseRepository<MyEntity>
{
public MyEntityRepository (long? tenantId, DbContext context) : base(tenantId, context)
{
}
public void QueryRaw(string sql) //custom raw query here if you want
{
base.ExecuteRaw(sql);
}
}
private class MyDataContext : EFBaseDataContext
{
private DbSet<MyEntity> MyEntities { get; set; }
public MyEntityRepository MyEntityRepository { get; private set; }
public MyDataContext(DbContextOptions options,
long? tenantId,
IsolationLevel isolationLevel = IsolationLevel.ReadCommitted)
: base(options, tenantId, isolationLevel)
{
this.MyEntityRepository = new MyEntityRepository(tenantId, this);
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<MyEntity>().ToTable("MyEntities");
}
}
//
// Main
//
private MyDataContext BuildDataContext(string connectionString)
{
var optionsBuilder = new DbContextOptionsBuilder<MyDataContext>();
optionsBuilder.UseSqlServer(connectionString);
return new MyDataContext(optionsBuilder.Options, 1);
}
string connectionString = @"Server=(localdb)\dev;Database=TinyDalTestDb;Integrated security=True;";
using (var dataContext = this.BuildDataContext(connectionString))
{
dataContext.MyEntityRepository.Insert(new MyEntity
{
//Id = 1,
Name = "Name"
});
dataContext.Save();
dataContext.Commit();
}
Features
Some implemented features:
- Lightweight abstraction
- Soft-delete management
- Multi-tenant entity management
For the feature usage see the test project.
Todos
- NHibernate implementation
- Dapper implementation
License
MIT
THIS SOFTWARE IS PROVIDED "AS IS" BY THE OWNER AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OWNER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. 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.0
- Microsoft.EntityFrameworkCore (>= 3.1.4)
- Microsoft.EntityFrameworkCore.Sqlite (>= 3.1.4)
- Microsoft.EntityFrameworkCore.SqlServer (>= 3.1.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.