add todo to code
This commit is contained in:
parent
31e7bb7bda
commit
dfb92358fc
@ -452,7 +452,30 @@ public class C4 {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public static string convertSqlToCSharp(string sqlStatement)
|
||||
{
|
||||
// Split the SQL statement by spaces and identify the foreign key keywords
|
||||
string[] words = sqlStatement.Split(' ');
|
||||
int index = Array.IndexOf(words, "FOREIGN") + 1;
|
||||
|
||||
// Extract the table names and key names from the SQL statement
|
||||
string primaryTable = words[index - 3];
|
||||
string primaryKey = words[index - 1];
|
||||
string foreignTable = words[index + 2];
|
||||
string foreignKey = words[index + 4];
|
||||
|
||||
// Generate the C# EF Core code based on the extracted information
|
||||
string csharpCode = "modelBuilder.Entity<" + foreignTable + ">()\n";
|
||||
csharpCode += ".HasOne(" + foreignTable.ToLower() + " => " + foreignTable.ToLower() + "." + foreignKey + ")\n";
|
||||
csharpCode += ".WithMany()\n";
|
||||
csharpCode += ".HasForeignKey(" + foreignTable.ToLower() + " => " + foreignTable.ToLower() + "." + foreignKey + ");\n";
|
||||
|
||||
return csharpCode;
|
||||
}
|
||||
TODO: use function
|
||||
|
||||
*/
|
||||
this.sqlScript.append("\n/* TODO: foreign keys-#################################################\n");
|
||||
for (T1 table : this.tables) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user