Skip to content

nkuznia/EntityFrameworkCore.Toolbox

Repository files navigation

EntityFrameworkCore.Toolbox

Extensions and ease of life code to automattically handle working with Entity Framework and related datasets.

Tested and working with Entity Framework Core Sql Server. Other backends may require additional work. Open to pull requests.

EfBulkCopy

Easily upload entities to a database, bypassing the database context entirely by automatting the mapping to SqlBulkCopy:

await dbContext.BulkCopyAsync(myData);

Or even pull from another source entirely via passing a map of TEntity.Property.Name and a fetch function:

await dbContext.BulkCopyAsync<TEntity, TSource>>(myData, entityNameToPropertyGetterMap);

Enum reference helpers

Add reference tables to the database automatically or as needed.

public class MyDbContext : DbContext
{
...
	protected override void OnModelCreating(ModelBuilder modelBuilder)
	{
		modelBuilder.AddEnumReferenceTable<MyEnum>(); // Add enums one at a time

		modelBuilder.AddEnumReferenceTables(); // Add all enums in the context
	}
...
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages