2013-07-07 42 views
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都寫在駝峯並總是undefined因爲物業被定義爲_subtypes(lowerCase)。 如果我更改爲_subtypes,該功能完美地按預期工作。

這是一個錯誤還是我錯過了什麼?

回答

1

看起來像一個錯誤。我們在下一個版本中解決這個問題。 ...並感謝您找到它。 :)