问题
I am using Breeze 1.4.8 and trying to have a list of key/values pairs as Navigation properties with "nodb" conception.
I have 2 simple models:
function configureKeyValuePairDtoType(metadataStore) {
var prop;
var et = new entityType({
shortName: "KeyValuePairDto",
namespace: "DomainClasses.Dtos.Site",
autoGeneratedKeyType: AutoGeneratedKeyType.None
});
et.addProperty(prop = new DataProperty({
name: "key",
dataType: dataType.String,
isNullable: false,
isPartOfKey: true
}));
et.addProperty(prop = new DataProperty({
name: "value",
dataType: dataType.String,
isNullable: false
}));
metadataStore.addEntityType(et);
metadataStore.registerEntityTypeCtor("KeyValuePairDto", null, KeyValuePairDtoInitializer);
function KeyValuePairDtoInitializer(pair) {
}
}
function configureKeyValueStorageDtoType(metadataStore) {
var prop;
var et = new entityType({
shortName: "KeyValueStorageDto",
namespace: "DomainClasses.Dtos.Site",
autoGeneratedKeyType: AutoGeneratedKeyType.None
});
et.addProperty(new DataProperty({
name: "id",
dataType: dataType.Guid,
isNullable: false,
isPartOfKey: true
}));
et.addProperty(prop = new NavigationProperty({
name: "pair",
entityTypeName: "KeyValuePairDto",
isScalar: true
}));
et.addProperty(prop = new NavigationProperty({
name: "pairList",
entityTypeName: "KeyValuePairDto",
associationName: "KeyValueStorageDto_PairList",
isScalar: false
}));
metadataStore.addEntityType(et);
metadataStore.registerEntityTypeCtor("KeyValueStorageDto", null, KeyValueStorageDtoInitializer);
function KeyValueStorageDtoInitializer() {
}
}
Here is response from the server:
In the Breeze model I am getting as result, property pair has correct value, but pairList is just empty.
Please, advice, because it looks like an issue with my models' configuration, but for some reason I cannot find what's wrong.
回答1:
Could you try this with breeze 1.4.11 just to make sure that we haven't already fixed this?
If it still doesn't work, I'll register a test case and bug for this. Not sure if we'll get this fixed in the next release because we are already in testing for it. But it should be in the following one.
来源:https://stackoverflow.com/questions/23093832/non-scalar-navigation-properties-are-not-populating-with-nodb-conception