Open mmisnerms opened 4 years ago
I will investigate, for now set
Settings.DisableGeographyTypes=true;
@mmisnerms This has now been correctly implemented. Grab the latest EF.Reverse.POCO.v3.ttinclude file.
Install the following NuGet package:
Install-Package Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite
Re-save your <database>.tt
file to regenerate.
Also have a read of this wiki page
Released in v3.1.1
Thank you for addressing this so quickly!
The new release resolved the type not found problem with Spatial.DbGeography in my entities.
But SP return model is still trying to use Microsoft.SqlServer.Types.SqlGeography.
I changed to NetTopologySuite.Geometries.Point to get past the type issue.
Now I am getting
"The property 'column' is of type 'Point' which is not supported by current database provider. Either change the property CLR type or ignore the property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'."
Also, Point type is geometry X,Y,Z. I am looking for sql server geography type which has Longitude and Latitude.
When opening your database, you need to add in the action UseNetTopologySuite
optionsBuilder.UseSqlServer(
@"Data Source=(local);Initial Catalog=YourDatabase;Integrated Security=True",
x => x.UseNetTopologySuite());
Thank you. That worked.
It is still generating Microsoft.SqlServer.Types.SqlGeography for stored procedure return model properties.
I also notice a syntax issue with string interpolation $ in the tt file. I am using tangible t4 editor extension.
column.Attributes.Add($"[Display(Name = \"{column.DisplayName}\")]");
ok, that bit Microsoft.SqlServer.Types.SqlGeography
is still a bug. Thanks for letting me know.
What's wrong with the Display name? Both forms are acceptable:
[DisplayName("Product name")]
[Display(Name = "Product name")]
Or have I missed something else?
I checked with the stackoverflow page, and both are acceptable, with [Display(Name = "Product name")]
being localisable.
It may just be me. The syntax of the tt file itself. VS is complaining that the $ string interpolation is not correct.
So if I change the tt file to column.Attributes.Add(string.Format("[Display(Name = \"{0}\")]", column.DisplayName)); VS no longer complains about syntax.
Updated the source code to stop tangible t4 complaining about that line. This will be in the next version.
Kept open for Microsoft.SqlServer.Types.SqlGeography
for stored procedure return model properties.
I was using Microsoft.SqlServer.Types with EF 6.4.
I am now migrating to EFCore 3.1 and unable to resolve the generated types for geography.
Spatial.DbGeography Microsoft.SqlServer.Types.SqlGeography