Domanda

I'm getting an Unknown data type error with Firebird Embedded when I try to use Linq to query the context.

It only seems to fail when Linq generates a parameterized query to send to the database; if the value is hard-coded, it works fine. Also, it only fails on my Code First database; if I create the database first, it works. However, I'm trying to learn Code First so creating the database isn't an option.

using (var context = new FirebirdDbContext(connectionString))
{
    context.Users.Add(new User()
    {
        Created = DateTime.Now,
        Name = "smith"
    });
    context.SaveChanges();

    bool found = context.Users.Any(u => u.Name == "smith");    // this works
    string name = "smith";
    found = context.Users.Any(u => u.Name == name);    // exception
}

The rest of the application is the same as in my other post except I'm now using Entity Framework 6.1.0. In fact, the error is the same too, but the cause is different.

I'd be surprised if this were a bug in the Firebird library (and I don't see it listed in their bug tracker). Does anyone know what I'm doing wrong?

Edit: The bug still occurs with the Firebird ADO.NET Provider (for Entity Framework 6) version 4.1.5.0.

È stato utile?

Soluzione 2

This is a bug in the data provider, which has been logged in the Firebird issue tracker. The reporter of that bug has kindly provided a fix.

The fix has not yet been incorporated into the official release, but I was able to download the provider source and apply the fix to get past this issue with my application.

Altri suggerimenti

There is too few information.

Try mapping all tables and columns names to uppercase, using ToTable and HasColumnName in fluent mappings.

When I did that most of weird errors gone away when I was validating the compatibility of Entity framework and Firebird 2.5 embeded.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top