小编Bah*_*man的帖子

LINQ to SQL中的"在子句中"

我想使用SQL SERVER的"In子句"之类的东西.这是我的模特:

public partial class StationEvaluationBooks
{
    public int StationEvaluationBookID { get; set; }
    public Nullable<int> StationEvaluationID { get; set; }

    public virtual StationEvaluation StationEvaluation { get; set; }
    ...
 }
public partial class StationEvaluation
{
    public StationEvaluation()
    {
        this.StationEvaluationBooks = new HashSet<StationEvaluationBooks>();
    }
    public int StationEvaluationID { get; set; }
    public virtual ICollection<StationEvaluationBooks> StationEvaluationBooks { get; set; }
    ...
 }
Run Code Online (Sandbox Code Playgroud)

我使用以下代码来实现LINQ的"In子句",但是我收到了错误:

        StationsEntities db = new StationsEntities();

        var stationevaluations = db.StationEvaluation;
       //some conditions:
        stationevaluations = stationevaluations.Where(/*condition*/);
       ..

        var result = …
Run Code Online (Sandbox Code Playgroud)

linq asp.net-mvc entity-framework

2
推荐指数
1
解决办法
1680
查看次数

标签 统计

asp.net-mvc ×1

entity-framework ×1

linq ×1