ErikEJ / EFCorePowerTools

Entity Framework Core Power Tools - reverse engineering, migrations and model visualization in Visual Studio & CLI
MIT License
2.16k stars 295 forks source link

Map Geometry type in stored procedures parameter #1400

Closed Dimigergo closed 2 years ago

Dimigergo commented 2 years ago

It is different from the function parameter like #1399, because in this case the parameter should have to be byte[], because the SqlServer SqlDbType.Udt enumeration does not have NTS, and throws Exception. It is only in the stored procedures!!!

error2

The corrent parameter: byte[] pPolygon error2_ok

ErikEJ commented 2 years ago

OMG!!

So if the parameter type is byte[], the parameter mapping works as expected?

Dimigergo commented 2 years ago

Yes, but only in the stored provedures, because of the SqlParameter SqlDbType enum. :)

The NTS can convert Geometry to byte array, so the calling of the SP is simple.

ErikEJ commented 2 years ago

What if the SqlParameter SqlDbType was different? And what other value should it have in that case?

Dimigergo commented 2 years ago

I can't find other type that should be correct. :( These types are the SqlServer supported base types.

ErikEJ commented 2 years ago

What is the full text of the exception thrown?

Dimigergo commented 2 years ago

Sorry, I forgot to copy.

Specified type is not registered on the target server. NetTopologySuite.Geometries.Polygon, NetTopologySuite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=f580a05016ebada1.

error3

Dimigergo commented 2 years ago

Please be careful, because this sp function is in the interface at the top of the generated file!

ErikEJ commented 2 years ago

I will - luckily generated in the same class.