110 lines
3.6 KiB
C#
110 lines
3.6 KiB
C#
/*
|
|
* DynamORM - Dynamic Object-Relational Mapping library.
|
|
* Copyright (c) 2012-2026, Grzegorz Russek (grzegorz.russek@gmail.com)
|
|
* All rights reserved.
|
|
*/
|
|
|
|
using System.Data;
|
|
using DynamORM.Mapper;
|
|
using DynamORM.Objects;
|
|
|
|
namespace DynamORM.Tests.Helpers
|
|
{
|
|
public class ProcedureParameterObject : IProcedureParameters<ProcedureParameterResult>
|
|
{
|
|
[ProcedureParameter("code", Order = 2, DbType = DbType.String, Size = 32)]
|
|
public string Code { get; set; }
|
|
|
|
[ProcedureParameter("result", Direction = ParameterDirection.Output, Order = 3, DbType = DbType.Int32)]
|
|
public int Result { get; set; }
|
|
|
|
[ProcedureParameter("description", Direction = ParameterDirection.InputOutput, Order = 4, DbType = DbType.String, Size = 256)]
|
|
public string Description { get; set; }
|
|
|
|
[ProcedureParameter("status", Direction = ParameterDirection.ReturnValue, Order = 1)]
|
|
public int Status { get; set; }
|
|
}
|
|
|
|
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 ProcedureAttributedResult
|
|
{
|
|
[DynamORM.Mapper.Column("sp_Test")]
|
|
public int MainResult { get; set; }
|
|
|
|
[DynamORM.Mapper.Column("status")]
|
|
public int Status { get; set; }
|
|
|
|
[ProcedureResult(0, ColumnName = "Code")]
|
|
public string FirstCode { get; set; }
|
|
|
|
[ProcedureResult(1, ColumnName = "Code")]
|
|
public System.Collections.Generic.List<string> Codes { get; set; }
|
|
|
|
[ProcedureResult(2, ColumnName = "State")]
|
|
public int[] States { get; set; }
|
|
|
|
[ProcedureResult(3)]
|
|
public Users User { get; set; }
|
|
|
|
[ProcedureResult(4)]
|
|
public System.Collections.Generic.List<Users> AllUsers { get; set; }
|
|
|
|
[ProcedureResult(5, Name = "codes_table")]
|
|
public DataTable CodesTable { get; set; }
|
|
}
|
|
|
|
public class ProcedureAttributedResultArgs : IProcedureParameters<ProcedureAttributedResult>
|
|
{
|
|
[ProcedureParameter("status", Direction = ParameterDirection.Output, Order = 1, DbType = DbType.Int32)]
|
|
public int Status { get; set; }
|
|
}
|
|
|
|
public class ProcedureMultiResultArgs : IProcedureParameters<ProcedureMultiResult>
|
|
{
|
|
[ProcedureParameter("status", Direction = ParameterDirection.Output, Order = 1, DbType = DbType.Int32)]
|
|
public int Status { get; set; }
|
|
}
|
|
}
|