-
Notifications
You must be signed in to change notification settings - Fork 818
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
EF6 can't generate a citext column when doing database-first #1029
Comments
@M144-Coder citext was introduced in Npgsql (at the ADO.NET layer), but that doesn't mean it's supported in EF6... @Emill want to take a look at this? |
I'm not really sure how the Code First approach works. Are you generating the database from C# specifications or have you already created your database and trying to get a model that works with it? Could you possibly send the stack trace? The normal way as far as I know for EF-non-supported data types have been to trick Entity Framework that the data type is simply text/string but the real data type is something else. |
Code first from database approach is the same as Code First approach except that the model is auto generated for you from existing database (with no edmx files) the rest is the same as code first approach. |
Unfortunately no, EF only supports the primitive types https://msdn.microsoft.com/en-us/library/ee382832(v=vs.110).aspx as well as some SQL Server specific geometry types. |
@M144-Coder is your problem specifically doing database-first (i.e. generating a C# code-first model from an existing database)? I think you should be able to do code-first by writing your C# model yourself by hand (or taking a database-first generated model and tweaking it), and "tricking" EF6 as @Emill said. |
@roji That is a good workaround, Thanks for your help |
Am going to close this because I don't think there's going to be a way to make EF6 database-first generate C# code that will do citext. For any issues using normal code-first feel free to open a new issue. |
Is citext column type now supported with EF Core when doing model-first ? |
@jducobu it's supported with a few caveats related to type inference (and should be better supported when EF Core 3.0 comes out). Simply manually define your the column's store type to be |
Details are in my stackoverflow question
http://stackoverflow.com/questions/36675132/citext-data-type-in-entity-framework-6-1-3
The text was updated successfully, but these errors were encountered: