The property 'Id' on entity type 'ShippingByWeightByTotalRecord' has a temporary value

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
am getting a problem with 'ShippingByWeightByTotal' plugin
happened when am try to add a new record

Log level  
Error
Short message  
The property 'Id' on entity type 'ShippingByWeightByTotalRecord' has a temporary value while attempting to change the entity's state to 'Unchanged'. Either set a permanent value explicitly or ensure that the database is configured to generate values for this property.
Full message  
System.InvalidOperationException: The property 'Id' on entity type 'ShippingByWeightByTotalRecord' has a temporary value while attempting to change the entity's state to 'Unchanged'. Either set a permanent value explicitly or ensure that the database is configured to generate values for this property.
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState(EntityState oldState, EntityState newState, Boolean acceptChanges)
   at Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry.set_State(EntityState value)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Nop.Data.EfRepository`1.GetFullErrorTextAndRollbackEntityChanges(DbUpdateException exception) in E:\Testing\********\***********_4.10_Source\Libraries\Nop.Data\EfRepository.cs:line 51
   at Nop.Data.EfRepository`1.Insert(TEntity entity) in E:\Testing\***********\st-*******_4.10_Source\Libraries\Nop.Data\EfRepository.cs:line 86
   at Nop.Plugin.Shipping.FixedByWeightByTotal.Services.ShippingByWeightByTotalService.InsertShippingByWeightRecord(ShippingByWeightByTotalRecord shippingByWeightRecord)
   at Nop.Plugin.Shipping.FixedByWeightByTotal.Controllers.FixedByWeightByTotalController.AddRateByWeightByTotalPopup(ShippingByWeightByTotalModel model)
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 94
   at Nop.Services.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) in E:\Testing\*******\st-********_4.10_Source\Libraries\Nop.Services\Authentication\AuthenticationMiddleware.cs:line 79
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Nop.Core.Http.InstallUrlMiddleware.Invoke(HttpContext context, IWebHelper webHelper) in E:\Testing\_4.10_Source\Libraries\Nop.Core\Http\InstallUrlMiddleware.cs:line 51
   at Nop.Core.Http.KeepAliveMiddleware.Invoke(HttpContext context, IWebHelper webHelper) in E:\Testing\_4.10_Source\Libraries\Nop.Core\Http\KeepAliveMiddleware.cs:line 50
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
5 years ago
You may check to verify that your table is under the right schema. When i migrated to nop4.10. I left the installedplugin.json file blank and when i installed ShippingByWeight, it created the table in a schema under my username. I had to:
1. uninstall the plugin
2. delete the table
3. change my default schema for the SQL account in SSMS.
4. Reinstall the plugin.

Same thing happened with my tax plugin, there was duplicate tables on the database under different schemas. Settings was using one table and orders were using another.
5 years ago
it's fresh one downloaded from nopcommerce no upgrade
5 years ago
i do what you say and it's worked , i just removed the table and it's not created yet but worked
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.