0
使用貓鼬和Node.js的我犯了一個基地實體是子分類到用戶實體和人實體建造在客戶端繼承,並且都到家庭實體的引用,我的問題是使用微風MetadataHelper我如何定義,一個家庭可以擁有navigationProperties數組,它可以是一個人或用戶實體。總之,我失去了面向對象,那麼是否有一種方法可以在客戶端使用Breeze構造多態支持繼承,這正是我所想到的。使用微風元幫手如何通過手
var addFamilyItemType =(): any => {
var entityType = {
name: this.entityNames.Family,
dataProperties: {
id: {type: DT.MongoObjectId},
name: {type: DT.String, required: true, max: 50}
},
navigationProperties: {
//this is where i want one navigation since they are a subclass
// members: {type: [], hasMany: true}
users: {type: [this.entityNames.User], hasMany: true},
people: {type: [this.entityNames.Person], hasMany: true}
}
};
helper.addTypeToStore(store, entityType);
return entityType;
};
var addUserItemType =(): any => {
var entityType = {
name: this.entityNames.User,
dataProperties: {
id: {type: DT.MongoObjectId},
email: {type: DT.String, required: true, max: 50},
username: {type: DT.String, required: true, max: 20},
password: {type: DT.String, 'default': ''}
},
navigationProperties: {
family: {
entityTypeName: this.entityNames.Family,
associationName: 'User_Family',
foreignKeyNames: ['familyId']
}
}
};
helper.addTypeToStore(store, entityType);
return entityType;
};
var addPersonItemType =(): any => {
var entityType = {
name: this.entityNames.Person,
dataProperties: {
id: {type: DT.MongoObjectId},
email: {type: DT.String, max: 50},
profileImageURL: {type: DT.String,'default':''}
},
navigationProperties: {
family: {
entityTypeName: this.entityNames.Family,
associationName: 'Person_Family',
foreignKeyNames: ['familyId']
}
}
};
helper.addTypeToStore(store, entityType);
return entityType;
};