嗨大家快速帮助,如果可能的话,我正在努力(我认为这很简单)快速查询。
我正在使用的对象
[Schema("Prospect")]
[Alias("TrackedSource")]
public class ProspectSource
{
[PrimaryKey]
[AutoIncrement]
public int Id { get; set; }
public int? ClientId { get; set; }
public string Name { get; set; }
public bool IsActive { get; set; }
}
我正在运行以下命令
string source ="unknown";
int clientId = 10000;
var foundSource = Db.Select<ProspectSource>(q => (q.Name.Contains(source.Trim()) || (q.Name.Contains(source.Trim()) && q.ClientId == clientId) && q.IsActive)).FirstOrDefault();
但是运行它会给我以下生成的sql
SELECT "Id", "ClientId", "Name", "IsActive"
FROM "TrackedSource"
WHERE (upper("Name") like '%UNKNOWN%' OR ((upper("Name") like '%UNKNOWN%' AND ("ClientId" = 10000)) AND "IsActive"=1))
当然还会生成错误 - 无法找到TrackedSource。
我原本希望生成以下sql
SELECT "Id", "ClientId", "Name", "IsActive"
FROM "Prospect"."TrackedSource"
WHERE (upper("Name") like '%UNKNOWN%' OR ((upper("Name") like '%UNKNOWN%' AND ("ClientId" = 10000)) AND "IsActive"=1))
任何有任何想法的人都会发生这种情况
使用最新版本的Servicestack