Generator creation

30 views
Skip to first unread message

Marcelo Krol

unread,
Apr 7, 2021, 1:18:53 PM4/7/21
to firebird-n...@googlegroups.com
Estou com um problema e uma dúvida ao mesmo tempo. Estou tentando usar o EF6 no firebird 2.5, esta indo bem, mas ao criar a tabela com a migração, nos campos auto incremento é criado apenas um Gerador (GEN_IDENTITY). Já pesquisei em várias lugares, e ainda não encontrei uma forma de contornar essa situação.

Jiří Činčura

unread,
Apr 7, 2021, 1:21:38 PM4/7/21
to 'Mr. John' via firebird-net-provider
You can customize that behavior by implementing IFbMigrationSqlGeneratorBehavior. Default behavior is in DefaultFbMigrationSqlGeneratorBehavior (not sealed).

--
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/

Marcelo Krol

unread,
Apr 7, 2021, 2:00:25 PM4/7/21
to firebird-n...@googlegroups.com
Hello Jiri, thanks for the feedback. I even found this statement of yours in another post, somewhere, I also looked at the sources on git, but I didn't find it, or I didn't understand how to make such an implementation. If you have an example for q can help me.

--
You received this message because you are subscribed to the Google Groups "firebird-net-provider" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-net-pro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebird-net-provider/0332e35c-6358-46e2-8126-2c80d51f24fd%40www.fastmail.com.

Jiří Činčura

unread,
Apr 7, 2021, 2:18:06 PM4/7/21
to 'Mr. John' via firebird-net-provider
The example can actually be DefaultFbMigrationSqlGeneratorBehavior.

Marcelo Krol

unread,
Apr 7, 2021, 6:45:50 PM4/7/21
to firebird-n...@googlegroups.com
I managed to implement it, but I think the CreateSequenceTriggerSequenceName method of the FbMigrationSqlGeneratorBehavior class is wrong. Looking at the sources I believe it should be like this:
protected virtual string CreateSequenceTriggerSequenceName (string columnName, string tableName, string schemaName)
{
// return "GEN_IDENTITY";
return $ "GEN_ {tableName} _ {columnName}";
}
because when executing the method, the generator with the name of: GEN_IDENTITY is still being created

--
You received this message because you are subscribed to the Google Groups "firebird-net-provider" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-net-pro...@googlegroups.com.

Jiří Činčura

unread,
Apr 8, 2021, 1:31:07 AM4/8/21
to 'Mr. John' via firebird-net-provider
That's EFCore, not EF6.

--
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/

On Thu, Apr 8, 2021, at 00:45, Marcelo Krol wrote:
> I managed to implement it, but I think the
> CreateSequenceTriggerSequenceName method of the
> FbMigrationSqlGeneratorBehavior class is wrong. Looking at the sources
> I believe it should be like this:
> protected virtual string CreateSequenceTriggerSequenceName (string
> columnName, string tableName, string schemaName)
> {
> // return "GEN_IDENTITY";
> return $ "GEN_ {tableName} _ {columnName}";
> }
> because when executing the method, the generator with the name of:
> GEN_IDENTITY is still being created
>
> Em qua., 7 de abr. de 2021 às 15:18, Jiří Činčura <ji...@cincura.net> escreveu:
> > The example can actually be DefaultFbMigrationSqlGeneratorBehavior.
> >
> > --
> > Mgr. Jiří Činčura
> > https://www.tabsoverspaces.com/
> >
> > --
> > You received this message because you are subscribed to the Google Groups "firebird-net-provider" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to firebird-net-pro...@googlegroups.com <mailto:firebird-net-provider%2Bunsu...@googlegroups.com>.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/firebird-net-provider/06fbee5e-bb45-498e-b187-ce0d0b4b8caa%40www.fastmail.com.
>
> --
> You received this message because you are subscribed to the Google
> Groups "firebird-net-provider" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to firebird-net-pro...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/firebird-net-provider/CADDM_%3Dy%2BMCW5Bji3GV0ao9W45f3UaeUOzgCUkX4Td4k0r3vJqg%40mail.gmail.com <https://groups.google.com/d/msgid/firebird-net-provider/CADDM_%3Dy%2BMCW5Bji3GV0ao9W45f3UaeUOzgCUkX4Td4k0r3vJqg%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Marcelo Krol

