Linq2db: Oracle Identity Column not recognized by TT model generator

Created on 14 Jan 2020  路  3Comments  路  Source: linq2db/linq2db

Hi,
I have defined an identity column in an Oracle table.
This is the DDL:

--------------------------------------------------------
--  DDL for Table ST01_COMPONENT
--------------------------------------------------------

  CREATE TABLE "DWUSER"."ST01_COMPONENT" 
   (    "ID_COMPONENT" NUMBER GENERATED BY DEFAULT AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE  ORDER  NOCYCLE , 
    "SITE" NVARCHAR2(6), 
    "SFC" NVARCHAR2(128), 
    "ITEM" NVARCHAR2(128), 
    "ITEM_DESCRIPTION" NVARCHAR2(40)
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 81920 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "ODS" ;
--------------------------------------------------------
--  DDL for Index ST01_COMPONENT_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "DWUSER"."ST01_COMPONENT_PK" ON "DWUSER"."ST01_COMPONENT" ("ID_COMPONENT") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 81920 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "ODS" ;
--------------------------------------------------------
--  Constraints for Table ST01_COMPONENT
--------------------------------------------------------

  ALTER TABLE "DWUSER"."ST01_COMPONENT" ADD CONSTRAINT "ST01_COMPONENT_PK" PRIMARY KEY ("ID_COMPONENT")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 81920 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "ODS"  ENABLE;
  ALTER TABLE "DWUSER"."ST01_COMPONENT" MODIFY ("ID_COMPONENT" NOT NULL ENABLE);

The C# generated code is:

``` C#
[Table(Schema="DWUSER", Name="ST01_COMPONENT")]
public partial class ST01Component
{
[Column("ID_COMPONENT"), PrimaryKey, NotNull] public decimal IdComponent { get; set; } // NUMBER
[Column("SITE"), Nullable ] public string Site { get; set; } // NVARCHAR2(18)
[Column("SFC"), Nullable ] public string Sfc { get; set; } // NVARCHAR2(384)
[Column("ITEM"), Nullable ] public string Item { get; set; } // NVARCHAR2(384)
[Column("ITEM_DESCRIPTION"), Nullable ] public string ItemDescription { get; set; } // NVARCHAR2(120)

}

```

The problem is that the property IdComponent is not identified as an identity and the attribute Identity is missing.

Is it possible to use Merge API getting the auto-generated IdComponent in case of insert if the IdComponent property has not an Identity attribute?

Thank you!

Environment details

linq2db version: 3.0.0-preview.1
Database Server: Oracle
Database Provider: Oracle.ManagedDataAccess.Core (3.0.0-preview.1)
Operating system: Windows 10
.NET Framework:.NET Core 3.1

schema oracle has-pr bug

All 3 comments

Is it possible to use Merge API getting the auto-generated IdComponent in case of insert if the IdComponent property has not an Identity attribute?

Right now merge doesn't support output clause. We have plans to implement it in v3 (probably in next feature release after 3.0).

I'm moving it to v3 release for now, as I don't have test server available to test fix.

2124

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nitz picture nitz  路  6Comments

nviktor picture nviktor  路  6Comments

sdanyliv picture sdanyliv  路  3Comments

jges42 picture jges42  路  5Comments

bofagah400 picture bofagah400  路  4Comments