English 中文(简体)
数据库中衍生的类参考基准类而不是衍生的类中的对象
原标题:Objects in derived class reference base class in database, instead of derived class

(当我说一个记录"有" 另一种记录, 我的意思是另一个记录 提到第一个。)

我有以下数据库关系:

<强 > 表

基础 Answer - & gt; 多个hoice Answer - & gt; 多个hoice AswerCulture

BaseAnswer 记录中可有多个hoiceAnswer记录。 对于每个“ 多个hoiceAnswer ”, 都有多个“ 文化” 记录 :

<强 > 记录

英文 英文 标题 英文 英文 英文 标题 英文 英文 英文 标题 英文 英文 英文 标题 英文 英文 英文 标题 英文 英文 标题 英文 英文

法语头衔 法语

多休安斯韦尔记录有一个栏目,该栏目指基础安斯韦尔主密钥,同样,多休安斯韦尔库尔库尔库尔的记录也有一个栏目,“它们”应该指多休安斯韦尔的主密钥。然而,我的问题是,正在插入多休安斯韦尔库尔库尔库的记录是指基础安斯韦尔的主密钥(根父,而不是直接父母)。这是我的代码:

public class MultipleChoiceAnswerMap : SubclassMap<MultipleChoiceAnswer>
{
    public MultipleChoiceAnswerMap() 
    {            
        Table("MultipleChoiceAnswer");
        KeyColumn("BaseAnswerID");
        Map(x => x.Score);

        HasMany(x => x.Resources)
            .CollectionType<ResourceMapSetUserType<MultipleChoiceAnswerCulture>>()
            .KeyColumn("MultipleChoiceAnswerID")
            .Cascade.AllDeleteOrphan()
            .Access.CamelCaseField(Prefix.Underscore)
    时 时

时 时

我们有一个类似的项目中的另一个例子。 尽管我正在研究这个例子, 但它仍然不断地在多休克-安斯韦克表格中插入基础安斯韦尔主键作为参考, 而不是多休克-安斯韦尔主键。

任何帮助都将不胜感激。

问题回答

好吧,我们研究过它, 显然我工作过的代码 很可能也遭遇同样的问题。 我们很可能只是继续,让多氯安斯韦尔库尔蒂的外国密钥 成为根父的参考。 如果真的有人知道如何解决这个问题, 如果你把它张贴在这里, 我很感激。

谢谢





相关问题
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. ...

热门标签