AdoNetCore.AseClient icon indicating copy to clipboard operation
AdoNetCore.AseClient copied to clipboard

[linq2db] DbConnection.GetSchema API support

Open MaceWindu opened this issue 6 years ago • 5 comments

Right now this API is not implemented and throws NotSupportedException from base class.

linq2db use following schema tables for ASE:

  • DataTypes
  • Procedures
  • ProcedureParameters

for other metadata we query system tables directly.

Why this feature is important for linq2db - schema provider used to generate data model from database using T4 templates.

Another important thing is support for CommandBehavior.SchemaOnly for procedures. Native provider (or in worst case ASE itself) has bug in this area, where it executes procedure for real which is very bad. See https://github.com/linq2db/linq2db/issues/792. We fixed it for native provider on our side by wrapping such calls in transactions with rollback.

linq2db test: SchemaProviderTest.IncludeExcludeCatalogTest

MaceWindu avatar May 21 '18 13:05 MaceWindu

I would say, it has lower priority compared to bugs, as we can try to replace those calls on our side with queries to system tables for time being

MaceWindu avatar May 21 '18 13:05 MaceWindu

@MaceWindu - On your point about CommandBehaviour.SchemaOnly and using a transaction to work around the SAP driver's bug, ASE does have support for getting a procedure's (or any command's) schema via SET FMTONLY [ON|OFF]

senseibaka avatar May 23 '18 07:05 senseibaka

Also, it might be a while before DbConnection.GetSchema is implemented completely. However, if all you rely on is DataTypes, Procedures, and ProcedureParameters then we could push out a partial implementation...

senseibaka avatar May 23 '18 07:05 senseibaka

Thanks for fmtonly, will try it later, if it works, it meant that native provider doesn't set it...

As for API, as I said - we can workaround it on our side, so no rush here

MaceWindu avatar May 23 '18 10:05 MaceWindu

FYI, this API is not required for linq2db anymore, as I implemented required functionality on our side. So if nobody else needs it ATM, you can postpone it

MaceWindu avatar May 26 '18 13:05 MaceWindu