c# - 这个无效的对象名称从何而来?

标签 c# .net entity-framework

我有一个简单的 SQL UPDATE 查询,它提示“无效的对象名称”AuditCrudFields,它根本不存在于我的 ASP.NET 项目中。 (我已经在我的项目中尝试过 grep 查找 AuditCrudFields 但找不到匹配项。)

UPDATE 语句是:

UPDATE [dbo].[PartModel]
SET partOfficial = 39, updateTS = CONVERT(DATETIME, ‘2017-12-08’, 111)  
WHERE partId = 298

返回的错误:

enter image description here

令人费解的是,这些都是 PartModel 中存在的属性。所以我想知道 AuditCrudFields 来自哪里?

public class PartModel : EntityInformation
{
    [Key]
    public Int64 partId { get; set; }

    public int partTypeId { get; set; }
    [ForeignKey("partTypeId")]
    public virtual PartTypeModel PartType { get; set; }

    public int locationId { get; set; }
    [ForeignKey("locationId")]
    public virtual LocationModel Location { get; set; }

    public int partOfficial { get; set; }
    public int partUnofficial { get; set; }
    public int partThreshold { get; set; }

    public string partImg { get; set; }
    public int partStatus { get; set; }
}

最佳答案

您可以运行此查询来定位尝试使用表 AuditCrudFields 的 SQL 对象代码:

select *
from sys.objects
where object_definition(object_id) like '%AuditCrudFields%'

如果这不在触发器定义内,我会感到非常惊讶。

关于c# - 这个无效的对象名称从何而来?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47720474/

相关文章:

c# - 在 .Net CORE 1.0 中解压缩存档

c# - 如何查询ICollection<T>?

c# - 从 temp 获取真实文件名

c# - 以编程方式添加路线

c# - 在 C#.net 应用程序中将数据存储在本地的最佳方式是什么?

entity-framework - 如何在 EF Core 中预加载关联数据?

c# - 检查是否选择了整张纸?

c# - '$' 符号在 C# 6.0 中有什么作用?

c# - DbContext 已被处置(ASP.NET MVC)

entity-framework - EntityFrameworkDynamicProxies 程序集加载时间