question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Oracle Reverse engineer issue

See original GitHub issue

Describe what is not working as expected.

When I map oracle db this is configuration:

  public partial class TErpInterfaceConfiguration : IEntityTypeConfiguration<TErpInterface>
    {
        public void Configure(EntityTypeBuilder<TErpInterface> entity)
        {
            entity.ToTable("T_ERP_INTERFACE");

            entity.HasIndex(e => e.TrxItemId, "T_ERP_INTERFACE_TRX_ITEM_ID");

            entity.Property(e => e.Id)
                .HasColumnType("NUMBER")
                .ValueGeneratedOnAdd()
                .HasColumnName("ID");

            entity.Property(e => e.Attribute1)
                .HasMaxLength(100)
                .IsUnicode(false)
                .ValueGeneratedOnAdd()
                .HasColumnName("ATTRIBUTE1");

            entity.Property(e => e.Attribute2)
                .HasMaxLength(100)
                .IsUnicode(false)
                .ValueGeneratedOnAdd()
                .HasColumnName("ATTRIBUTE2");

            entity.Property(e => e.Attribute3)
                .HasMaxLength(100)
                .IsUnicode(false)
                .ValueGeneratedOnAdd()
                .HasColumnName("ATTRIBUTE3");

            entity.Property(e => e.Attribute4)
                .HasMaxLength(100)
                .IsUnicode(false)
                .ValueGeneratedOnAdd()
                .HasColumnName("ATTRIBUTE4");

            entity.Property(e => e.Attribute5)
                .HasMaxLength(100)
                .IsUnicode(false)
                .ValueGeneratedOnAdd()
                .HasColumnName("ATTRIBUTE5");

            entity.Property(e => e.Attribute6)
                .HasMaxLength(100)
                .IsUnicode(false)
                .ValueGeneratedOnAdd()
                .HasColumnName("ATTRIBUTE6");

            entity.Property(e => e.CreatedBy)
                .HasColumnType("NUMBER")
                .ValueGeneratedOnAdd()
                .HasColumnName("CREATED_BY");

            entity.Property(e => e.CreatedDate)
                .HasColumnType("DATE")
                .ValueGeneratedOnAdd()
                .HasColumnName("CREATED_DATE")
                .HasDefaultValueSql("sysdate\n");

            entity.Property(e => e.InterfaceDate)
                .HasColumnType("DATE")
                .ValueGeneratedOnAdd()
                .HasColumnName("INTERFACE_DATE");

            entity.Property(e => e.InterfaceHeaderId)
                .HasColumnType("NUMBER")
                .ValueGeneratedOnAdd()
                .HasColumnName("INTERFACE_HEADER_ID");

            entity.Property(e => e.InterfaceId)
                .HasColumnType("NUMBER")
                .ValueGeneratedOnAdd()
                .HasColumnName("INTERFACE_ID");

            entity.Property(e => e.InterfaceSourceName)
                .HasMaxLength(100)
                .IsUnicode(false)
                .ValueGeneratedOnAdd()
                .HasColumnName("INTERFACE_SOURCE_NAME");

            entity.Property(e => e.TrxItemId)
                .HasColumnType("NUMBER")
                .ValueGeneratedOnAdd()
                .HasColumnName("TRX_ITEM_ID");

            entity.Property(e => e.UpdatedBy)
                .HasColumnType("NUMBER")
                .ValueGeneratedOnAdd()
                .HasColumnName("UPDATED_BY");

            entity.Property(e => e.UpdatedDate)
                .HasColumnType("DATE")
                .ValueGeneratedOnAdd()
                .HasColumnName("UPDATED_DATE")
                .HasDefaultValueSql("sysdate\n");

            entity.Property(e => e.Valid)
                .HasColumnType("NUMBER")
                .ValueGeneratedOnAdd()
                .HasColumnName("VALID");

            OnConfigurePartial(entity);
        }

        partial void OnConfigurePartial(EntityTypeBuilder<TErpInterface> entity);
    }

but I get this error from this automatically generated code:

System.InvalidOperationException: 'The properties 'TErpInterface.Id', 'TErpInterface.CreatedBy', 
'TErpInterface.InterfaceHeaderId', 'TErpInterface.InterfaceId', 'TErpInterface.TrxItemId', 'TErpInterface.UpdatedBy', 
'TErpInterface.Valid' are configured to use 'Identity' value generation and are mapped to the same table 
'WMS.T_ERP_INTERFACE', but only one column per table can be configured as 'Identity'. Call 'ValueGeneratedNever' 
in 'OnModelCreating' for properties that should not use 'Identity'.'

this is table SQL:

create table T_ERP_INTERFACE
(
  id                    NUMBER not null,
  trx_item_id           NUMBER,
  interface_header_id   NUMBER,
  interface_id          NUMBER,
  interface_source_name VARCHAR2(100),
  interface_date        DATE,
  valid                 NUMBER,
  attribute1            VARCHAR2(100),
  attribute2            VARCHAR2(100),
  attribute3            VARCHAR2(100),
  attribute4            VARCHAR2(100),
  attribute5            VARCHAR2(100),
  attribute6            VARCHAR2(100),
  created_date          DATE default sysdate,
  created_by            NUMBER,
  updated_date          DATE default sysdate,
  updated_by            NUMBER
)

and I do have before update and insert triggers: image

Is there any way I can fix it? My company is unfortunately stuck at Oracle 11.2 database.

I do this in the Context:

options => options.UseOracleSQLCompatibility("11")

Please include a complete description that I can redo to reproduce the issue.

Further technical details

EF Core version in use: EF Core 6

EF Core Power Tools version: (found in About dialog - blue questionmark icon on context menu) image

Database engine: (SQL Server, Azure SQL, Postgres, Oracle, Firebird, SQLite, MySQL) Unfortunately Oracle

Visual Studio version: 2019

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ErikEJcommented, Dec 9, 2021

Closing as external for now

0reactions
tomasfilcommented, Dec 8, 2021

I will try and post it to Oracle repo. It is wrongly generated. If this tool doesnt affect generation, then it must be oracle provider issue then

Read more comments on GitHub >

github_iconTop Results From Across the Web

Re-engineering Your Database Using Oracle SQL ...
Reverse engineer the relational model to a logical model; Modify the model by creating a new Entity with Attributes and relations. Synchronize the...
Read more >
Issues when reverse engineering views containing sub ...
I am running into issues when using Data Modeler to reverse engineer Oracle views. One issue occurs if the view SQL contains a...
Read more >
Problems with Reverse Engineering of an SQL Server ...
Oracle Data Integrator - Version 4.1.01.05 and later: Problems with Reverse Engineering of an SQL Server database after importing.
Read more >
Reverse-Engineering Issue
Hi AllMy Requiremnet is i need to access views available in Oracle ERP system through session.Usually when i try to access a views...
Read more >
RKM Oracle reverse engineering issues
We rcently upgrade from ODI 11g to ODI 12.1.2. we are trying to reverse engineer (using Customized) to create datastore from oracle table/ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found