0

I have a parent class with some column definition and different child class to inherit the column definition and some extra column. However, I can't get it to work. The create table call always fail.

[Table]
class Parent
{
    [column] public int ID;
    [column] public string Name;
}

[Table]
class Child : Parent
{
    [column] public string ChildAttrib;
}

using (var db = new DataConnection())
{
    db.CreateTable<Child>();
}

Here is the error message:

Message: FirebirdSql.Data.FirebirdClient.FbException : Dynamic SQL Error
SQL error code = -104
Token unknown - line 16, column 2
Row
  ----> FirebirdSql.Data.Common.IscException : Dynamic SQL Error
SQL error code = -104
Token unknown - line 16, column 2
Row

How do I solve it? I found some InheritanceMapping but I have no idea what this is use for and whether it can apply to my code or not. I just want to have a parent class define a set of common column and have a child class to inherit it and define extra column.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
sgwong513
  • 275
  • 1
  • 8
  • I don't know linq2db myself, but `ROW` is a reserved word, and apparently linq2db is generating a query containing `Row` as an alias or something. It would need to be properly quoted for the query to succeed. Or alternatively it is generating a statement that is syntactically invalid for Firebird. – Mark Rotteveel May 30 '19 at 09:19
  • 1
    Mark is right, your error should be related to use of reserved word in mapping. I would recommend to rename it for now. We will update list of reserved words to include newer versions of FB https://github.com/linq2db/linq2db/issues/1741 –  May 31 '19 at 07:10

0 Answers0