yang-er / efcore-ext

EFCore Extensions for batch-CRUD / cache / minor fix
MIT License
32 stars 6 forks source link

Empty sentence being cached #6

Closed yang-er closed 3 years ago

yang-er commented 3 years ago

When the first call of merge is of empty array, then it will become

MERGE INTO [TenantClassStudents] AS [t]
USING (
    VALUES

) AS [cte] ([ClassId], [StudentId])
    ON ([t].[StudentId] = [cte].[StudentId]) AND ([t].[ClassId] = [cte].[ClassId])
WHEN NOT MATCHED BY TARGET
    THEN INSERT ([StudentId], [ClassId]) VALUES ([cte].[StudentId], [cte].[ClassId]);

However, after this operation, calling this merge with an non-empty will carry on all the sentences, but the SQL command text is still empty.

yang-er commented 3 years ago

Merge 100 items then 25 items, the 100-item sentence will be cached.