Skip to content
This repository has been archived by the owner on Feb 25, 2020. It is now read-only.

EnterpriseLibrary.Data.NetCore - Parameter discovery is not supported for connections using GenericDatabase #39

Open
rajputs6 opened this issue Jun 26, 2019 · 0 comments

Comments

@rajputs6
Copy link

rajputs6 commented Jun 26, 2019

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant