0
我想爲複雜數據(數據庫中多個連接的數據結果)創建一個通用存儲庫方法。以下是保存數據的類。該數據來自SQL的三個表聯接(表架構是相同類的)爲複雜數據創建小巧的存儲庫方法
public class InterfaceHeaderSetting
{
public Guid Id { get; set; }
public string CodaDocCode { get; set; }
public string Company { get; set; }
public string Currency { get; set; }
public string DocDescription { get; set; }
public Screen Screen { get; set; }
public Interface Interface { get; set; }
}
public class Screen
{
public Guid Id { get; set; }
public string Name { get; set; }
}
public class Interface
{
public Guid Id { get; set; }
public string Name { get; set; }
}
我有庫的方法,如
public IEnumerable<T> GetAllDynamic(string sql)
{
return Connection.Query<T>(sql, commandType: CommandType.StoredProcedure).ToList();
}
public T Update(T entity, string sql, object dynamicParameters)
{
return
Connection.Query<T>(sql, dynamicParameters, commandType: CommandType.StoredProcedure).SingleOrDefault();
}
我想多一個倉庫方法,通過它我可以填充像InterfaceHeaderSetting對象的對象。