Non scalar navigation properties are not populating with “nodb” conception

安稳与你 提交于 2019-12-20 07:34:49

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!