Add typed procedure contract result handling
This commit is contained in:
@@ -8,7 +8,7 @@ using System.Data;
|
||||
|
||||
namespace DynamORM.Tests.Helpers
|
||||
{
|
||||
public class ProcedureParameterObject
|
||||
public class ProcedureParameterObject : IProcedureParameters<ProcedureParameterResult>
|
||||
{
|
||||
[ProcedureParameter("code", Order = 2, DbType = DbType.String, Size = 32)]
|
||||
public string Code { get; set; }
|
||||
@@ -23,9 +23,52 @@ namespace DynamORM.Tests.Helpers
|
||||
public int Status { get; set; }
|
||||
}
|
||||
|
||||
public class ProcedureParameterColumnFallbackObject
|
||||
public class ProcedureParameterColumnFallbackObject : IProcedureParameters
|
||||
{
|
||||
[DynamORM.Mapper.Column("code", false, DbType.String, 64)]
|
||||
public string Code { get; set; }
|
||||
}
|
||||
|
||||
public class ProcedureParameterResult
|
||||
{
|
||||
[DynamORM.Mapper.Column("sp_Test")]
|
||||
public int MainResult { get; set; }
|
||||
|
||||
[DynamORM.Mapper.Column("result")]
|
||||
public int Result { get; set; }
|
||||
|
||||
[DynamORM.Mapper.Column("description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
[DynamORM.Mapper.Column("status")]
|
||||
public int Status { get; set; }
|
||||
}
|
||||
|
||||
public class ProcedureMultiResult : IProcedureResultReader
|
||||
{
|
||||
[DynamORM.Mapper.Column("sp_Multi")]
|
||||
public int MainResult { get; set; }
|
||||
|
||||
[DynamORM.Mapper.Column("status")]
|
||||
public int Status { get; set; }
|
||||
|
||||
public System.Collections.Generic.List<string> Codes { get; private set; } = new System.Collections.Generic.List<string>();
|
||||
public System.Collections.Generic.List<int> States { get; private set; } = new System.Collections.Generic.List<int>();
|
||||
|
||||
public void ReadResults(IDataReader reader)
|
||||
{
|
||||
while (reader.Read())
|
||||
Codes.Add(reader.GetString(0));
|
||||
|
||||
if (reader.NextResult())
|
||||
while (reader.Read())
|
||||
States.Add(reader.GetInt32(0));
|
||||
}
|
||||
}
|
||||
|
||||
public class ProcedureMultiResultArgs : IProcedureParameters<ProcedureMultiResult>
|
||||
{
|
||||
[ProcedureParameter("status", Direction = ParameterDirection.Output, Order = 1, DbType = DbType.Int32)]
|
||||
public int Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user