PostgreSQL - NetTopologySuite & ABP.IO - Not support mapping problems

90 views Asked by At

i made additions as in the documentation but I get an error when i do dotnet ef migrations. abp.io v7.3.3 & postgresql

Station.cs

[Column(TypeName="geography")]
   public virtual Point Location { get; set; }

DbContext.xs

protected override void OnModelCreating(ModelBuilder builder)
{ 
   ...
   /* Include modules to your migration db context */    
   builder.HasPostgresExtension("postgis");
   builder.Entity<Station>().Property(b => b.Location).HasColumnType("geography");
   ...
}
public override void ConfigureServices(ServiceConfigurationContext context)
   {
       var dataSourceBuilder = new NpgsqlDataSourceBuilder("Host=localhost;Port=5432;Database=SarJz;User ID=postgres;Password=myPassw0rd;");
       dataSourceBuilder.UseNetTopologySuite();
       var dataSource = dataSourceBuilder.Build();
        
       context.Services.AddDbContext<SarJzDbContext>(options =>
          options.UseNpgsql(dataSource, o => o.UseNetTopologySuite()));
   }

but i still get this error;

dotnet ef migrations add RenewedStationGeometry
Build started...
Build succeeded.

The Entity Framework tools version '7.0.5' is older than that of the runtime '7.0.11'. Update the tools for the latest features and bug fixes. See https://aka.ms/AAc1fbw for more information.

System.InvalidOperationException: The 'Point' property 'Station.Location' could not be mapped to the database type 'geography' because the database provider does not support mapping 'Point' properties to 'geography' columns. Con
sider mapping to a different database type or converting the property value to a type supported by the database using a value converter. See https://aka.ms/efcore-docs-value-converters for more information. Alternately, exclude
the property from the model using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.

I did the same with the documentation and nothing changed.

0

There are 0 answers