Error When Using DateTimeOffset (6.50.237)

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
jared
Posts: 10
Joined: Wed 12 Oct 2011 22:12

Error When Using DateTimeOffset (6.50.237)

Post by jared » Mon 24 Oct 2011 20:51

When trying to use dotConnect for Oracle 6.50.237 I discovered that I am now getting an "Unexpected type usage: PrimitiveTypeKind 'DateTimeOffset', DatabaseSpecificType: '0'." error when using a property of type DateTimeOffset in a query.

Code: Select all

public class RootItem
{
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int Id { get; set; }

    public DateTimeOffset Time { get; set; }
}

Code: Select all

public class MyDbContext : DbContext
{

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Conventions.Remove();

        modelBuilder.Conventions.Remove();
    }

    public DbSet RootItems { get; set; }
}

Code: Select all

class Program
{

    static void Main(string[] args)
    {

        var monitor = new OracleMonitor() { IsActive = true };

        var config = OracleEntityProviderConfig.Instance;

        config.Workarounds.IgnoreSchemaName = true;

        config.DatabaseScript.Schema.DeleteDatabaseBehaviour = DeleteDatabaseBehaviour.ModelObjectsOnly;

        System.Data.Entity.Database.SetInitializer(new DropCreateDatabaseAlways());

        var now = DateTimeOffset.Now;

        using (MyDbContext context = new MyDbContext())
        {
            var query = (from p in context.RootItems
                            where p.Time < now
                            select p).ToList();
        }
    }

}
The
var query = (from p in context.RootItems
where p.Time < now
select p).ToList();


Throws thefollowing Exception:


[System.Data.EntityCommandCompilationException] = {"An error occurred while preparing the command definition. See the inner exception for details."}

InnerException:
[System.InvalidOperationException] = {"Unexpected type usage: PrimitiveTypeKind 'DateTimeOffset', DatabaseSpecificType: '0'."}

StackTrace:
at Devart.Common.Entity.ao.c(DbParameterBase A_0, e A_1)
at Devart.Data.Oracle.Entity.y.a(af A_0, DbCommandBase A_1)
at Devart.Common.Entity.a5.c()
at Devart.Data.Oracle.Entity.OracleEntityProviderServices.a(h A_0, DbCommandTree A_1)
at Devart.Data.Oracle.Entity.OracleEntityProviderServices.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
at System.Data.Common.DbProviderServices.CreateCommandDefinition(DbCommandTree commandTree)
at System.Data.EntityClient.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree)

Shalex
Site Admin
Posts: 8242
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 25 Oct 2011 15:10

We will post here when the problem is fixed.

Shalex
Site Admin
Posts: 8242
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 26 Oct 2011 15:17

The bug with the DateTimeOffset parameters is fixed. We will post here when the corresponding build of dotConnect for Oracle is available for download.

Shalex
Site Admin
Posts: 8242
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 11 Nov 2011 16:08

New build of dotConnect for Oracle 6.50.244 is available for download now!
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=22547 .

Post Reply