-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reverse Engineering Documentation for Oracle DATE refers to a .NET data type that seemingly doesn't exist #269
Comments
Thanks for pointing out this doc bug. The correct data type is System.DateTime. We'll fix this in the next doc version publication. |
If by default Column type explicitly declared: builder.Property(p => p.TestDate)
.HasColumnName("TEST_DATE")
.HasColumnType("DATE"); EF Execution information: Column type not explicitly declared: builder.Property(p => p.TestDate)
.HasColumnName("TEST_DATE"); EF Execution information: Note the DbType in the execution information is different. When DbType = DateTime the execution takes almost 20 seconds. This doesn't seem like intentional behavior if the default mapping is |
What DB server version are you using? Do you have a test case that can reproduce the slow behavior? If not a test case, can you provide the full reverse engineering trace? |
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production I use a custom tool to scaffold things, not the stock reverse engineering, so no trace. You have to actually hit a database to reproduce. My backing Oracle data is a view containing a DATE column. It has a backing index and is not part of any keys. Creating a simple entity with a DateTime and then an EF configuration for that entity. public class TestEntity {
public DateTime TestDateTime {get; set;}
} Inside EF DbContext (not the full context) public virtual DbSet<TestEntity> TestEntity {get; set;}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<TestEntity>(entity =>
{
// Comment the HasColumnType off and on to see performance difference
entity.Property(p => p.TestDateTime)
.HasColumnName("TEST_DATE");
//.HasColumnType("DATE")
});
} The key point here is to swap the |
New doc version will be published this week. Closing this issue. |
https://docs.oracle.com/en/database/oracle/oracle-database/21/odpnt/EFCoreREDataTypeMapping.html#GUID-4FF3A9A3-AE49-431B-A4FB-31F8C53FCCF5 has the Oracle
DATE
type as being mapped to the .NETSystem.Date
type. This type does not exist as far as I can tell according to the Microsoft documentation here: https://learn.microsoft.com/en-us/dotnet/api/system?view=net-6.0#structs. I am using .NET 6, EF Core 6.0.5, and Oracle.EntityFrameworkCore 6.21.61.If I do not explictly declare
.HasColumnType("DATE")
in my configuration, the provider takes 20x longer to return any results involving aDATE
type, implying there is some kind of type conversion happening behind the scenes.As noted in #248 neither the
DateOnly
orTimeOnly
structs are supported. What is the correct .NET data type that Oracle'sDATE
is supposed to map to? If this is the wrong documentation, please point me in the right direction.The text was updated successfully, but these errors were encountered: