Skip to content
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

Problem with Tablename and CodeFirst [DNET753] #695

Closed
firebird-issue-importer opened this issue Apr 19, 2017 · 11 comments
Closed

Problem with Tablename and CodeFirst [DNET753] #695

firebird-issue-importer opened this issue Apr 19, 2017 · 11 comments

Comments

@firebird-issue-importer

Submitted by: Andreas Patock (apatock)

Is related to DNET754

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.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 19, 2017

Commented by: @cincuranet

You're required to properly configure your DbContext to fit Firebird's limitations. There's nothing I can do about it.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 19, 2017

Modified by: @cincuranet

status: Open [ 1 ] => Closed [ 6 ]

resolution: Won't Fix [ 2 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 19, 2017

Commented by: Andreas Patock (apatock)

For example:

public class KSC_ATE_OVERRIDE_RESERVE
{
public int ID { get; set; }
}

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

If I write the following:

public class KSC_ATE_OVERRIDE_RESERVE
{
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int ID { get; set; }
}

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 19, 2017

Commented by: Andreas Patock (apatock)

I maybe found it:

It is the name of the before insert trigger.

Do you know how to override the generator for this?

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 20, 2017

Commented by: Andreas Patock (apatock)

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,
Andreas

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 20, 2017

Commented by: @cincuranet

Sure. That's easy to do.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 20, 2017

Modified by: @cincuranet

Link: This issue block progress on DNET754 [ DNET754 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 20, 2017

Modified by: @cincuranet

Link: This issue is related to DNET754 [ DNET754 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 20, 2017

Modified by: @cincuranet

Link: This issue block progress on DNET754 [ DNET754 ] =>

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 20, 2017

Commented by: @cincuranet

Added as DNET754.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants