SqlServer geography & NettopologySuite

Hello Radzen Team,
i have a question about spatial database (her: sqlServer) and how to get it to work in Radzen (if possible)

  1. I have installed the necessary packages:
    image
  2. I added it to UseSqlServer in Startup (dont know any other way, Startup in ignorelist, not nice...)
        services.AddDbContext<Trent.Data.TrentdbContext>(options =>
        {
          options.UseSqlServer(Configuration.GetConnectionString("trentdbConnection"),
                               x => x.UseNetTopologySuite());
        });

But... when i infer schema in Radzen the geography column do not appear in the Entities/Tables/Column List on the "Infer" PAge of Radzen.

Do you have any hints to me what to do to get it to work?
Or... can i get to work at all? (I realy dont want to put the startup class in the ignore list :-()

Kind Regards
Thomas

Hi @Thomas,

These types are not supported at the moment - the only option I can suggest is application ignore list.

Hi Thomas ,

Did you get this issue working ?

I mainly work wit Geo data in PostgreSQL database alongside a MSSQL database that is used with Radzen.
If Radzen can work with spatial data types maybe I can use only one
MSSQL database and move data from
PostgreSQL.

Thank you in advance for your reply.

Kind Regards,
Mehmet

Hi @mcanavar,
no. I didnt use any NetTopology functionality in mssql server.
to much effort to test if it brings any problems. i defined the model properties like
[LngGeo] DECIMAL(9, 6) NULL,
[LatGeo] DECIMAL(9, 6) NULL,
and do the calculations in seperate code in c#.

Greets
Thomas

1 Like

hi @mcanavar
We extended the Radzen generated class using the xxx.custom.cs feature and used a custom EF Core query. That's using MSQL, manually created spatial index, NetTopology, and net Core 3.1.

Hi @mumfie ,

I'm now on a new project and this same topic comes up again.
Could you provide some stepping stones for me , some pitfalls that you have encountered, maybe some example xxx.custom.cs .
Thank you in advance.

regards,
Mehmet

Hi @mcanavar
We moved the spatial stuff from the Radzen project to a separate net core API project as we needed to support msql, sql lite, multiple databases, and multiple clients. Some of the distance search is now implemented in msql stored procedures.
in original Radzen version we added DbxxxContext.custom.cs with

  protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            var configuration = (IConfiguration)this.httpAccessor.HttpContext.RequestServices.GetService(typeof(IConfiguration));
            optionsBuilder.UseSqlServer(configuration.GetConnectionString("DS1Connection"), x => x.UseNetTopologySuite());

        }

Hi @mumfie ,

Thank you for your reply, maybe it is wise to keep the spatial data columns outside of the Radzen datamodel.