I have to call a Stored Procedure but passing a datatable (an iEnumerable) as parameter.
My SP on the SQL server takes this parameter as:
@LIST_USERS dbo.LIST_USERINFO_TYPE READONLY
and the type is defined as:
CREATE TYPE [dbo].[LIST_USERINFO_TYPE] AS TABLE(
[ID_USER] [int] NOT NULL,
[ID_DATA] [int] NOT NULL,
[HEADER_TXT] [varchar](100) NULL)
Then, on the caller side i create the parameters in this way:
list.Add(new UserInfoItem { IdUser = 401, IdData = 3, HeaderTxt = "" });
list.Add(new UserInfoItem { IdUser= 402, IdData= 2, HeaderTxt= "gotcha" });
list.Add(new UserInfoItem { IdUser= 403, IdData= 1, HeaderTxt= "pacific rim" });
dbConn.StoredProcedure(sp,
new
{
LISTA_QUESTIONARIO = DomandeRisposteList
});
When i launch the project actually it stops with a KeyNotFoundException
trying to
name.DbType = OrmLiteConfig.DialectProvider.GetColumnDbType(propertyInfo.PropertyType);
in ServiceStackExtension.cs
How can I achieve this?