0

次のようなデータ構造があります。

public abstract class Vehicle { }
public class Car : Vehicle { }
public class MotorCycle : Vehicle { }

これはbreezejsで非常にうまく機能しますが、キャッシュからエンティティを取得したい場合:

function getLocal() {
    var entity = manager.getEntityByKey("Vehicle", id);   
}

リソース パラメーターとして "Vehicle" (基本クラス) を使用すると、エンティティが見つかりませんが、"Car" または "MotorCycle" は機能します。

私は、 getEntityByKey 関数 (breezejs/EntityManager.js) でそれを見つけました

proto.getEntityByKey = function () {
    var entityKey = createEntityKey(this, arguments).entityKey;
    var group;
    var subtypes = entityKey._subTypes;
    if (subtypes) {
        for (var i = 0, j = subtypes.length; i < j; i++) {
            group = this._findEntityGroup(subtypes[i]);
            // group version of findEntityByKey doesn't care about entityType
            var ek = group && group.findEntityByKey(entityKey);
            if (ek) return ek;
        }
    } else {
        group = this._findEntityGroup(entityKey.entityType);
        return group && group.findEntityByKey(entityKey);
    }
};

ライン:

var subtypes = entityKey._subTypes;

_subTypes は camelCase で記述され、プロパティが _subtypes (lowerCase) として定義されているため、常に未定義です。_subtypes に変更すると、関数は期待どおりに完全に機能します。

これはバグですか、それとも何か見逃しましたか?

4

1 に答える 1