эта ошибка появляется не может преобразовать из 'в'?
** У меня есть эта ошибка не может конвертировать из «в» **
using SCB_Common.ExtensionMethods;
using System.Data.SqlClient;
namespace SCB_Common.DataBase
{
public class BusinessCommon
{
public static void SetCommonCloumns(SqlDataReader DR, EntityCommon entity)
{
entity.CreatedAt = DR.GetDateTime("CreatedAt");
entity.CreatedBy = DR.GetDecimal("CreatedBy");
entity.LastModifyAt = DR.GetDateTime("LastModifyAt");
entity.LastModifyBy = DR.GetDecimal("LastModifyBy");
entity.ModifyBy = DR.GetDecimal("ModifyBy");
entity.PostStateAt = DR.GetDateTime("PostStateAt");
entity.PostStateBy = DR.GetDecimal("PostStateBy");
entity.RecordState = DR.GetInt32("RecordState");
entity.I_D = DR.GetDecimal("I_D");
}
}
}
** это метод получения записи, когда я называю SCB_Common.DataBase.BusinessCommon.SetCommonCloumns (DR, сущность); **
public Entity.SBH_D_Guardianship_Type_Entity GetRecord(Entity.SBH_D_Guardianship_Type_Entity ent, out bool IsDeleted)
{
IsDeleted = true;
Entity.SBH_D_Guardianship_Type_Entity entity = null;
SqlDataReader DR = Action.GetDataList(ent, 1, 1, "");
while (DR.Read())
{
IsDeleted = false;
entity = new Entity.SBH_D_Guardianship_Type_Entity();
entity.ID = DR.GetDecimal("ID");
entity.Aname = DR.GetString("Aname");
entity.Ename = DR.GetString("Ename");
SCB_Common.DataBase.BusinessCommon.SetCommonCloumns(DR, entity);
}
DR.Close();
return entity;
}
это класс сущности
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SCB_HR_Business.Entity
{
public class SBH_D_Guardianship_Type_Entity
{
public decimal ID_Co
{ get; set; }
public decimal ID
{ get; set; }
public string Aname
{ get; set; }
public string Ename
{ get; set; }
public decimal I_D
{ get; set; }
public object LastModifyBy { get; set; }
public object CreatedBy { get; set; }
}
}
Как 'SBH_D_Guardianship_Type_Entity' относится к' Entity'? Очевидно, вы передаете экземпляр первого, где последний требуется на «SetCommonCloumns». – HimBromBeere
i edit the questiont –
'SBH_D_Guardianship_Type_Entity', похоже, не принадлежит к' EntityCommon', что и является вторым параметром 'SetCommonCloumns'. –