Activities of "Leonardo.Willrich"

It works in a simple project. I'm checking the Nuget package versions, but, it seems to be Ok. I've updated the other project to version 7.2.1 and it is still working. It is just in one project that I'm getting those weird issues. It seems that the UseNetTopologySuite() is not working and it is not mapping the types correctly.

HI Maliming,

I also think it is related to NpgSQL. I've raised an issue in the Github. What is bugging me is that I've migrated another similar project recently to version 7.1.0 and that worked very well. The projects are very similar, especially EntityFramework and Domain projects.

I'll create a simple project and see how it goes.

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v7.2.1
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

It can be a long shot, but, I think it is worth a try asking here as it could be experienced by another user as well. I have migrated an application Blazor WASM from 5.3 to 7.2.1. After the migration, when I'm trying to query a table with a 'geometry' field type, it is returning an exception as below:

[14:31:38 ERR] Can't cast database type .<unknown> to Geometry System.InvalidCastException: Can't cast database type .<unknown> to Geometry at Npgsql.Internal.TypeHandling.NpgsqlTypeHandler.ReadCustom[TAny](NpgsqlReadBuffer buf, Int32 len, Boolean async, FieldDescription fieldDescription) at Npgsql.NpgsqlDataReader.GetFieldValue[T](Int32 ordinal) at lambda_method5475(Closure, DbDataReader, Int32[]) at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.ReadObject(DbDataReader reader, Int32 ordinal, ReaderColumn column) at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.ReadRow() at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.InitializeAsync(DbDataReader reader, IReadOnlyList1 columns, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.InitializeAsync(IReadOnlyList1 columns, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.InitializeAsync(IReadOnlyList1 columns, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken) at TVD_Holdings_Ltd.SBC.SBC.UnitsMap.UnitsMapAppService.GetTestRecordsFromTestPostgis() in D:\Source\SmartBridge\SbcWeb530\src\TVD_Holdings_Ltd.SBC.Application\SBC\UnitsMap\UnitsMapAppService.cs:line 89 at lambda_method5469(Closure, Object) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

I created a new table and EF first code is creating the table correctly. But, adding a record on this I'm getting this exception:

[14:05:31 ERR] An exception occurred in the database while saving changes for context type 'TVD_Holdings_Ltd.SBC.EntityFrameworkCore.SBCDbContext'. Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Npgsql.NpgsqlException (0x80004005): The NpgsqlDbType 'Geometry' isn't present in your database. You may need to install an extension or upgrade to a newer version.

Do you have any idea what could be wrong? If I return to the previous version, 5.3 and .NET 6, it works with no issues.

Ok, I'll try it.

Hi, I've sent an email with projects EntityFramework, Domain, and Domain.Shared.

To create a new migration, I'm using Package Manager Console, selecting EntityFramework project in the combo-box, and then using this command: add-migration Migration_7.2.0 -context SBCDbContext

It will create the code changing DateTime fields from "date with time zone" to "date without time zone".

I did that multiple times, with the options or without the options, but it is still creating that code in the migration file.

Hi Maliming,

I have those properties, exacly like the template. Anyway, it is trying to convert the DateTime types in the DB.

  • ABP Framework version: v7.2.0.rc2
  • UI type: Blazor
  • DB provider: EF Core - PostgreSQL
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Hi,

After having done the upgrade from 5.3 to 7.2 rc, I have added a migration in the EF project and have noticed that all DateTime fields are being changed from "with time zone" to "without time zone". Is it a problem? How can I avoid it? Is there some property to set?

In CreateDbContext class, I have this option"

         // https://www.npgsql.org/efcore/release-notes/6.0.html#opting-out-of-the-new-timestamp-mapping-logic
        AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

Here is an example:

 migrationBuilder.AlterColumn<DateTime>(
                name: "LastModificationTime",
                table: "SaasTenants",
                type: "timestamp without time zone",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone",
                oldNullable: true);

Excellent, it worked like a charm! As a suggestion, it would be the default implementation for the framework.

Hi, My project is very similar to a fresh new template. I'm using OpenIdict. You can download a new template using EF and Blazor WASM, just log in and logout, you will see it goes to the host and then goes to Blazor and finally is redirected to the host login page again.

Showing 21 to 30 of 192 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 19, 2024, 10:13