EntityFrameworkCore.FirebirdSQL icon indicating copy to clipboard operation
EntityFrameworkCore.FirebirdSQL copied to clipboard

Token unknown

Open Cae2 opened this issue 6 years ago • 2 comments

Hello, Im trying to implement this package and when I try to return simple query it works, for example:

var result = context.Blog.Take(10).ToList();

but if I try to use the relationship with "Posts" for example:

var result = context.Blog.Include(p => p.Posts).Take(10).ToList();

I got the error:

Dynamic SQL Error SQL error code = -104 Token unknown - line 1, column 25

I searched about this Token Error and found some information about ADO FirebirdClient is only tested for FB 3.0 (and I'm using FB 2.5). This is the cause or I'm doing something wrong?

Thank you

Cae2 avatar Sep 01 '18 17:09 Cae2

Same here. I try to create my database with code first migrations.

Unhandled Exception: FirebirdSql.Data.FirebirdClient.FbException: Dynamic SQL Error SQL error code = -104 Token unknown - line 9, column 32 __EFMigrationsHistory ---> FirebirdSql.Data.Common.IscException: Dynamic SQL Error SQL error code = -104 Token unknown - line 9, column 32

class Program
{
    static void Main(string[] args)
    {
        using (var dbcontext = new BloggingContextFb())
        {
            dbcontext.Database.Migrate();
        }
        Console.ReadLine();
    }
}
public class BloggingContextFb : BloggingContext
{
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        var connectionStringBuilder = new FbConnectionStringBuilder();
        connectionStringBuilder.UserID = "SYSDBA";
        connectionStringBuilder.Password = "masterkey";
        connectionStringBuilder.Database = "d:/database/blogdb.fdb";
        connectionStringBuilder.DataSource = "localhost";
        connectionStringBuilder.Port = 3050;
        connectionStringBuilder.Pooling = true;
        connectionStringBuilder.MinPoolSize = 0;
        connectionStringBuilder.MaxPoolSize = 100;
        connectionStringBuilder.Dialect = 3;
        var connectionString = connectionStringBuilder.ConnectionString;

        optionsBuilder.UseFirebird(connectionString);
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Blog>(builder =>
        {
            builder.HasIndex(e => e.BlogId)
                .HasName("Id")
                .IsUnique();
        });
        modelBuilder.Entity<Post>(builder =>
        {
            builder.HasIndex(e => e.PostId)
                .HasName("Id")
                .IsUnique();
        });
    }
}

public class Blog
{
    public int BlogId { get; set; }
    public string Url { get; set; }
    public int Rating { get; set; }
    public List<Post> Posts { get; set; }
}

public class Post
{
    public int PostId { get; set; }
    public string Title { get; set; }
    public string Content { get; set; }

    public int BlogId { get; set; }
    public Blog Blog { get; set; }
}

The FirebirdSql.EntityFrameworkCore.Firebird from Jiri works well here, but doesn't create TRIGGERS and GENERATORS for Primary Keys.

Andyriod avatar Nov 09 '18 15:11 Andyriod

Sorry folks I had a lot of work here in the company.

This will be corrected as soon as possible.

ralmsdeveloper avatar Nov 10 '18 16:11 ralmsdeveloper