Rayab.ApplicationDbContext 1.1.8

There is a newer version of this package available.
See the version list below for details.
dotnet add package Rayab.ApplicationDbContext --version 1.1.8                
NuGet\Install-Package Rayab.ApplicationDbContext -Version 1.1.8                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rayab.ApplicationDbContext" Version="1.1.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rayab.ApplicationDbContext --version 1.1.8                
#r "nuget: Rayab.ApplicationDbContext, 1.1.8"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Rayab.ApplicationDbContext as a Cake Addin
#addin nuget:?package=Rayab.ApplicationDbContext&version=1.1.8

// Install Rayab.ApplicationDbContext as a Cake Tool
#tool nuget:?package=Rayab.ApplicationDbContext&version=1.1.8                

Rayab ApplicationDbContext Document

Installation:

To install a Rayab.ApplicationDbContext use

Search in Package Manager

Rayab.ApplicationDbContext

Package Manager Console

Install-Package Rayab.ApplicationDbContext -Version 1.0.4

.NET CLI

dotnet add package Rayab.ApplicationDbContext --version 1.0.4

PackageReference

<PackageReference Include="Rayab.ApplicationDbContext" Version="1.0.4" />

Paket CLI

paket add Rayab.ApplicationDbContext --version 1.0.4

Why do we need this library?

By using this library, you can put your tables in a Class Library project and import the DLL file into the main project, after that, you must import this library into the main project too.

Now, you can have a Class Library for Database Tables and Main Project to work with that. You can share your project with developers for separate development, without giving them the original project.

The idea started because we wanted to easily have all the Identity settings ready for each new project in advance. But then the other ideas we described above were added so that we could create a multi-part project by several developers, all of whom use the same library table.

How To Use:

For example, create an ApplicationDbContext like this:

using Microsoft.EntityFrameworkCore;
using RApplicationDbContext;

namespace Sample
{
    public class ApplicationDbContext : RDbContext
    {
        public ApplicationDbContext(DbContextOptions<ApplicationDbContext> oprions)
            : base(oprions)
        {
        }

        // public DbSet<SomeTable> SomeTable { get; set; }
        
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
        }
        
        public override int SaveChanges()
        {
            var entities = from e in ChangeTracker.Entries()
                           where e.State == EntityState.Added
                                 || e.State == EntityState.Modified
                           select e.Entity;
            foreach (var entity in entities)
            {
                var validationContext = new ValidationContext(entity);
                Validator.ValidateObject(entity, validationContext);
            }

            return base.SaveChanges();
        }
    }
}

Add this code inside startup.cs after ConfigureServices

services.AddDbContext<ApplicationDbContext>(options =>
                options.UseSqlServer(
                    Configuration.GetConnectionString("DefaultConnection")));

All you need is that, extend your class to RDbContext.

You can see the Identity Table Diagram in this image: Identity Diagram

And the Tables in SQL Database:

Identity Tables

If you need to Identity Tables library, Refer To This Link In NuGet.

Product 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. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Rayab.ApplicationDbContext:

Package Downloads
Rayab.PermissionControl

Permission Control System. Designed by Mehdi Keramati. ReCreate by Rayab Developer. Require Rayab.ApplicationDbContext Package. With install this package you can control user permission using database table. Do not need to permission attributes in controllers and actions as static permissions. You can modify user permissions by Database as runtime. For more information, read Document.

Rayab.Email

Email Library. This package is powered by MimeKit and MailKit. This is a personal design, but if you like it, enjoy.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.4 1,161 2/12/2021
1.2.3 1,179 12/23/2020
1.2.2 412 12/23/2020
1.2.1 384 12/8/2020
1.1.9 384 12/7/2020
1.1.8 380 12/7/2020
1.1.7 354 12/7/2020
1.1.6 368 12/7/2020
1.1.5 385 12/7/2020
1.1.4 572 12/2/2020
1.1.3 387 12/2/2020
1.1.2 529 11/30/2020
1.1.1 436 11/30/2020
1.1.0 381 11/30/2020
1.0.9 377 11/30/2020
1.0.8 396 11/25/2020
1.0.7 385 11/25/2020
1.0.6 426 11/25/2020
1.0.5 388 11/24/2020
1.0.4 436 11/23/2020
1.0.3 433 11/22/2020
1.0.1 470 10/10/2020
1.0.0 431 10/5/2020

Update Rayab.Identity Package.