Collation on EF Core Migration

123 views
Skip to first unread message

Alan Braga

unread,
Jun 13, 2022, 4:06:28 PM6/13/22
to firebird-net-provider
Hi!

Is there a way to define Collation to the database during creation?
I've tried the code below, but it didn't work.

modelBuilder.UseCollation("PT_BR");

It would be ok if I change via property, but this code didn't work as well:

builder.Property(e => e.MyProperty).HasMaxLength(200).UseCollation("PT_BR");

I'm using dotnet 6 and charset=ISO8859_1 in my connection string.

Thanks in advance.

Jiří Činčura

unread,
Jun 15, 2022, 1:56:16 PM6/15/22
to 'Mr. John' via firebird-net-provider
This is not possible. In fact, I think I'm not providing a way to specify collation via FbConnection (only charset).

Feel free to create issue as a request.

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

Alan Braga

unread,
Jun 15, 2022, 3:44:37 PM6/15/22
to firebird-n...@googlegroups.com
I think it is not possible to connect with a different collation, you can define this during database creation only.

<db_config_option> ::=
    DEFAULT CHARACTER SET default_charset
      [COLLATION collation] -- not supported in ESQL
  | <sec_file>
  | DIFFERENCE FILE 'diff_file' -- not supported in ESQL

You can create a field with different collate than the database default

<regular_col_def> ::=
  colname {<datatype> | domainname}
  [DEFAULT {<literal> | NULL | <context_var>}]
  [<col_constraint> ...]
  [COLLATE collation_name]
That's why I've created my tests the way I did.
For now I'm going to create an empty database with the right collation and charset. This way ef migrations only create the tables and fields.
I'm going to create a request on github.
Thanks

--
You received this message because you are subscribed to a topic in the Google Groups "firebird-net-provider" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebird-net-provider/podQIJvQ0k4/unsubscribe.
To unsubscribe from this group and all its topics, 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/74529fa2-9caf-4fa6-b3cf-84774400c76a%40www.fastmail.com.

Jiří Činčura

unread,
Jun 15, 2022, 4:07:55 PM6/15/22
to 'Mr. John' via firebird-net-provider
Not connect. But FbConnection has also CreateDatabase method.

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

On Wed, Jun 15, 2022, at 21:44, Alan Braga wrote:
> I think it is not possible to connect with a different collation, you
> can define this during database creation only.
>
> <db_config_option> ::=
> DEFAULT CHARACTER SET *default_charset*
> [COLLATION *collation*] -- *not supported in ESQL*
> | <sec_file>
> | DIFFERENCE FILE '*diff_file*' -- *not supported in ESQL*
>
> You can create a field with different collate than the database default
>
> <regular_col_def> ::=
> *colname* {<datatype> | *domainname*}
> [DEFAULT {<literal> | NULL | <context_var>}]
> [<col_constraint> ...]
> [COLLATE *collation_name*]That's why I've created my tests the way I
> did.For now I'm going to create an empty database with the right
> collation and charset. This way ef migrations only create the tables
> and fields.I'm going to create a request on github.Thanks
>
> Em qua., 15 de jun. de 2022 às 14:56, Jiří Činčura <ji...@cincura.net> escreveu:
>> This is not possible. In fact, I think I'm not providing a way to specify collation via FbConnection (only charset).
>>
>> Feel free to create issue as a request.
>>
>> --
>> Mgr. Jiří Činčura
>> https://www.tabsoverspaces.com/
>>
>> --
>> You received this message because you are subscribed to a topic in the Google Groups "firebird-net-provider" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebird-net-provider/podQIJvQ0k4/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to firebird-net-pro...@googlegroups.com <mailto:firebird-net-provider%2Bunsu...@googlegroups.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/CAGONOBk21G0bx2KQLycG5ez-CLvZMMfnBQJz%2BToKg9RW2gWSKg%40mail.gmail.com
> <https://groups.google.com/d/msgid/firebird-net-provider/CAGONOBk21G0bx2KQLycG5ez-CLvZMMfnBQJz%2BToKg9RW2gWSKg%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Alan Braga

unread,
Jun 15, 2022, 4:18:10 PM6/15/22
to firebird-n...@googlegroups.com
Good to know... I didn't need it yet.


I hope it's clear and right...

Thanks again!

To unsubscribe from this group and all its topics, 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/9988c870-1bad-4816-8340-9057c508d2a8%40www.fastmail.com.
Reply all
Reply to author
Forward
0 new messages