seed/data Seeder düzeltme

This commit is contained in:
Sedat ÖZTÜRK 2026-09-04 15:23:02 +03:00
parent 1423865a8c
commit ed143c01d0
4 changed files with 72 additions and 12 deletions

View file

@ -3163,6 +3163,21 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Int32,
FieldName = "Likes",
CaptionName = "App.Listform.ListformField.Likes",
Width = 0,
Alignment = "right",
ListOrderNo = 11,
Visible = false,
IsActive = true,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,

View file

@ -194,6 +194,9 @@ public class SqlDataSeeder : IDataSeedContributor, ITransientDependency
private static (string Action, string? ObjectName, string? ObjectType) ExtractSqlInfo(string sql)
{
// "-- Create Table" gibi yorum satirlari nesne adi yerine gecmesin diye once temizlenir.
var statement = RemoveComments(sql);
var patterns = new[]
{
(@"CREATE\s+TABLE\s+(\[?\w+\]?\.?\[?\w+\]?)", "CREATE", "TABLE"),
@ -214,7 +217,7 @@ public class SqlDataSeeder : IDataSeedContributor, ITransientDependency
foreach (var (pattern, action, type) in patterns)
{
var match = Regex.Match(sql, pattern, RegexOptions.IgnoreCase);
var match = Regex.Match(statement, pattern, RegexOptions.IgnoreCase);
if (match.Success)
{
var captured = match.Groups[match.Groups.Count - 1].Value;
@ -224,4 +227,11 @@ public class SqlDataSeeder : IDataSeedContributor, ITransientDependency
return ("UNKNOWN", null, null);
}
private static string RemoveComments(string sql)
{
var withoutBlockComments = Regex.Replace(sql, @"/\*.*?\*/", " ", RegexOptions.Singleline);
return Regex.Replace(withoutBlockComments, @"--[^\r\n]*", " ");
}
}

File diff suppressed because one or more lines are too long

View file

@ -14,7 +14,8 @@
"PublishDate": "2024-10-12T00:00:00",
"ExpiryDate": null,
"IsPinned": true,
"ImageUrl": "https://images.unsplash.com/photo-1497366216548-37526070297c?w=800&q=80"
"ImageUrl": "https://images.unsplash.com/photo-1497366216548-37526070297c?w=800&q=80",
"Likes": 0
},
{
"Id": "169a5022-8c46-50bb-8113-aca8f348721d",
@ -26,7 +27,8 @@
"PublishDate": "2024-10-08T00:00:00",
"ExpiryDate": "2024-11-05T00:00:00",
"IsPinned": true,
"ImageUrl": null
"ImageUrl": null,
"Likes": 0
},
{
"Id": "2d1377a3-49b5-51ce-80a3-5bbbbf6b3ad8",
@ -38,7 +40,8 @@
"PublishDate": "2024-10-08T00:00:00",
"ExpiryDate": null,
"IsPinned": false,
"ImageUrl": null
"ImageUrl": null,
"Likes": 0
},
{
"Id": "96a8a3dd-0f4a-5e1e-8b5e-bb44dd41a1f0",
@ -50,7 +53,8 @@
"PublishDate": "2024-10-09T00:00:00",
"ExpiryDate": null,
"IsPinned": false,
"ImageUrl": null
"ImageUrl": null,
"Likes": 0
},
{
"Id": "a753ef12-be3e-56c9-b597-47538aa69fde",
@ -62,7 +66,8 @@
"PublishDate": "2024-10-04T00:00:00",
"ExpiryDate": null,
"IsPinned": true,
"ImageUrl": null
"ImageUrl": null,
"Likes": 0
}
]
}