Beginning Entity Framework Core 5 by Eric Vogel

Beginning Entity Framework Core 5 by Eric Vogel

Author:Eric Vogel
Language: eng
Format: epub
ISBN: 9781484268827
Publisher: Apress


Test the AddLookUpItem Stored Procedure

Next, we will test out the “AddLookUpItem” stored procedure. To run non-query command SQL, we will use either the ExecuteSqlInterpolated or the ExecuteSqlRaw method, both of which are exposed through the Database property on DbContext. Let us first test out the ExecuteSqlInterpolated method to call our “AddLookUpItem” stored procedure through the unit test defined in Listing 13-8.[Test]

public void AddLookUpItemInterpolated()

{

string code = "CAN";

string description = "Canada";

LookUpType lookUpType = LookUpType.Country;

_context.Database.ExecuteSqlInterpolated($"AddLookUpItem {code}, {description}, {lookUpType}");



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.