由于某些原因,我的实体没有主键:
public partial class VehicleLocation
{
public virtual string UserCode { get; set; }
public virtual string DateTime { get; set; }
public virtual string Device { get; set; }
public virtual string Gps { get; set; }
public virtual string GpsDateTime { get; set; }
public virtual double Speed { get; set; }
}
映射:
class VehicleLoactionMap : ClassMap<VehicleLocation>
{
public VehicleLoactionMap()
{
Table("VEHICLE_LOCATION");
LazyLoad();
Map(x => x.UserCode).Column("USER_CODE");
Map(x => x.DateTime).Column("DATE_TIME");
Map(x => x.Device).Column("DEVICE");
Map(x => x.Gps).Column("GPS");
Map(x => x.GpsDateTime).Column("GPS_DATE_TIME");
Map(x => x.Speed).Column("SPEED");
}
}
我收到了这个错误:
实体“VehicleLocation”没有映射 Id...
如何在不使用主键的情况下映射我的实体?