Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Working with Spatial Types #5796


User avatar
0
josus created

Hello again,

I am having a problem when I try to add a DBGeography property in a Model class. When I try to create the migration I receive this error:

Spatial types and functions are not available for this provider because the assembly ‘Microsoft.SqlServer.Types’ version 10 or higher could not be found.

I installed the nuget v14 in both, EntityFramework and Core projects with the same result. Migration is not created.

I have been working with spatial types in other projects without ABP without this issue. How can I solve it? It is mandatory for my project to work with Spatial Types.

Thanks in advance.


12 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @josus

    Are you using EntityFramework Core or Entity Framework 6.x ?

  • User Avatar
    0
    josus created

    6.x

  • User Avatar
    0
    ismcagdas created
    Support Team

    I haven't tried but the article below might help you to solve this problem. Have you seen it before ?

    https://www.andrewcbancroft.com/2017/03/27/solving-spatial-types-and-functions-are-not-available-with-entity-framework/

  • User Avatar
    0
    josus created

    Yes, I tried, it works on projects without ABP but, I don't know why, it doesn't work on ABP projects. As I saw in my first question, I tried to install the nuget in all the projects, include the Test project!!! and the result is always the same. I am unable to generate the migration.

  • User Avatar
    0
    ryancyq created
    Support Team

    Hi,

    there is a possibility of it caused by sql server installation came along with vs studio.

    https://docs.microsoft.com/en-us/ef/ef6/fundamentals/providers/spatial-support#prerequisites-for-spatial-types-with-microsoft-sql-server

    have you tried loading the assembly at runtime as mentioned in https://www.koskila.net/solving-the-spatial-types-and-functions-are-not-available-problem/ ?

  • User Avatar
    0
    josus created

    Hi again,

    I have SQL Server Developper edition installed on my dev machine. I also installed the SQLSysClrTypes.msi as described in the Microsoft page and the problem is still happening.

  • User Avatar
    0
    ismcagdas created
    Support Team

    @josus,

    Could you move the assembly loading code into the constructor of Configuration class in EntityFramework project ? I guess, Global.asax class is not runned when adding the migration.

  • User Avatar
    0
    josus created

    I will try

  • User Avatar
    0
    josus created

    Not working...

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @josus

    Sorry for my late response. I have worked on this issue but couldn't manage to do it.

    Have you figured out a solution ?

  • User Avatar
    0
    josus created

    Not yet, I googled for any tip without results. Perhaps another customer has implemented something similar and can help us to solve it.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @josus

    I worked on this but couldn't succeed, sorry.