English 中文(简体)
不能找到关键成员x的类型和类型
原标题:Could not find key member x of key x on type y

我试图把我的申请同LQ-to-SQL的LQ数据库连接起来,迄今为止,一切都做了出色的工作。 唯一的点击是,我使用的“金色”提供者不支持制定编码(除非我做过错),因此,我手工地将亚洲开发银行的4个表格编码。

解决办法是适当的,但不会奏效,给我错误的信息

Could not find key member ItemType_Id of key ItemType_Id on type Item .
The key may be wrong or the field or property on Item has changed names.

我在数据库和属地测绘中核对和核对了拼写和实地名称,但找不到任何问题。

页: 1

CREATE TABLE [Items] (
    [Id] integer PRIMARY KEY AUTOINCREMENT NOT NULL,
    [Name] text NOT NULL,
    [ItemType_Id] integer NOT NULL
);

我的制图法:

[Table(Name="Items")]
class Item {

    // [snip]

    [Column(Name = "Id", IsPrimaryKey=true, IsDbGenerated=true)]
    public int Id {
        get;
        set;
    }

    // [snip]

    [Column(Name="ItemType_Id")]
    public int ItemTypeId {
        get;
        set;
    }

    [Association(Storage = "_itemType", ThisKey = "ItemType_Id")]
    public ItemType ItemType {
        get {
            return _itemType.Entity;
        }
        set {
            _itemType.Entity = value;
        }
    }
    private EntityRef<ItemType> _itemType;

    // [snip]
}

这确实是我第一次闯入LINQ-to-SQL,而且我正在学习,但我似乎不能忘记这个似乎很简单的问题。

为什么不能看到我的协会?

最佳回答

使用<代码>

 这一Key = “ItemTypeId”

问题回答

我也存在这个问题,我的解决办法是,我意外地制作了一个名称与我数据库表名称相同的页。 页: 1





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签