Skip to content

Working with Store Procedure and Transaction #59

@edidiway

Description

@edidiway

Hi, I have issue while working with stored procedure
my stored procedure have update command, and after the execution, I tried to retrieve the updated record.
my code is like below

using (var dbContextScope = dbContextScopeFactory.CreateWithTransaction(IsolationLevel.Serializable))
{
	var vendorID = "12345";
	
	//in this function, it will run SP, and inside the SP will update the vendor document status
	result = VendorProvider.spRecalculateVendorDocument(vendorID); 

	//get vendor document
	//vendorDocument object still have old status
	vendorDocument = VendorProvider.GetVendorDocument(vendorID);

	//commit database CRUD
	//after commit the db, vendor document status is updated to new one
	await dbContextScope.SaveChangesAsync();
}

the problem is, the vendorDocument object still hold the old data, although after execute dbContextScope.savechange(). the value in database will be updated to new one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions