Skip to content

Bulk operations applied to wrong schema #785

Open
@vtkachen111

Description

@vtkachen111

Here is what to include in your request to make sure we implement a solution as quickly as possible.

1. Description

I have a situation where in one database I have multiple schemas. So for example, I have 2 applications that use 1 database, however, each application has its own schema, with same object types.
Example:

[Applciation1].[Users]
[Application2].[Users].

I have run into a situation where I am using linq dbcontext for application2, I write a query to delete a user. Something like the following
Context2.Users.Where(u => u.Name == “uname2”).Delete()

If evaluating the query: Context2.Users.Where(u => u.Name == “uname2”).Tolist() it retrieves the correct user, however, once your delete() or update() method is run, it updates/deletes user with he same Id from [Application1].[Users]
I was previously using EntityFramework.Extensions (the deprecated one) and it didn’t have this issue, however, with this one the issue exists.

I am using ef6, with ms sql database.

3. Fiddle or Project

If you are able,

Provide a Fiddle that reproduce the issue: https://dotnetfiddle.net/4SeLq9

Or provide a project/solution that we can run to reproduce the issue.

  • Make sure the project compile
  • Make sure to provide only the code that is required to reproduce the issue, not the whole project
  • You can send private code here: info@zzzprojects.com

Otherwise, make sure to include as much information as possible to help our team to reproduce the issue.

4. Any further technical details

Add any relevant detail can help us.

Further technical details

  • EF version: [EF 6]
  • EF Plus version: [z.EntityFramework.Plus.ef6 v7.100.0.0]
  • Database Server version: [SQL Server 15.0.2104]
  • Database Provider version (NuGet): [Microsoft.Data.SqlClient v5.1.2]

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions