English 中文(简体)
如何改变微软。 entitiesFrameworkCore.Query?
原标题:How to change Microsoft.EntityFrameworkCore.Query?

我正在使用EF开发一个布茨or网络,每当我管理该方案时,它就在产出小组上说:

Microsoft.EntityFrameworkCore.Database.Command: 错误:未执行DbCommand (53ms) [项目参数=[]、指挥系统=文本、指挥时间=30] SlectT [t]. [ID]、[t].[AMOUNT]、[t].[CREATED_DATE]、[t]. [DOCUMENT_NUM]、[t]. [PARTICULA]、[t]. [USERID]、[t]. [USER_ID]

Microsoft.Data.SqlClient.SqlException (0x80131904): Invalidcol name USERID

在我的《示范公约》中:

public class TransactionModel {
    public int ID { get; set; }
    public string? DOCUMENT_NUM { get; set; }
    public DateTime CREATED_DATE { get; set; }
    public string? USER_ID { get; set; }
    public EmployeeModel? USER { get; set; }
    public string? PARTICULARS { get; set; }
    public decimal AMOUNT { get; set; } }

I don t have a column named USERID and yet for some reason, EF Database Command selects a USERID

能否手工改变欧洲复兴开发银行数据库的指挥? 还是有办法解决这一问题?

问题回答

这应当根据您的数据模式。 我假定美国ER_ID是<代码>的外国钥匙。 Employee Model USER。

如果是的话,你可以尝试以下守则:

[ForeignKey("USER")]
public string? USER_ID { get; set; }

如果没有,也没有必要查询public EmployeeModel? 缩略语

   [NotMapped]
    public EmployeeModel? USER { get; set; }




相关问题
.NET 7 minimal API request timeout

I found this in .NET 8 (prerelease) but I can t use it due to company policy. https://learn.microsoft.com/en-us/aspnet/core/performance/timeouts?view=aspnetcore-8.0&viewFallbackFrom=aspnetcore-7.0 ...

Blazor web assembly pass checkbox list values to model

I m new to Blazor. I m working in a web assembly Blazor project. I am trying to create a form that passes values back to a model. I have it working with input text fields and drop downs, but I am ...

asp.net 6 c# mvc one to many get data from many side

I am trying to access the data on the many side of a one to many relationship. In the Index action of my controller I assign the data to a variable and return it. I have a Blog, the one side, with ...

How to update shared view adminheader.cshtml from a model

I ve added a drop down into my shared adminheader.cshtl view and it needs to be dynamically updated from data from a table. So when I use another view like routeplan.cshtml I load the view from ...

Gitlab CI On Prem, Docker Image and ASP.NET Core 7

We have a .NET 6 application. We added CI using: image: mcr.microsoft.com/dotnet/sdk:6.0 before_script: - dotnet restore --packages $NUGET_PACKAGES_DIRECTORY build: stage: build script: - ...

ASP.NET Core 2 .1 - How to show all data in table

I don t know how to put CustomerData into CustomerLists property. I m already using CustomerLists = CustomerData; but I got error: CustomerLists is a type but is used like a variable Can anyone ...