diff --git a/.idea/.idea.BMA.EHR.Recruit.Service/.idea/.gitignore b/.idea/.idea.BMA.EHR.Recruit.Service/.idea/.gitignore
new file mode 100644
index 0000000..889a0d6
--- /dev/null
+++ b/.idea/.idea.BMA.EHR.Recruit.Service/.idea/.gitignore
@@ -0,0 +1,13 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Rider ignored files
+/contentModel.xml
+/projectSettingsUpdater.xml
+/modules.xml
+/.idea.BMA.EHR.Recruit.Service.iml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/.idea.BMA.EHR.Recruit.Service/.idea/.name b/.idea/.idea.BMA.EHR.Recruit.Service/.idea/.name
new file mode 100644
index 0000000..aaf1117
--- /dev/null
+++ b/.idea/.idea.BMA.EHR.Recruit.Service/.idea/.name
@@ -0,0 +1 @@
+BMA.EHR.Recruit.Service
\ No newline at end of file
diff --git a/.idea/.idea.BMA.EHR.Recruit.Service/.idea/encodings.xml b/.idea/.idea.BMA.EHR.Recruit.Service/.idea/encodings.xml
new file mode 100644
index 0000000..df87cf9
--- /dev/null
+++ b/.idea/.idea.BMA.EHR.Recruit.Service/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.BMA.EHR.Recruit.Service/.idea/indexLayout.xml b/.idea/.idea.BMA.EHR.Recruit.Service/.idea/indexLayout.xml
new file mode 100644
index 0000000..7b08163
--- /dev/null
+++ b/.idea/.idea.BMA.EHR.Recruit.Service/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.BMA.EHR.Recruit.Service/.idea/vcs.xml b/.idea/.idea.BMA.EHR.Recruit.Service/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/.idea.BMA.EHR.Recruit.Service/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Controllers/RecruitController.cs b/Controllers/RecruitController.cs
index 3561b97..39fd3c9 100644
--- a/Controllers/RecruitController.cs
+++ b/Controllers/RecruitController.cs
@@ -752,6 +752,8 @@ namespace BMA.EHR.Recruit.Service.Controllers
var cols = workSheet.GetHeaderColumns();
int row = 2;
+ int batchCount = 0;
+ const int batchSize = 500;
while (row <= totalRows)
{
@@ -860,13 +862,23 @@ namespace BMA.EHR.Recruit.Service.Controllers
//imported.Recruits.Add(r);
row++;
+ batchCount++;
+
+ // Batch save to prevent OutOfMemoryException on large imports
+ if (batchCount >= batchSize)
+ {
+ _context.SaveChanges();
+ _context.ChangeTracker.Clear();
+ // Re-attach the import entity after clearing the tracker
+ _context.RecruitImports.Attach(imported);
+ batchCount = 0;
+ }
}
}
}
- // finally save to database
-
+ // Save remaining records in the last batch
_context.SaveChanges();
return Success();
@@ -1371,6 +1383,8 @@ namespace BMA.EHR.Recruit.Service.Controllers
var cols = workSheet.GetHeaderColumns();
int row = 8;
+ int batchCount = 0;
+ const int batchSize = 500;
var endRow = workSheet.Dimension.End.Row; // แถวสุดท้ายที่มีข้อมูล
while (row <= endRow)
{
@@ -1461,14 +1475,31 @@ namespace BMA.EHR.Recruit.Service.Controllers
}
row++;
+ batchCount++;
+
+ // Batch save to prevent OutOfMemoryException on large imports
+ if (batchCount >= batchSize)
+ {
+ rec_import.ScoreImport = imported;
+ await _context.SaveChangesAsync();
+ _context.ChangeTracker.Clear();
+ // Re-attach entities after clearing the tracker
+ _context.Attach(rec_import);
+ _context.Attach(imported);
+ imported.Scores.Clear();
+ batchCount = 0;
+ }
} // end of sheet loop
} // end of all file loop
}
- // finally save to database
- rec_import.ScoreImport = imported;
- await _context.SaveChangesAsync();
+ // Save remaining records in the last batch
+ if (imported.Scores.Count > 0)
+ {
+ rec_import.ScoreImport = imported;
+ await _context.SaveChangesAsync();
+ }
return Success();
diff --git a/obj/BMA.EHR.Recruit.Service.csproj.nuget.dgspec.json b/obj/BMA.EHR.Recruit.Service.csproj.nuget.dgspec.json
index c30443d..ea2eb46 100644
--- a/obj/BMA.EHR.Recruit.Service.csproj.nuget.dgspec.json
+++ b/obj/BMA.EHR.Recruit.Service.csproj.nuget.dgspec.json
@@ -39,7 +39,7 @@
"auditLevel": "low",
"auditMode": "direct"
},
- "SdkAnalysisLevel": "9.0.300"
+ "SdkAnalysisLevel": "10.0.200"
},
"frameworks": {
"net7.0": {
@@ -203,7 +203,7 @@
"privateAssets": "all"
}
},
- "runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/9.0.305/RuntimeIdentifierGraph.json"
+ "runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.203/RuntimeIdentifierGraph.json"
}
}
}
diff --git a/obj/BMA.EHR.Recruit.Service.csproj.nuget.g.props b/obj/BMA.EHR.Recruit.Service.csproj.nuget.g.props
index 5868417..8714023 100644
--- a/obj/BMA.EHR.Recruit.Service.csproj.nuget.g.props
+++ b/obj/BMA.EHR.Recruit.Service.csproj.nuget.g.props
@@ -7,7 +7,7 @@
/Users/suphonchaip/.nuget/packages/
/Users/suphonchaip/.nuget/packages/
PackageReference
- 6.14.0
+ 7.0.0
diff --git a/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs b/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs
index a9058da..4257f4b 100644
--- a/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs
+++ b/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs
@@ -1,4 +1,4 @@
-//
-using System;
-using System.Reflection;
-[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]
+//
+using System;
+using System.Reflection;
+[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]
diff --git a/obj/Debug/net7.0/BMA.EHR.Recruit.Service.AssemblyInfo.cs b/obj/Debug/net7.0/BMA.EHR.Recruit.Service.AssemblyInfo.cs
index 4236a30..4596355 100644
--- a/obj/Debug/net7.0/BMA.EHR.Recruit.Service.AssemblyInfo.cs
+++ b/obj/Debug/net7.0/BMA.EHR.Recruit.Service.AssemblyInfo.cs
@@ -14,11 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("BMA.EHR.Recruit.Service")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
-<<<<<<< HEAD
-[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+82e6bcc95bc1a1582fcc9513f288ef318f5adb72")]
-=======
-[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d245236a144a9ba61661418db9ef1a8a2225d063")]
->>>>>>> develop
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3b70246e9d6b2564a4d9b34daf5f4837c4116a91")]
[assembly: System.Reflection.AssemblyProductAttribute("BMA.EHR.Recruit.Service")]
[assembly: System.Reflection.AssemblyTitleAttribute("BMA.EHR.Recruit.Service")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
diff --git a/obj/Debug/net7.0/BMA.EHR.Recruit.Service.AssemblyInfoInputs.cache b/obj/Debug/net7.0/BMA.EHR.Recruit.Service.AssemblyInfoInputs.cache
index 7a2615a..639aaef 100644
--- a/obj/Debug/net7.0/BMA.EHR.Recruit.Service.AssemblyInfoInputs.cache
+++ b/obj/Debug/net7.0/BMA.EHR.Recruit.Service.AssemblyInfoInputs.cache
@@ -1,5 +1 @@
-<<<<<<< HEAD
-e6710ad194b71c423e48e4496ccfad9f61fd14ce3d380484fc72866c29b8ac89
-=======
-157a45ee45981ce605f03881ba3934018f157203e24d6fc6a8c2d7a6fcd5987d
->>>>>>> develop
+41b5cec2055d8189cb57cbe339bf4738c10bcf621221538d3a3cce6fb5666e55
diff --git a/obj/Debug/net7.0/BMA.EHR.Recruit.Service.GeneratedMSBuildEditorConfig.editorconfig b/obj/Debug/net7.0/BMA.EHR.Recruit.Service.GeneratedMSBuildEditorConfig.editorconfig
index c970989..9c7d6d3 100644
--- a/obj/Debug/net7.0/BMA.EHR.Recruit.Service.GeneratedMSBuildEditorConfig.editorconfig
+++ b/obj/Debug/net7.0/BMA.EHR.Recruit.Service.GeneratedMSBuildEditorConfig.editorconfig
@@ -1,5 +1,7 @@
is_global = true
build_property.TargetFramework = net7.0
+build_property.TargetFrameworkIdentifier = .NETCoreApp
+build_property.TargetFrameworkVersion = v7.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb = true
build_property.ProjectTypeGuids =
diff --git a/obj/Debug/net7.0/BMA.EHR.Recruit.Service.GlobalUsings.g.cs b/obj/Debug/net7.0/BMA.EHR.Recruit.Service.GlobalUsings.g.cs
index 025530a..5e6145d 100644
--- a/obj/Debug/net7.0/BMA.EHR.Recruit.Service.GlobalUsings.g.cs
+++ b/obj/Debug/net7.0/BMA.EHR.Recruit.Service.GlobalUsings.g.cs
@@ -1,17 +1,17 @@
//
-global using global::Microsoft.AspNetCore.Builder;
-global using global::Microsoft.AspNetCore.Hosting;
-global using global::Microsoft.AspNetCore.Http;
-global using global::Microsoft.AspNetCore.Routing;
-global using global::Microsoft.Extensions.Configuration;
-global using global::Microsoft.Extensions.DependencyInjection;
-global using global::Microsoft.Extensions.Hosting;
-global using global::Microsoft.Extensions.Logging;
-global using global::System;
-global using global::System.Collections.Generic;
-global using global::System.IO;
-global using global::System.Linq;
-global using global::System.Net.Http;
-global using global::System.Net.Http.Json;
-global using global::System.Threading;
-global using global::System.Threading.Tasks;
+global using Microsoft.AspNetCore.Builder;
+global using Microsoft.AspNetCore.Hosting;
+global using Microsoft.AspNetCore.Http;
+global using Microsoft.AspNetCore.Routing;
+global using Microsoft.Extensions.Configuration;
+global using Microsoft.Extensions.DependencyInjection;
+global using Microsoft.Extensions.Hosting;
+global using Microsoft.Extensions.Logging;
+global using System;
+global using System.Collections.Generic;
+global using System.IO;
+global using System.Linq;
+global using System.Net.Http;
+global using System.Net.Http.Json;
+global using System.Threading;
+global using System.Threading.Tasks;
diff --git a/obj/Debug/net7.0/BMA.EHR.Recruit.Service.assets.cache b/obj/Debug/net7.0/BMA.EHR.Recruit.Service.assets.cache
index f27eddc..43caf71 100644
Binary files a/obj/Debug/net7.0/BMA.EHR.Recruit.Service.assets.cache and b/obj/Debug/net7.0/BMA.EHR.Recruit.Service.assets.cache differ
diff --git a/obj/project.assets.json b/obj/project.assets.json
index e6f4b38..46e800f 100644
--- a/obj/project.assets.json
+++ b/obj/project.assets.json
@@ -13782,7 +13782,7 @@
"auditLevel": "low",
"auditMode": "direct"
},
- "SdkAnalysisLevel": "9.0.300"
+ "SdkAnalysisLevel": "10.0.200"
},
"frameworks": {
"net7.0": {
@@ -13946,7 +13946,7 @@
"privateAssets": "all"
}
},
- "runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/9.0.305/RuntimeIdentifierGraph.json"
+ "runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.203/RuntimeIdentifierGraph.json"
}
}
}
diff --git a/obj/project.nuget.cache b/obj/project.nuget.cache
index 876e06c..4bae79d 100644
--- a/obj/project.nuget.cache
+++ b/obj/project.nuget.cache
@@ -1,6 +1,6 @@
{
"version": 2,
- "dgSpecHash": "z4TN+iW9Ey8=",
+ "dgSpecHash": "6/jNsBvJ3SY=",
"success": true,
"projectFilePath": "/Users/suphonchaip/Develop/hrms/hrms-api-recruit/BMA.EHR.Recruit.Service.csproj",
"expectedPackageFiles": [