类的定义
public class OperLogEntity<BIE> : Entity
where BIE : BizInfoEntity
{
public OperLogEntity()
{
this.OperTime = DateTime.Now;
this.IPAddress = GetIPUtil.GetClientIPv4();
}
/// <summary>
///操作时间
/// </summary>
public virtual DateTime? OperTime { get; private set; }
/// <summary>
/// 操作对象实例
/// </summary>
public virtual BIE BizEntity { get; set; }
/// <summary>
///IP地址
/// </summary>
public virtual string IPAddress { get; set; }
}
ORM映射:
public class CustomerPersonLogEntityMap: OperLogMap<OperLogEntity<CustomerPerson>, CustomerPerson>
{
public CustomerPersonLogEntityMap()
{
Table("CSR_PERSON_LOG");
Id(t => t.Id, "LOG_ID");
References(t => t.BizEntity, "CSR_CUSTOMER_ID");
}
}
想使用HQL查询 OperLogEntity<CustomerPerson> 中数据:
var q = Session.CreateQuery(@"select count(*) from OperLogEntity<CustomerPerson> as d ").UniqueResult<long>();
报错:引发类型为“Antlr.Runtime.NoViableAltException”的异常。
我的HQL应该怎么写?
把 select count(*) 改为 select count(d) 试试
不可以啊!
@地瓜@.@:
试试改为:
@"select count(*) from OperLogEntity<CustomerPerson> d")