I noticed this occurs on some tables and not others in my oracle database project. The tables that it occurs on have a trigger defined on Insert. None of the columns are value generated (Sequence) columns.
This seems to be an issue in the Oracle library as commented by the EF Core Power Tools developer.
modelBuilder.Entity(entity =>
{
entity.HasKey(e => e.StockNo).HasName("PK\_STOCKNO");
entity.ToTable("INVENTORY\_ITEM");
entity.HasIndex(e => new { e.PartNo, e.Progname }, "PART\_IDX");
entity.Property(e => e.StockNo)
.HasMaxLength(30)
.IsUnicode(false)
.**ValueGeneratedOnAdd()**
.HasColumnName("STOCK\_NO");
entity.Property(e => e.Acct)
.HasMaxLength(10)
.IsUnicode(false)
**.ValueGeneratedOnAdd()**
.HasColumnName("ACCT");
entity.Property(e => e.BatchLot)
.HasMaxLength(20)
.IsUnicode(false)
**.ValueGeneratedOnAdd()**
.HasColumnName("BATCH\_LOT");
});
There is a work around I have implemented to set the ValueGenerated property to Never, but it would be helpful if the Oracle Library generated the correct model. This code blindly turns off all ValueGenerated properties, but I do have some which may be needed, so I would like the code to generate correctly.
public partial class OracleDbContext : DbContext
{
partial void OnModelCreatingPartial(ModelBuilder modelBuilder)
{
//var columns = modelBuilder.Model
// .GetEntityTypes()
// .SelectMany(t => t.GetProperties());
foreach (var property in modelBuilder.Model
.GetEntityTypes()
.SelectMany(t => t.GetProperties())
.Where(p => p.ValueGenerated == ValueGenerated.OnAdd))
{
**property.ValueGenerated = ValueGenerated.Never;**
}
}
}