Skip to content

Make library thread safe (SQL providers) #49

@videokojot

Description

@videokojot

Tracking issue:
https://github.com/borisdj/EFCore.BulkExtensions/issues/1284

During my work on MIT fork of this repository https://github.com/videokojot/EFCore.BulkExtensions.MIT I discovered that the library is not thread safe. The SQL adapter is saved in static field, so in case of two threads using the library against two different SQL providers at the same time, this would lead race condition and unexpected errors.

I fixed this in: videokojot/EFCore.BulkExtensions.MIT#22 by getting the provider from the DbContext used for operation (which is available) and for performance we cache the providers in the static fields (but these do not hold any DbContext instance specific data).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions