{"id":221,"date":"2023-09-05T09:17:50","date_gmt":"2023-09-05T08:17:50","guid":{"rendered":"https:\/\/guillemrueda.com\/blog\/?p=221"},"modified":"2023-09-05T09:17:50","modified_gmt":"2023-09-05T08:17:50","slug":"entity-framework-core-i-transaccions","status":"publish","type":"post","link":"https:\/\/guillemrueda.com\/blog\/2023\/09\/05\/entity-framework-core-i-transaccions\/","title":{"rendered":"Entity Framework Core i transaccions"},"content":{"rendered":"\n<p>Punts claus que cal tenir en compte abans de comen\u00e7ar amb las transaccions amb EFCore<\/p>\n\n\n\n<p>Hi ha alguna pol\u00edtica activa de reintents (<em>EnableRetryOnFailure<\/em>):<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>En transaccions estar\u00e0s obligat a llan\u00e7ar-les com estrat\u00e8gies d&#8217;execuci\u00f3 <sup data-fn=\"d5de3c2b-cf31-431b-83e9-f6b83e5cc971\" class=\"fn\"><a href=\"#d5de3c2b-cf31-431b-83e9-f6b83e5cc971\" id=\"d5de3c2b-cf31-431b-83e9-f6b83e5cc971-link\">1<\/a><\/sup><\/li>\n\n\n\n<li>Aquestes estrat\u00e8gies estan lligades a la base de dades i al seu prove\u00efdor <sup data-fn=\"2a4e5b98-5af2-4d6f-850e-fd7e7171eb27\" class=\"fn\"><a href=\"#2a4e5b98-5af2-4d6f-850e-fd7e7171eb27\" id=\"2a4e5b98-5af2-4d6f-850e-fd7e7171eb27-link\">2<\/a><\/sup><\/li>\n<\/ul>\n\n\n\n<p>Tinc MARS (<em>Mutiple Active Results Sets<\/em>) actius:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>En transaccions no podr\u00e0s fer servir punts de retorn (CreateSavePoint, Rollback to SavePoint) <sup data-fn=\"b38e6127-7c3d-462e-85c2-39223ed6a974\" class=\"fn\"><a href=\"#b38e6127-7c3d-462e-85c2-39223ed6a974\" id=\"b38e6127-7c3d-462e-85c2-39223ed6a974-link\">3<\/a><\/sup><\/li>\n\n\n\n<li>Per aix\u00f2 caldr\u00e0 reduir els blocs que es fan canvis i evitar les indeterminacions que es poden vaure al fer SaveChanges sobre punts de retorn<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n<ol class=\"wp-block-footnotes\"><li id=\"d5de3c2b-cf31-431b-83e9-f6b83e5cc971\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/ef\/core\/miscellaneous\/connection-resiliency#execution-strategies-and-transactions\">https:\/\/learn.microsoft.com\/en-us\/ef\/core\/miscellaneous\/connection-resiliency#execution-strategies-and-transactions<\/a> <a href=\"#d5de3c2b-cf31-431b-83e9-f6b83e5cc971-link\" aria-label=\"Ves a la refer\u00e8ncia de la nota al peu 1\">\u21a9\ufe0e<\/a><\/li><li id=\"2a4e5b98-5af2-4d6f-850e-fd7e7171eb27\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/microsoft.entityframeworkcore.executionstrategyextensions.execute?view=efcore-7.0#microsoft-entityframeworkcore-executionstrategyextensions-execute(microsoft-entityframeworkcore-storage-iexecutionstrategy-system-action)\">https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/microsoft.entityframeworkcore.executionstrategyextensions.execute?view=efcore-7.0#microsoft-entityframeworkcore-executionstrategyextensions-execute(microsoft-entityframeworkcore-storage-iexecutionstrategy-system-action)<\/a> <a href=\"#2a4e5b98-5af2-4d6f-850e-fd7e7171eb27-link\" aria-label=\"Ves a la refer\u00e8ncia de la nota al peu 2\">\u21a9\ufe0e<\/a><\/li><li id=\"b38e6127-7c3d-462e-85c2-39223ed6a974\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/microsoft.entityframeworkcore.executionstrategyextensions.execute?view=efcore-7.0#microsoft-entityframeworkcore-executionstrategyextensions-execute(microsoft-entityframeworkcore-storage-iexecutionstrategy-system-action)\">https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/microsoft.entityframeworkcore.executionstrategyextensions.execute?view=efcore-7.0#microsoft-entityframeworkcore-executionstrategyextensions-execute(microsoft-entityframeworkcore-storage-iexecutionstrategy-system-action)<\/a> <a href=\"#b38e6127-7c3d-462e-85c2-39223ed6a974-link\" aria-label=\"Ves a la refer\u00e8ncia de la nota al peu 3\">\u21a9\ufe0e<\/a><\/li><\/ol>","protected":false},"excerpt":{"rendered":"<p>Punts claus que cal tenir en compte abans de comen\u00e7ar amb las transaccions amb EFCore Hi ha alguna pol\u00edtica activa de reintents (EnableRetryOnFailure): Tinc MARS (Mutiple Active Results Sets) actius:<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"[{\"content\":\"<a href=\\\"https:\/\/learn.microsoft.com\/en-us\/ef\/core\/miscellaneous\/connection-resiliency#execution-strategies-and-transactions\\\">https:\/\/learn.microsoft.com\/en-us\/ef\/core\/miscellaneous\/connection-resiliency#execution-strategies-and-transactions<\/a>\",\"id\":\"d5de3c2b-cf31-431b-83e9-f6b83e5cc971\"},{\"content\":\"<a href=\\\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/microsoft.entityframeworkcore.executionstrategyextensions.execute?view=efcore-7.0#microsoft-entityframeworkcore-executionstrategyextensions-execute(microsoft-entityframeworkcore-storage-iexecutionstrategy-system-action)\\\">https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/microsoft.entityframeworkcore.executionstrategyextensions.execute?view=efcore-7.0#microsoft-entityframeworkcore-executionstrategyextensions-execute(microsoft-entityframeworkcore-storage-iexecutionstrategy-system-action)<\/a>\",\"id\":\"2a4e5b98-5af2-4d6f-850e-fd7e7171eb27\"},{\"content\":\"<a href=\\\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/microsoft.entityframeworkcore.executionstrategyextensions.execute?view=efcore-7.0#microsoft-entityframeworkcore-executionstrategyextensions-execute(microsoft-entityframeworkcore-storage-iexecutionstrategy-system-action)\\\">https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/microsoft.entityframeworkcore.executionstrategyextensions.execute?view=efcore-7.0#microsoft-entityframeworkcore-executionstrategyextensions-execute(microsoft-entityframeworkcore-storage-iexecutionstrategy-system-action)<\/a>\",\"id\":\"b38e6127-7c3d-462e-85c2-39223ed6a974\"}]"},"categories":[7,19,22,6],"tags":[],"class_list":["post-221","post","type-post","status-publish","format-standard","hentry","category-net-programacio","category-c","category-entity-framework-core","category-programacio"],"_links":{"self":[{"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/posts\/221","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/comments?post=221"}],"version-history":[{"count":2,"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/posts\/221\/revisions"}],"predecessor-version":[{"id":223,"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/posts\/221\/revisions\/223"}],"wp:attachment":[{"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/media?parent=221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/categories?post=221"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/tags?post=221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}