Closed
Description
Hi,
just 2 small problems when generating schema with the t4 postgres model:
I'm using linq2db v2.2 and linq2db.PostgreSQL v2.2
1.
The gererated SQLFunctions class uses the BitArray class, but the using statement 'System.Collections' is missing!
2.
the t4 model generator for Postgres generates the following code in the SQLFunctions class when setting
NormalizeNames = true;
[Sql.Function(Name=".bool", ServerSideOnly=true)]
public static bool? **Bool**(int? par451) // this is fine
{
throw new InvalidOperationException();
}
but if
NormalizeNames = false;
it generates a method name 'bool' -> reserved keyword !
[Sql.Function(Name=".bool", ServerSideOnly=true)]
public static bool? **bool**(int? par451) // this is wrong
{
throw new InvalidOperationException();
}
Can you please have a look?
Thank you!
Cheers Micha
Activity
Kempe commentedon Aug 29, 2018
Sorry, but the same happens with 'char' :
sdanyliv commentedon Aug 29, 2018
Yeah there are problems here. But we have workarounds before it is fixed.
Kempe commentedon Aug 29, 2018
Hi sdanyliv, thanks you for help! Your suggest to add 'System.Collections' works fine. But I got an key-not-found exception when renaming the procedure. Is it correct to set 'Procedures[".char"].Name = "Char";' before calling GenerateModel(); ???
Here is my tt file:
NormalizeNames = false;
LoadPostgreSQLMetadata("connection_string");
Model.Usings.Add("System.Collections");
Procedures[".char"].Name = "Char";
GenerateModel();
sdanyliv commentedon Aug 29, 2018
@Kempe, sorry i have no idea which name is correct and how it is stored in Procedures Dictionary, try to analyse yourself.
- fix #1295
Check that procedure/function name is not keyword in T4 (#1328)