MongoHelper中将
BsonClassMap.LookupClassMap(type);
改为
BsonClassMap cm = new BsonClassMap(type);
cm.AutoMap();
cm.SetDiscriminator(type.FullName);
BsonClassMap.RegisterClassMap(cm);
使用FullName注册鉴别器,然后其他相关的地方也改成FullName即可。
排除ET.Client可能会出现的问题:
Client端如果使用了组件的序列化操作,比如打印组件内容 XXComponent.ToString()。这时候调用的是MongoHelper.ToJson;
这时候XXComponent组件是ET.Client命名空间下的,会被自动注册到鉴别器。到时候序列化这个组件的时候就又会冲突了。