From 63166313d02167dc235d320a8ebb811401dcd9c7 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Tue, 6 Sep 2022 17:18:29 +0200 Subject: [PATCH 1/2] Comment out usage of EF.Default which we pulled out --- .../NewInEFCore7/ExecuteUpdateSample.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/core/Miscellaneous/NewInEFCore7/ExecuteUpdateSample.cs b/samples/core/Miscellaneous/NewInEFCore7/ExecuteUpdateSample.cs index 1569a9d2cf..a6d4e2cbe0 100644 --- a/samples/core/Miscellaneous/NewInEFCore7/ExecuteUpdateSample.cs +++ b/samples/core/Miscellaneous/NewInEFCore7/ExecuteUpdateSample.cs @@ -171,12 +171,12 @@ private static async Task ResetPostPublishedOnToDefault() $"Posts before update: {string.Join(", ", await context.Posts.AsNoTracking().Select(e => "'..." + e.Title.Substring(e.Title.Length - 12) + "' " + e.PublishedOn.Date).ToListAsync())}"); Console.WriteLine(); - context.LoggingEnabled = true; - await context.Set() - .ExecuteUpdateAsync( - setPropertyCalls => setPropertyCalls - .SetProperty(post => post.PublishedOn, post => EF.Default())); - context.LoggingEnabled = false; + // context.LoggingEnabled = true; + // await context.Set() + // .ExecuteUpdateAsync( + // setPropertyCalls => setPropertyCalls + // .SetProperty(post => post.PublishedOn, post => EF.Default())); + // context.LoggingEnabled = false; Console.WriteLine(); Console.WriteLine( From 6a8f20b3cd3f105a0cb7f23c8c4885ef72da2c48 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Thu, 8 Sep 2022 22:44:19 +0200 Subject: [PATCH 2/2] Sproc mapping fixes --- .../NewInEFCore7/DocumentsContext.cs | 49 +++++++++---------- .../DocumentsContextStoredProcedures.cs | 2 - 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/samples/core/Miscellaneous/NewInEFCore7/DocumentsContext.cs b/samples/core/Miscellaneous/NewInEFCore7/DocumentsContext.cs index ce91589b13..df109bb87d 100644 --- a/samples/core/Miscellaneous/NewInEFCore7/DocumentsContext.cs +++ b/samples/core/Miscellaneous/NewInEFCore7/DocumentsContext.cs @@ -115,7 +115,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Person_Update", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter(person => person.Id); + storedProcedureBuilder.HasOriginalValueParameter(person => person.Id); storedProcedureBuilder.HasOriginalValueParameter( person => person.Name, parameterBuilder => parameterBuilder.HasName("Name_Original")); storedProcedureBuilder.HasParameter(person => person.Name); @@ -126,7 +126,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Person_Delete", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter(person => person.Id); + storedProcedureBuilder.HasOriginalValueParameter(person => person.Id); storedProcedureBuilder.HasOriginalValueParameter(person => person.Name); storedProcedureBuilder.HasRowsAffectedResultColumn(); }); @@ -151,7 +151,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Contacts_Update", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter("PersonId"); + storedProcedureBuilder.HasOriginalValueParameter("PersonId"); storedProcedureBuilder.HasParameter(contactDetails => contactDetails.Phone); storedProcedureBuilder.HasRowsAffectedResultColumn(); }); @@ -159,7 +159,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) ownedNavigationBuilder.DeleteUsingStoredProcedure( "Contacts_Delete", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter("PersonId"); + storedProcedureBuilder.HasOriginalValueParameter("PersonId"); storedProcedureBuilder.HasRowsAffectedResultColumn(); }); } @@ -186,7 +186,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Addresses_Update", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter("ContactDetailsPersonId"); + storedProcedureBuilder.HasOriginalValueParameter("ContactDetailsPersonId"); storedProcedureBuilder.HasParameter(address => address.Street); storedProcedureBuilder.HasParameter(address => address.City); storedProcedureBuilder.HasParameter(address => address.Postcode); @@ -197,7 +197,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) ownedOwnedNavigationBuilder.DeleteUsingStoredProcedure( "Addresses_Delete", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter("ContactDetailsPersonId"); + storedProcedureBuilder.HasOriginalValueParameter("ContactDetailsPersonId"); storedProcedureBuilder.HasRowsAffectedResultColumn(); }); } @@ -293,8 +293,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Document_Update", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter(document => document.Id); - storedProcedureBuilder.HasParameter("Discriminator"); + storedProcedureBuilder.HasOriginalValueParameter(document => document.Id); storedProcedureBuilder.HasOriginalValueParameter( document => document.RowVersion, parameterBuilder => parameterBuilder.HasName("RowVersion_Original")); @@ -318,7 +317,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Document_Delete", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter(document => document.Id); + storedProcedureBuilder.HasOriginalValueParameter(document => document.Id); storedProcedureBuilder.HasOriginalValueParameter(document => document.RowVersion); storedProcedureBuilder.HasRowsAffectedResultColumn(); }); @@ -351,8 +350,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "BookPerson_Delete", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter("AuthorsId"); - storedProcedureBuilder.HasParameter("PublishedWorksId"); + storedProcedureBuilder.HasOriginalValueParameter("AuthorsId"); + storedProcedureBuilder.HasOriginalValueParameter("PublishedWorksId"); storedProcedureBuilder.HasRowsAffectedResultColumn(); }); } @@ -394,7 +393,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Document_Update", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter(document => document.Id); + storedProcedureBuilder.HasOriginalValueParameter(document => document.Id); storedProcedureBuilder.HasOriginalValueParameter( document => document.RowVersion, parameterBuilder => parameterBuilder.HasName("RowVersion_Original")); @@ -414,7 +413,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Document_Delete", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter(document => document.Id); + storedProcedureBuilder.HasOriginalValueParameter(document => document.Id); storedProcedureBuilder.HasOriginalValueParameter(document => document.RowVersion); storedProcedureBuilder.HasRowsAffectedResultColumn(); }); @@ -447,8 +446,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "BookPerson_Delete", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter("AuthorsId"); - storedProcedureBuilder.HasParameter("PublishedWorksId"); + storedProcedureBuilder.HasOriginalValueParameter("AuthorsId"); + storedProcedureBuilder.HasOriginalValueParameter("PublishedWorksId"); storedProcedureBuilder.HasRowsAffectedResultColumn(); }); } @@ -468,7 +467,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Book_Update", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter(book => book.Id); + storedProcedureBuilder.HasOriginalValueParameter(book => book.Id); storedProcedureBuilder.HasParameter(book => book.Isbn); storedProcedureBuilder.HasRowsAffectedResultColumn(); }); @@ -477,7 +476,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Book_Delete", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter(book => book.Id); + storedProcedureBuilder.HasOriginalValueParameter(book => book.Id); storedProcedureBuilder.HasRowsAffectedResultColumn(); }); } @@ -502,7 +501,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Magazine_Update", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter(magazine => magazine.Id); + storedProcedureBuilder.HasOriginalValueParameter(magazine => magazine.Id); storedProcedureBuilder.HasParameter(magazine => magazine.CoverPrice); storedProcedureBuilder.HasParameter(magazine => magazine.IssueNumber); storedProcedureBuilder.HasParameter("EditorId"); @@ -513,7 +512,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Magazine_Delete", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter(magazine => magazine.Id); + storedProcedureBuilder.HasOriginalValueParameter(magazine => magazine.Id); storedProcedureBuilder.HasRowsAffectedResultColumn(); }); } @@ -557,8 +556,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "BookPerson_Delete", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter("AuthorsId"); - storedProcedureBuilder.HasParameter("PublishedWorksId"); + storedProcedureBuilder.HasOriginalValueParameter("AuthorsId"); + storedProcedureBuilder.HasOriginalValueParameter("PublishedWorksId"); storedProcedureBuilder.HasRowsAffectedResultColumn(); }); } @@ -585,7 +584,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Book_Update", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter(book => book.Id); + storedProcedureBuilder.HasOriginalValueParameter(book => book.Id); storedProcedureBuilder.HasOriginalValueParameter( magazine => magazine.RowVersion, parameterBuilder => parameterBuilder.HasName("RowVersion_Original")); @@ -606,7 +605,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Book_Delete", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter(book => book.Id); + storedProcedureBuilder.HasOriginalValueParameter(book => book.Id); storedProcedureBuilder.HasOriginalValueParameter(book => book.RowVersion); storedProcedureBuilder.HasRowsAffectedResultColumn(); }); @@ -639,7 +638,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Magazine_Update", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter(magazine => magazine.Id); + storedProcedureBuilder.HasOriginalValueParameter(magazine => magazine.Id); storedProcedureBuilder.HasOriginalValueParameter( magazine => magazine.RowVersion, parameterBuilder => parameterBuilder.HasName("RowVersion_Original")); @@ -662,7 +661,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) "Magazine_Delete", storedProcedureBuilder => { - storedProcedureBuilder.HasParameter(magazine => magazine.Id); + storedProcedureBuilder.HasOriginalValueParameter(magazine => magazine.Id); storedProcedureBuilder.HasOriginalValueParameter(magazine => magazine.RowVersion); storedProcedureBuilder.HasRowsAffectedResultColumn(); }); diff --git a/samples/core/Miscellaneous/NewInEFCore7/DocumentsContextStoredProcedures.cs b/samples/core/Miscellaneous/NewInEFCore7/DocumentsContextStoredProcedures.cs index 47980ab64c..5c5ad9a905 100644 --- a/samples/core/Miscellaneous/NewInEFCore7/DocumentsContextStoredProcedures.cs +++ b/samples/core/Miscellaneous/NewInEFCore7/DocumentsContextStoredProcedures.cs @@ -31,7 +31,6 @@ await context.Database.ExecuteSqlRawAsync( @" CREATE PROCEDURE [dbo].[Document_Update] @Id [int], - @Discriminator [nvarchar](max), @RowVersion_Original [rowversion], @Title [nvarchar](max), @NumberOfPages [int], @@ -47,7 +46,6 @@ @RowVersion [rowversion] OUT AS BEGIN UPDATE [Documents] SET - [Discriminator] = @Discriminator, [Title] = @Title, [NumberOfPages] = @NumberOfPages, [PublicationDate] = @PublicationDate,