I'm trying to get all records from SQL database using DapperExtensions.
But I have a Schema set to other than dbo for some tables. Hence, the table is not recognized from sql query.
For example, a table is in the form [Schema][TableName]. But when I start query, error is thrown like:
Invalid object name 'TableName'.
This is the Model class:
using System;
using Dapper.Contrib.Extensions;
using ImOnTech.Teftis.Core.Models;
using ImOnTech.Teftis.Core.Models.DT_Inspection;
namespace ImOnTech.Teftis.Core.Models.DT_Inspection
{
[Table("DT_Inspection.City")]
public class City
{
This is the function to GetAll records from database:
public async Task<IReadOnlyList<City>> GetAllAsync()
{
var CityList = await Context.Connection.GetListAsync<City>();
Context.Connection.Close();
return CityList.ToList();
}