There is no store type corresponding to the conceptual side type 'Geography' of primitive type 'Geography'

こ雲淡風輕ζ 提交于 2019-12-12 01:38:52

问题


This error occurs on a pretty straightforward MVC 5 site using Entity Framework 6 in a code first implementation. Several of the models use System.Data.Entity.Spatial.DbGeography like the following model.

using System;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.Spatial;

namespace ProjectName.Models
{
    public class PostalCode
    {
        [Key]
        [MaxLength(10)]
        public string PostalCodeValue { get; set; }
        public int Country { get; set; }
        [MaxLength(2)]
        public string StateAbbr { get; set; }
        public DbGeography Geo { get; set; }
    }
}

During the production move to an external test environment we receive the following error:

There is no store type corresponding to the conceptual side type 'Geography' of primitive type 'Geography'.


回答1:


This error is a bit misleading. In our case, the connection string pointed to the database for the previous version of the site which was older than SQL2012.

The reason this occurs is because the database targeted is not capable of handling this data type. If you receive this verify that the connection string targets the correct database and that it is capable of the data type the error specifies.



来源:https://stackoverflow.com/questions/39520364/there-is-no-store-type-corresponding-to-the-conceptual-side-type-geography-of

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!