我不知道为什么我的模块无法从数据库中查询数据。这是我的代码,var日志总是返回null。该表是在数据库中创建的,我在。中插入了3条记录。
private readonly IRepository<AuditLogs> _UserLogsRepository;
private readonly ICacheManager _cacheManager;
private readonly ISignals _signals;
public UserLogsService(
IRepository<AuditLogs> projectRepository,
IEnumerable<IPermissionProvider> permissionProviders,
ICacheManager cacheManager,
ISignals signals
)
{
_UserLogsRepository = projectRepository;
_cacheManager = cacheManager;
_signals = signals;
Logger = NullLogger.Instance;
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
public ILogger Logger { get; set; }
private void TriggerSignal()
{
_signals.Trigger(SignalName);
}
public IEnumerable<AuditLogs> GetProjects()
{
var logs = from log in _UserLogsRepository.Table select log;
return logs.ToList();
}
这是我的模特
public class AuditLogs
{
public virtual int id { get; set; }
public virtual string module_name { get; set; }
public virtual string username { get; set; }
public virtual DateTime datetime { get; set; }
public virtual string action { get; set; }
public virtual string note { get; set; }
public virtual string effected_record { get; set; }
}
有人可以告诉我为什么?感谢