Skip to content

v4.0.53

Latest

Choose a tag to compare

@sjh37 sjh37 released this 14 Oct 16:13
· 16 commits to master since this release

What's new in v4.0.53

Oracle synonym support and generated code for MySQL, Oracle and PostgreSQL that compiles and runs. SQL Server
output is unchanged.

Update the efrpg tool to 1.3.0 (dotnet tool update -g Efrpg) for synonyms, MySQL enumerations and PostgreSQL
function return models.

Oracle synonyms (#886)

With FilterSettings.IncludeSynonyms = true, private synonyms owned by the schema you connect as are reverse
engineered under the synonym's name: tables, views, procedures, functions and package members. Foreign keys are
remapped to the synonym names on both sides, so navigation properties work between synonyms, and between a table and
a synonym.

Not covered yet: PUBLIC synonyms, synonyms over a database link, synonyms for synonyms, and the indexes and comments
behind a synonym.

Stored procedures on MySQL, Oracle and PostgreSQL

These were generated with SQL Server's syntax - EXEC @procResult = [schema].[name] ... OUTPUT, and SqlDbType on
the provider's own parameter type - so they did not compile. They now use each database's own call:

  • Oracle: BEGIN "SCHEMA"."NAME"(:A, :B); END;
  • PostgreSQL: CALL "schema"."name"(@a, @b)
  • MySQL: CALL `schema`.`name`(@a, @b), or a CommandType.StoredProcedure command when the procedure has OUT or
    INOUT parameters, which MySQL cannot return from a text command.

Also:

  • OUT parameters are out arguments again; they were missing from the signature.
  • Parameters are typed with DbType, so Oracle OUT values come back as .NET types, such as decimal, rather than
    OracleDecimal.
  • Methods still return int, but return 0: only SQL Server procedures have a return status.
  • Oracle package members are generated: ORDER_PKG.TOUCH_PARENT becomes OrderPkgTouchParent, and package functions
    map as [DbFunction("\"SCHEMA\".\"PKG\".\"FUNC\"", IsBuiltIn = true)].
  • An Oracle SYS_REFCURSOR OUT parameter is an out object holding the OracleRefCursor. Open the connection first
    to read it.
  • PostgreSQL table valued functions are called as "schema"."name"(...) rather than [schema].[name](...), and a
    function's OUT columns are no longer passed as arguments.

Generated code that compiles and builds its model

  • IsClustered() is emitted for SQL Server only. It appeared on every MySQL primary key and on Oracle index-organised
    tables, and it only exists in the SQL Server provider.
  • MySQL:
    • UseMySql now passes ServerVersion.AutoDetect(...), which Pomelo requires.
    • A char(36) string column no longer names its store type; Pomelo reserves char(36) for Guid, and the model
      threw while building.
    • A timestamp ... ON UPDATE CURRENT_TIMESTAMP column is no longer treated as a SQL Server rowversion.
  • Oracle:
    • TIMESTAMP WITH TIME ZONE maps to DateTimeOffset.
    • A foreign key whose numeric type differs from its key's, such as NUMBER(19) referencing NUMBER, takes the
      key's type, as EF requires.
  • PostgreSQL:
    • A schema name with spaces no longer produces an invalid class name: Mixed Case Schema_Thing is now
      MixedCaseSchema_Thing.
    • cidr maps to NpgsqlCidr.
    • PhysicalAddress columns import System.Net.NetworkInformation.
  • An entity whose name is already taken by a configured enum gets a suffix, such as Status1, instead of colliding
    with the enum.
  • EF6 on PostgreSQL:
    • Columns EF6 cannot map (bit strings, arrays, uint, and Npgsql's network, geometric, text search and range types)
      are left out.
    • Table valued functions use @name in Entity SQL and no longer pass OUTPUT.
    • System.Data.SqlClient is no longer imported.

efrpg 1.3.0

  • Reads Oracle synonyms.
  • Reads MySQL enumerations. Its query used SELECT ..., *, which MySQL rejects, so none were ever read.
  • Returns the result columns of a PostgreSQL function with OUT parameters, so its return model is generated.
  • Pins System.Security.Cryptography.Pkcs 10.0.13 over the vulnerable 9.0.13 that SqlClient and ODP.NET bring in.

The wire format is unchanged (schema version 3), so earlier templates keep working with 1.3.0.

Check before upgrading

MySQL, Oracle and PostgreSQL output changes only where it was broken before:

  • Procedure signatures gain their OUT parameters, lose the = null default on any parameter before an out, and
    return 0.
  • An entity that shares a configured enum's name is renamed with a 1 suffix.
  • Oracle TIMESTAMP WITH TIME ZONE properties become DateTimeOffset, PostgreSQL cidr properties become
    NpgsqlCidr, and mismatched numeric foreign key properties take their key's type.
  • MySQL ON UPDATE CURRENT_TIMESTAMP columns are no longer concurrency tokens.
  • MySQL contexts call ServerVersion.AutoDetect, which connects to the server when the options are built.
  • If you update efrpg to 1.3.0 but stay on an older template, configured MySQL enumerations start generating, and an
    enum named after its own table now collides with that table's entity. Upgrading the template avoids it.

Notes

  • New Oracle test schema TestDatabases/Oracle/EfrpgTestSynonyms.sql, loaded by the Oracle docker-compose.yml.