Rayab.ApplicationDbContext 1.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package Rayab.ApplicationDbContext --version 1.0.5                
NuGet\Install-Package Rayab.ApplicationDbContext -Version 1.0.5                
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.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rayab.ApplicationDbContext --version 1.0.5                
#r "nuget: Rayab.ApplicationDbContext, 1.0.5"                
#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.0.5

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

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,165 2/12/2021
1.2.3 1,181 12/23/2020
1.2.2 414 12/23/2020
1.2.1 386 12/8/2020
1.1.9 386 12/7/2020
1.1.8 382 12/7/2020
1.1.7 356 12/7/2020
1.1.6 370 12/7/2020
1.1.5 387 12/7/2020
1.1.4 574 12/2/2020
1.1.3 389 12/2/2020
1.1.2 531 11/30/2020
1.1.1 438 11/30/2020
1.1.0 383 11/30/2020
1.0.9 379 11/30/2020
1.0.8 398 11/25/2020
1.0.7 387 11/25/2020
1.0.6 428 11/25/2020
1.0.5 390 11/24/2020
1.0.4 438 11/23/2020
1.0.3 435 11/22/2020
1.0.1 472 10/10/2020
1.0.0 433 10/5/2020

Changed Library Icon only.