I am creating ASP.NET MVC Core 2.2 web app with enterprise library for .Net Core for data access. EnterpriseLibrary.Data.NetCore 6.0.1313 with SQL Server 2016. I want to call ExecuteSprocAccessor without defining paramter map and just passing a value. I have writtern one stored procedure to call with one parameter and passing only one paratmer value in ExecuteSprocAccessor like this
sqlDatabase.ExecuteSprocAccessor("[app].[User_SelectByUserName]", "johnK").FirstOrDefault();
and stored procedute is
ALTER PROC [app].[User_SelectByUserName]
@UserName NVARCHAR(100)
AS
BEGIN
SELECT FROM [app].[User].......
END
But I am getting following error.
{System.NotSupportedException: Parameter discovery is not supported for connections using GenericDatabase. You must specify the parameters explicitly, or configure the connection to use a type deriving from Database that supports parameter discovery. at Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase.DeriveParameters(DbCommand discoveryCommand) at Microsoft.Practices.EnterpriseLibrary.Data.Database.DiscoverParameters(DbCommand command) at Microsoft.Practices.EnterpriseLibrary.Data.ParameterCache.SetParameters(DbCommand command, Database database) at Microsoft.Practices.EnterpriseLibrary.Data.Database.AssignParameters(DbCommand command, Object[] parameterValues) at Microsoft.Practices.EnterpriseLibrary.Data.SprocAccessor`1.Execute(Object[] parameterValues)