unread,
Apr 8, 2021, 7:00:08 AM4/8/21
to firebird-n...@googlegroups.com
But for EF6 the package is not ready yet?

Jiří Činčura

unread,
Apr 8, 2021, 10:20:50 AM4/8/21
to 'Mr. John' via firebird-net-provider
What do mean "not ready"?

Marcelo Krol

unread,
Apr 8, 2021, 10:58:21 AM4/8/21
to firebird-n...@googlegroups.com
You answered like this:

"That's EFCore, not EF6."
So I asked if the package was functional for EF6.

But regardless of whether it is functional or not, I think the method is wrong there, because it returns a default value, not observing the parameters: "columnName" and "tableName"

--
You received this message because you are subscribed to the Google Groups "firebird-net-provider" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-net-pro...@googlegroups.com.

Jiří Činčura

unread,
Apr 8, 2021, 12:14:15 PM4/8/21
to 'Mr. John' via firebird-net-provider
> You answered like this:
> "That's EFCore, not EF6."
> So I asked if the package was functional for EF6.

No.

> But regardless of whether it is functional or not, I think the method
> is wrong there, because it returns a default value, not observing the
> parameters: "columnName" and "tableName"
>

It is not. And it's not default value. It's THE value.

Marcelo Krol

unread,
Apr 8, 2021, 2:05:46 PM4/8/21
to firebird-n...@googlegroups.com
If this is correct, why does the CreateIdentitySequenceName method wait for two parameters and return a fixed string?
Look at the method like this:
protected virtual string CreateIdentitySequenceName (string columnName, string tableName)
{
return "GEN_IDENTITY";
}

--
You received this message because you are subscribed to the Google Groups "firebird-net-provider" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-net-pro...@googlegroups.com.

Jiří Činčura

unread,
Apr 8, 2021, 2:52:13 PM4/8/21
to 'Mr. John' via firebird-net-provider
> If this is correct, why does the CreateIdentitySequenceName method wait
> for two parameters and return a fixed string?

Because the provided implementation does not need these values. It's using single generator.

Marcelo Krol

unread,
Apr 8, 2021, 3:59:47 PM4/8/21
to firebird-n...@googlegroups.com
But how will only one generator be used if the bank has several tables?

--
You received this message because you are subscribed to the Google Groups "firebird-net-provider" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-net-pro...@googlegroups.com.

Jiří Činčura

unread,
Apr 9, 2021, 1:15:59 AM4/9/21
to 'Mr. John' via firebird-net-provider
Yes.

--
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/

On Thu, Apr 8, 2021, at 21:59, Marcelo Krol wrote:
> But how will only one generator be used if the bank has several tables?
>
> Em qui., 8 de abr. de 2021 às 15:52, Jiří Činčura <ji...@cincura.net> escreveu:
> > > If this is correct, why does the CreateIdentitySequenceName method wait
> > > for two parameters and return a fixed string?
> >
> > Because the provided implementation does not need these values. It's using single generator.
> >
> > --
> > Mgr. Jiří Činčura
> > https://www.tabsoverspaces.com/
> >
> > --
> > You received this message because you are subscribed to the Google Groups "firebird-net-provider" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to firebird-net-pro...@googlegroups.com <mailto:firebird-net-provider%2Bunsu...@googlegroups.com>.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/firebird-net-provider/2e468eaf-88e3-4b5c-8b7d-c32cf67f25f6%40www.fastmail.com.
>
> --
> You received this message because you are subscribed to the Google
> Groups "firebird-net-provider" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to firebird-net-pro...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/firebird-net-provider/CADDM_%3Dwnat5Lyn1iutJVRSnWftXtwimHz0NYB_-AiLxQ8kCqZw%40mail.gmail.com <https://groups.google.com/d/msgid/firebird-net-provider/CADDM_%3Dwnat5Lyn1iutJVRSnWftXtwimHz0NYB_-AiLxQ8kCqZw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages