Duplicate column exception on two different property mappings
Posted: Tue 15 Jun 2021 09:37
In continuation of viewtopic.php?f=30&t=46693 I have tried another approach of mapping an enum to a string using EF Core and have come across what looks like another devart bug.
If I have an entity with two properties mapped to the same column like this:
And then create a new entity of my type:
Then I receive the following exception:
Other ways of using this object and this enum mapping do seem to work so it seems like this should be supported. The model builds just fine and I can query on the enum value using LINQ with no issues:
I am using devart v9.14.1273. Let me know if you'd like a test project again
If I have an entity with two properties mapped to the same column like this:
Code: Select all
v.Property(x => x.RawValue).HasColumnName("ENUMCOLUMN");
v.Property(x => x.EnumValue)
.HasColumnName("ENUMCOLUMN")
.HasConversion<String>(
a => FromEnum(a),
b => ToEnum(b));
}
Code: Select all
var e = new EnumThing() { EnumValue = TheEnum.Value1 };
db.enumthings.Add(e);
db.SaveChanges();
Code: Select all
Microsoft.EntityFrameworkCore.DbUpdateException: 'An error occurred while updating the entries. See the inner exception for details.'
Inner Exception
OracleException: ORA-06550: line 4, column 34:
PL/SQL: ORA-00957: duplicate column name
ORA-06550: line 4, column 1:
PL/SQL: SQL Statement ignored
This exception was originally thrown at this call stack:
Devart.Data.Oracle.dr.a(Devart.Data.Oracle.ay, int)
Devart.Data.Oracle.dr.a(int, Devart.Data.Oracle.bx)
Devart.Data.Oracle.OracleCommand.InternalExecute(System.Data.CommandBehavior, System.IDisposable, int, int, bool)
Devart.Common.DbCommandBase.ExecuteDbDataReader(System.Data.CommandBehavior, bool)
Devart.Common.DbCommandBase.ExecuteDbDataReader(System.Data.CommandBehavior)
System.Data.Common.DbCommand.ExecuteReader(System.Data.CommandBehavior)
Devart.Data.Oracle.Entity.ao.a(System.Data.CommandBehavior)
Devart.Common.Entity.cw.d(System.Data.CommandBehavior)
Devart.Data.Oracle.Entity.ao.b(System.Data.CommandBehavior)
System.Data.Common.DbCommand.ExecuteReader()
Code: Select all
db.enumthings.Where(x => x.EnumValue == TheEnum.Value1).First();