Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# db4o继承的对象未被索引:bug还是设计?_C#_Db4o - Fatal编程技术网

C# db4o继承的对象未被索引:bug还是设计?

C# db4o继承的对象未被索引:bug还是设计?,c#,db4o,C#,Db4o,当您试图索引从另一个对象继承的对象上的字段时,db4o似乎会忽略配置参数。例如,如果我有以下内容: public class foo { private int theId; public int TheId {get{return theId;}set{theId=value;}} } public class bar:foo { private string name; public string Name{get{return name;}set{name

当您试图索引从另一个对象继承的对象上的字段时,db4o似乎会忽略配置参数。例如,如果我有以下内容:

public class foo
{
    private int theId;
    public int TheId {get{return theId;}set{theId=value;}}
}

public class bar:foo
{
    private string name;
    public string Name{get{return name;}set{name=value;}}
}
我的配置与此类似:

IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();
config.Common.ObjectClass(typeof(foo)).ObjectField("theId").Indexed(true);
这就行了。但是,如果我尝试这样做:

IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();
config.Common.ObjectClass(typeof(bar)).ObjectField("theId").Indexed(true);
配置被忽略<代码>栏
ID
未编制索引


我可以理解为什么会这样设计,但是我找不到任何文档引用这种行为,或者说这是一个可能的“陷阱”。那么这是一个bug,还是出于设计?在我看来,可能有很多时候,您只想在特定的子类上对字段进行索引。

我认为这是出于设计。您只能在声明字段的类上索引字段。这也适用于所有子类

顺便说一句,现在不可能只在子类上为继承字段编制索引

为添加了文档任务