1

我想我发现了另一个错误:

我有一个带有多列外键的对象:

public class ConexionPalanca {
    public int ConexionPalancaID { get; set; }

    public int PalancaOrigenID { get; set; }
    public int PerspectivaOrigenID { get; set; }
    public int PanelOrigenID { get; set; }
    public virtual Palanca PalancaOrigen { get; set; }
}

public ConexionPalancaConfiguration() {
        HasKey(cp => cp.ConexionPalancaID);
        Property( p => p.ConexionPalancaID )
            .IsRequired()
            .HasDatabaseGeneratedOption( DatabaseGeneratedOption.Identity );

        HasRequired( cp => cp.PalancaOrigen ).WithMany().HasForeignKey( cp => new { cp.PanelOrigenID, cp.PerspectivaOrigenID, cp.PalancaOrigenID } ).WillCascadeOnDelete( false );
}

我正在尝试使用此函数创建一个新对象:

var createConexion = function (origen, destino, panel) {
    var metadataStore = manager.metadataStore;
    var conexionType = metadataStore.getEntityType("ConexionPalanca");
    var newConexion = conexionType.createEntity();

    manager.addEntity(newConexion);

    newConexion.PalancaDestino(destino);
    newConexion.PalancaOrigen(origen);
    newConexion.Panel(panel);
    newConexion.Activa(true);

    return newConexion;
};

而且似乎新对象只有正确分配的外键的一部分(来自saveBundle):

{
 "entities": [
  {
    "ConexionPalancaID": -1,
    "PanelID": 1,
    "PalancaOrigenID": 0,
    "PerspectivaOrigenID": 0,
    "PanelOrigenID": 1,
    "Anchor": "RightMiddle",
    "Activa": true,
    "entityAspect": {
        "entityTypeName": "ConexionPalanca:#CMIMVC4.DOM",
        "entityState": "Added",
        "originalValuesMap": {},
        "autoGeneratedKey": {
        "propertyName": "ConexionPalancaID",
        "autoGeneratedKeyType": "Identity"
      }
    }
  }
],
"saveOptions": {
  "allowConcurrentSaves": false
}
}

我做错了什么还是一个错误?

谢谢你。

4

1 回答 1

2

好的,这是一个错误,现在已在微风 v0.75.2 中修复......感谢您找到它。:)

于 2012-12-08T01:28:36.917 回答