[–] logos_ethos 0 points 1 point 1 point (+1|-0) ago (edited ago)
Again, I am not sure how Entity Framework might deal with citext, but I found a few things to try:
It seems like https://msdn.microsoft.com/en-us/library/system.data.entity.modelconfiguration.configuration.stringcolumnconfiguration.hascolumntype(v=vs.113).aspx can be used to accept citext:
This seems to set it globally, which means that you probably want to use citext only (no varchar/text) for strings.
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Properties<string>()
.Configure(s => s.HasColumnType("public.citext") );
base.OnModelCreating(modelBuilder);
}
Or for each column:
[Column(TypeName = "public.citext")]
You may need to delete the "public." and set search_path to 'public,dbo' That might be the sane thing to do anyway, as there will probably be other things in the public schema that you want to use and do not want to specify the full path to each time that you use them.
If Entity Framework insists on putting a length on strings (if HasMaxLength cannot be removed some how), I can fork the citext extension to make it accept a length. However, you need to be running your own PostgreSQL server if you want to use custom extensions.
I might be able to setup a Windows cloud server to help test the EF stuff. I might need help though.
[–] PuttItOut 0 points 2 points 2 points (+2|-0) ago
So I've imported the schema and run the tests, and they all failed with:
The code above is using EF6 while we are using EF Core, similar but different. If I am going to use this I can not annotate models because I would have to use conditional compilation and I do not want to add this complexity to Voat's code base.
This seems that once we find an alternate way to perform the following line we can actually use this technique.
Attn @FuzzyWords
[–] logos_ethos 0 points 1 point 1 point (+1|-0) ago
Is https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL something that you can use? It supports citext, but I think that you have to change:
to
in both files so that the server sends back "citext" instead of "public.citext".