sjh37 / EntityFramework-Reverse-POCO-Code-First-Generator

EntityFramework Reverse POCO Code First Generator - Beautifully generated code that is fully customisable. This generator creates code as if you reverse engineered a database and lovingly created the code by hand. It is free to academics (you need a .edu or a .ac email address), not free for commercial use. Obtain your licence from
https://www.reversepoco.co.uk/
Other
710 stars 227 forks source link

The store type 'bigint' could not be found in the Npgsql provider manifest #736

Closed uyau closed 1 year ago

uyau commented 2 years ago

The same error for "integer" and date "timestamp without time zone" and maybe more, i didn't go further. Why so, if database have this types?

uyau commented 2 years ago

Found table with types that allows rewrite the table cofiguration. Bigint will be int8. integer - int4. after replacing HasColumnType() with that types all work fine. https://www.postgresql.org/docs/8.1/datatype.html

sjh37 commented 2 years ago

Thanks @uyau I'll make sure this gets corrected for the next release.

uyau commented 2 years ago

also small int goes like "int2" and "timestamp without time zone" just "timestamp". Thats all problem types that I had issue with. 4 types. Maybe there can be some more, but not in my db) Don't have time to sit and test it out)

sjh37 commented 2 years ago

Can you post the PostgresToCSharp C# file here that you modified so I can see what you changed 👍

sjh37 commented 2 years ago

@uyau in your <database>.tt file, approx line 14, do you have your Settings.Database set to PostgreSQL?

Settings.DatabaseType = DatabaseType.PostgreSQL;
uyau commented 2 years ago

@sjh37 I had follow your instruction by installing msi into GAC, after I installed pacage EntityFramework6.Npgsql with that comes all other packages needed like Npgqls and EF... Then I set settings in tt: Settings.DatabaseType = DatabaseType.PostgreSQL; Settings.TemplateType = TemplateType.Ef6; Settings.GeneratorType = GeneratorType.Ef6; Settings.GenerateSeparateFiles = true; And adding connection string in my web.config

Aftet I save tt. And try to run application. First errors to fix: In generated "MyDbContext.cs" class I have to change
line - 86 "public bool IsSqlParameterNull(NpgsqlParameter param)" to NpgsqlParameter (or maybe add using npgsql, don't remember) and line 88 "var sqlValue = param.SqlValue;" to param.NpgsqlValue

Then I run application and in first linq I have error with bigint. Next I open every tableConfiguration and in lines like: Property(x => x.Id).HasColumnName(@"Id").HasColumnType("int4").IsRequired() I'm changing "HasColomnType" to int8,int4, int2 and timezone like I sad earlyer. And after that everything works fine for me) That's all steps I did. Nothing more)

uyau commented 2 years ago

This solution worked for .net Framework 4.5 and 4.7. Same sequence in both case

GFoley83 commented 1 year ago

Aftet I save tt. And try to run application. First errors to fix: In generated "MyDbContext.cs" class I have to change line - 86 "public bool IsSqlParameterNull(NpgsqlParameter param)" to NpgsqlParameter (or maybe add using npgsql, don't remember) and line 88 "var sqlValue = param.SqlValue;" to param.NpgsqlValue

Thank you @uyau. This fixed my error with a brand new solution using EF7 Core and .NET Core for PostgreSQL. Definitely a bug that needs to be fixed.

sjh37 commented 1 year ago

This has been released in v3.8.2. Any problems, please let me know.