小编Sta*_*der的帖子

加速LINQ to SQL查询

在编写LINQ to SQL查询以优化或加速LINQ to SQL时,我们可以记住哪些常见的事情?

例如,通常,LINQ to SQL必须在每次执行查询时将LINQ查询转换为SQL; 这涉及在几个阶段中递归构成查询的表达式树.我们所做的就像使用CompiledQuery类预编译查询一样.

c# sql linq

5
推荐指数
1
解决办法
3765
查看次数

如何在不重复的情况下添加与现有实体有关系的新实体?(EF 6.1)

首先使用 Web API 2 和 EF 6.1 代码。

我正在尝试添加一个Template与现有TimePeriodsStations.

public class Template
{
    public int TemplateID { get; set; }
    public string Name { get; set; }

    public List<TimePeriod> TimePeriods { get; set; }
    public List<Station> Stations { get; set; }
}

public class Station
{
    public int StationID { get; set; }
    public string Name { get; set; }

    public List<Template> Templates { get; set; }
}

public class TimePeriod
{
    public int …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework code-first asp.net-web-api

5
推荐指数
1
解决办法
2869
查看次数

标签 统计

c# ×2

asp.net-web-api ×1

code-first ×1

entity-framework ×1

linq ×1

sql ×1