小编Oli*_*ini的帖子

Linq Join()与复合键

我正在尝试用两个表做出请求

表页:Id,LangId(主键)PageTypeId,PageTypeLangId(外键)

表PageType:Id,LangId(主键)

那怎么办?在这里,我想念只是添加PageTypeLangId

    return context.Pages
            .Join(context.PageTypes, p => p.PageTypeId, pT => pT.Id,(p, pT) => new { p, pT })
Run Code Online (Sandbox Code Playgroud)

我想要 :

 select * from Page inner join PageType on Page.PageTypeId=PageType.Id and     Page.PageTypeLangId=PageType.LangId
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助 !

c# linq

6
推荐指数
1
解决办法
7435
查看次数

JSON.NET反序列化/序列化JsonProperty JsonObject

我有一个关于使用Newtonsoft JSON.NET库进行反序列化/序列化的问题:

我收到这个json:

 {
    "customerName" : "Lorem",
    "id": 492426
    "sequence": 1232132
    "type" : 3,
    "status" : 0,
    "streetNumber" : 9675,
    "streetName" : "Lorem",
    "suite" : null,
    "city" : "IPSUM",
    "provinceCode" : "QC",
    "postalCode" : "H1P1Z3",
    "routeNumber" : 0,
    "poBox" : 0,
    "streetType" : "CH",
    "userId" : 25,
    "streetDirection" : null,
    "countryCode" : "CA",
    "customerNickName" : "Lorem ipsum",
    "streetSuffix" : null,
    "contacts" : [ {
        "status" : 0,
        "telephone" : 4445555555,
        "extension" : 0,
        "email" : "webtest@test.com",
        "id" : 50,
        "fullName" …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc json.net

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

异步等待或只是TasK <T>

在这里使用示例表单asp.net

所以,我问我,2个代码有什么区别:

public class ServiceTest
{
    public Task<List<Widget>> WidgetsAsync(CancellationToken cancellationToken = default(CancellationToken))
    {
        var widgetService = new WidgetService();
        return widgetService.GetWidgetsAsync(cancellationToken);
    }

    public Task<List<Product>> ProductAsync(CancellationToken cancellationToken = default(CancellationToken))
    {
        var prodService = new ProductService();
        return prodService.GetProductsAsync(cancellationToken);
    }

    public Task<List<Gizmo>> GizmoAsync(CancellationToken cancellationToken = default(CancellationToken))
    {
        var gizmoService = new GizmoService();
        return gizmoService.GetGizmosAsync(cancellationToken);
    }
}
Run Code Online (Sandbox Code Playgroud)

public class ServiceTest
{
    public async Task<List<Widget>> WidgetsAsync(CancellationToken cancellationToken = default(CancellationToken))
    {
        var widgetService = new WidgetService();
        return await widgetService.GetWidgetsAsync(cancellationToken);
    }

    public async Task<List<Product>> ProductAsync(CancellationToken …
Run Code Online (Sandbox Code Playgroud)

c# asynchronous asp.net-mvc-4

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

标签 统计

c# ×3

asp.net-mvc ×1

asp.net-mvc-4 ×1

asynchronous ×1

json.net ×1

linq ×1