Activities of "AutosledDBP"

Hi here's mine. I'm running the solution and executing the endpoints from the swagger. My database for this test is MS SQL Server. Don't know what else can I supply to further help understand why it's happening on my end.

Hi, it does not work either. Won't update count.

hi

Try this:

private async Task UpdateVehicleCount(Guid shipmentId) 
{ 
    using (var uow = this.UnitOfWorkManager.Begin(requiresNew: true)) 
    { 
        var shipment = await this.ShipmentRepository.GetAsync(shipmentId); 
        shipment.VehicleCount = shipment.Vehicles.Count; 
        await this.ShipmentRepository.UpdateAsync(shipment); 
 
        await uow.CompleteAsync(); 
    } 
} 

hi

Hi, I've tried this and doesn't work.

Can you share a simple project to show that?

Thanks.

liming.ma@volosoft.com

Hi, sorry for the delay. Sent simple project to show it via email.

hi

Can you call the await UnitOfWorkManager.Current.SaveChangesAsync(); after DeleteAsync?

eg:

await this.VehicleRepository.DeleteAsync(vehicleId); 
 
await UnitOfWorkManager.Current.SaveChangesAsync(); 
 
var shipment = await _shipmentRepository.GetAsync(shipmentId); 
var count = shipment.Vehicles.Count; 

Hi, I've tried this and doesn't work. Only work around I have is to add the following which I'd rather not do, which uses what you told me

public class EfCoreShipmentRepository : EfCoreServiceRepository<CoreServiceDbContext, Shipment, Guid>, IShipmentRepository
{
    public EfCoreShipmentRepository(IDbContextProvider<CoreServiceDbContext> dbContextProvider)
        : base(dbContextProvider)
    {
    }

    public override async Task<Shipment> GetAsync(Guid id, bool includeDetails = true, CancellationToken cancellationToken = default)
    {
        await this.UnitOfWorkManager.Current.SaveChangesAsync(cancellationToken);
        var dbContext = await this.GetDbContextAsync();
        var shipment = await base.GetAsync(id, includeDetails, cancellationToken);
        shipment.Vehicles = await dbContext.Vehicles
            .Where(x => x.ShipmentId == id)
            .ToListAsync(cancellationToken);
        return shipment;
    }

}
Showing 1 to 4 of 4 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 05, 2025, 09:28