Skip to content

System.Data.SqlClient.SqlException: 'There is already an object named '#ZZZ_TemporaryTable_100' in the database.' #837

@xieyufei1220

Description

@xieyufei1220

I do some test with the latest version 9.104.0.1 with .net 4.8 + EF 6.5, got the exception.

after downgrade to the 9.103.9.3,it's ok.


System.Data.SqlClient.SqlException: 'There is already an object named '#ZZZ_TemporaryTable_100' in the database.'

void FillLinkProperties()
{
using var dc = ShouContextManager.EfContext;
dc.Database.Connection.Open();

            var clientIds = result.Select(x => x.ClientId).Distinct().ToArray();
            var futureClients = dc.Client.WhereBulkContains(clientIds, x => x.PK_Client)
                                         .Select(x => new
                                         {
                                             ClientId = x.PK_Client,
                                             x.ClientCode,
                                             x.ClientName
                                         }).Future();

            var bookCatalogIds = result.Select(x => x.BookCatalogId).Distinct().ToArray();
            var futureBooks = dc.BookCatalog.WhereBulkContains(bookCatalogIds, x => x.PK_BookCatalog)
                                            .Select(x => new
                                            {
                                                x.SubscriptionPlan.PlanCode,
                                                BookCatalogId = x.PK_BookCatalog,
                                                PlanBookId = x.PlanBookID,
                                                x.BookCode,
                                                BookId = x.BookID,
                                                Title = x.TitleStandard,
                                                x.Press.PressName,
                                                x.Author,
                                                x.UnitPrice
                                            }).Future();

            var clients = futureClients.ToList();
            var books = futureBooks.ToList();

....
}

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