Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

EntityFramework Core extension for adding the method AddOrUpdate

Notifications You must be signed in to change notification settings

edgarfroes/salazar-efcore-dbset-addorupdate

Repository files navigation

Usage

This extension is a bit different from the old AddOrUpdate from EF (not Core). You will have to pass the object (or list of objects) with a ref. Also, you will have to send a dynamic object specifying the fields you'll be using to check if EF will add a new one up update an existant object.

Single object:

context.Users.AddOrUpdate(ref singleUser, x => new { x.SocialSecurityNumber })

List of objects:

context.Users.AddOrUpdate(ref listOfUsers, x => new { x.SocialSecurityNumber })

About

EntityFramework Core extension for adding the method AddOrUpdate

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages