使用网络 api 获取 table 数据和 blob 数据
Fetching table data along with blob data using web api
我正在尝试使用 web api 从 country mater table 中获取包含列 "CountryName"、"CountryCode" 和 [=] 的记录31=](斑点)。我无法将 blob 列与其他数据一起包括在内:
当前代码:
// Data Access (Repository) layer for fetching data using Dapper
public override IQueryable<Country> GetCountryList()
{
string query = "select CountryName, CountryCode from Country";
connection.Open();
return connection.Query<Country>(query).AsQueryable();
}
// Web API controller
public IHttpActionResult Get()
{
var JsonResponse = ;
return Ok(GetCountryList().ToList());
}
预期结果:
我想包括 BLOB 类型的 CountryImage 列以及现有列(下面的查询以供参考)。
即 "select CountryName, CountryCode, CountryImage from Country";
我将在我的 Angular 应用程序中使用这些数据。
要将 BLOB 嵌入 json,代码必须编码为 base64,以便它可以包含在 json
此 SO 答案中已涵盖此内容:
Base64 encoding and decoding in oracle
我正在尝试使用 web api 从 country mater table 中获取包含列 "CountryName"、"CountryCode" 和 [=] 的记录31=](斑点)。我无法将 blob 列与其他数据一起包括在内:
当前代码:
// Data Access (Repository) layer for fetching data using Dapper
public override IQueryable<Country> GetCountryList()
{
string query = "select CountryName, CountryCode from Country";
connection.Open();
return connection.Query<Country>(query).AsQueryable();
}
// Web API controller
public IHttpActionResult Get()
{
var JsonResponse = ;
return Ok(GetCountryList().ToList());
}
预期结果:
我想包括 BLOB 类型的 CountryImage 列以及现有列(下面的查询以供参考)。 即 "select CountryName, CountryCode, CountryImage from Country";
我将在我的 Angular 应用程序中使用这些数据。
要将 BLOB 嵌入 json,代码必须编码为 base64,以便它可以包含在 json
此 SO 答案中已涵盖此内容:
Base64 encoding and decoding in oracle