Issue Details (XML | Word | Printable)

Key: DNET-753
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Jiri Cincura
Reporter: Andreas Patock
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
.NET Data provider

Problem with Tablename and CodeFirst

Created: 19/Apr/17 02:47 PM   Updated: 20/Apr/17 12:13 PM
Component/s: ADO.NET Provider
Affects Version/s:
Fix Version/s: None

Environment: Firebird 2.5 Server, EntityFramework6.1.3, .net 4.6.2
Issue Links:

 Description  « Hide
If we use a classname longer than 15 letters we get a "Name longer than database column size" on Update-Database.
I think someone does a byte count over a unicode string, so 16 letters result in 32 bytes and this is more than the firebird restriction.
What I wonder is that the problem didn't appear on foreignkey-names.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jiri Cincura added a comment - 19/Apr/17 03:01 PM
You're required to properly configure your DbContext to fit Firebird's limitations. There's nothing I can do about it.

Andreas Patock added a comment - 19/Apr/17 03:16 PM
For example:

    public int ID { get; set; }

didn't work! KSC_ATE_OVERRIDE_RESERVE is not longer than 31 chars.

If I write the following:

    public int ID { get; set; }

This is working and also creates a Primary Key ID in the Database.

Andreas Patock added a comment - 19/Apr/17 03:25 PM
I maybe found it:

It is the name of the before insert trigger.

Do you know how to override the generator for this?

Andreas Patock added a comment - 20/Apr/17 11:45 AM
Hi Jiri,
first of all - thank you for your great work!

Following to your last comment I created a CustomDbConfiguration and a new CustomFbMigrationSqlGeneratorBehavior. Then I first tried to return only the new Triggername from the CreateIdentityForColumn method. That of course doesn't work. I looked in the DefaultFbMigrationGeneratorBehavior and realized that I must return the complete SQLs for creating the Trigger.
So I copied the whole code to my CustomBehavior. But from there I can't use SQLWriter cause it's internal. I can't use the Quote method cause it's internal and so on.

Wouldn't it be easier to inherit from DefaultFbMigartionSqlGeneratorBehavior, make the CreateTriggerName virtual and override this? This would be great!

I know this is all for compatibility with other DBs, but due to the limitations of firebird (length of names), wouldn't it be nice if you provide a FbMigrationSqlGenerator which takes note of this limitations and offer this to the community. So they can use the naming rules you selected and can simply use the firebird database. If someone else want to use another naming scheme then he can implement all this by himself, but if someone just want to use firebird for simple datastructures he can just use your Generator and all is working. I think no one else knows the firebird database as you do - so you would be the right man for the job.

Please think of it.

Kind regards,

Jiri Cincura added a comment - 20/Apr/17 12:10 PM
Sure. That's easy to do.

Jiri Cincura added a comment - 20/Apr/17 12:13 PM
Added as DNET-754.