Skip to content

A Standardized .NET library that captures the exceptions thrown by the EntityFramework from SQL Server and converts them into meaningful exceptions...

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
License.txt
Notifications You must be signed in to change notification settings

The-Standard-Organization/STX.EFxceptions.SqlServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STX.EFxceptions.MsSqlServer

STX.EFxceptions.SqlServer

.Net Nuget Nuget The Standard The Standard - COMPLIANT The Standard Community

Introduction

A Standardized .NET library that captures the exceptions thrown by the EntityFramework from SQL Server and converts them into meaningful exceptions...

STX. EFXceptions.Core Implementation

STX.EFxceptions.Core

Installation

You can get STX.EFxceptions.SqlServer Nuget package by typing:

Install-Package STX.EFxceptions.SqlServer

You can get STX.EFxceptions.Identity.SqlServer Nuget package by typing:

Install-Package STX.EFxceptions.Identity.SqlServer

Integration

Replace your existing DbContext class with EFxceptionsContext (or your IdentityDbContext with EFxceptionIdentityContext) as follows:

Before:

    public partial class StorageBroker : DbContext, IStorageBroker
    {
        public StorageBroker(DbContextOptions<StorageBroker> options)
            : base(options) => this.Database.Migrate();
    }

After:

    public partial class StorageBroker : EFxceptionsContext, IStorageBroker
    {
        public StorageBroker(DbContextOptions<StorageBroker> options)
            : base(options) => this.Database.Migrate();
    }

Supported HTTP Status Codes

Code Meanings Exception
207 Invalid column name '%.*ls'. InvalidColumnNameException
208 Invalid object name '%.*ls'. InvalidObjectNameException
547 The %ls statement conflicted with the %ls constraint "%.*ls". The conflict occurred in database "%.*ls", table "%.*ls"%ls%.*ls%ls. ForeignKeyConstraintConflictException
2601 Attempt to insert duplicate key row in object '%.*s' with unique index '%.*s'%S_EED. DuplicateKeyWithUniqueIndexException
2627 Violation of %ls constraint '%.*ls'. Cannot insert duplicate key in object '%.*ls'. DuplicateKeyException

This library is forever growing as we add more exceptions and codes into it, we appreciate any contributions as there are so many codes we need to cover, so please stay tuned.

Standard-Compliance

This library was built according to The Standard. The library follows engineering principles, patterns and tooling as recommended by The Standard.

This library is also a community effort which involved many nights of pair-programming, test-driven development and in-depth exploration research and design discussions.

Standard-Promise

The most important fulfillment aspect in a Standard complaint system is aimed towards contributing to people, its evolution, and principles. An organization that systematically honors an environment of learning, training, and sharing knowledge is an organization that learns from the past, makes calculated risks for the future, and brings everyone within it up to speed on the current state of things as honestly, rapidly, and efficiently as possible.

We believe that everyone has the right to privacy, and will never do anything that could violate that right. We are committed to writing ethical and responsible software, and will always strive to use our skills, coding, and systems for the good. We believe that these beliefs will help to ensure that our software(s) are safe and secure and that it will never be used to harm or collect personal data for malicious purposes.

The Standard Community as a promise to you is in upholding these values.

Contact

If you have any suggestions, comments or questions, please feel free to contact me on:

Twitter

LinkedIn

E-Mail

Important Notice

A special thanks to Mr. Hassan Habib and Mr. Christo du Toit for their continuing dedicated contributions.

About

A Standardized .NET library that captures the exceptions thrown by the EntityFramework from SQL Server and converts them into meaningful exceptions...

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
License.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages