Pawel の投稿は正しく、電話することから始めるべきです
Breeze.config.initializeAdapterInstances
実際にクライアント側のメタデータを作成するには、次のように記述します。(簡単な例)。
initializeMetadataStore(myEntityManager.metadataStore);
function initializeMetadataStore(metadataStore) {
var et = new EntityType({
shortName: "Person",
namespace: "Sample_WebApi.Models"
});
et.addProperty( new DataProperty({
name: "personId",
dataType: DataType.Int32,
isNullable: false,
isPartOfKey: true,
}));
et.addProperty(new DataProperty({
name: "firstName",
dataType: DataType.String,
isNullable: false,
}));
et.addProperty(new DataProperty({
name: "lastName",
dataType: DataType.String,
isNullable: false,
}));
et.addProperty(new DataProperty({
name: "birthDate",
dataType: DataType.DateTime,
isNullable: true
}));
et.addProperty(new NavigationProperty({
name: "meals",
entityTypeName: "Meal",
isScalar: false,
associationName: "personMeals"
}));
metadataStore.addEntityType(et);
et = new EntityType({
shortName: "Meal",
namespace: "Sample_WebApi.Models"
});
et.addProperty(new DataProperty({
name: "mealId",
dataType: DataType.Int32,
isNullable: false,
isPartOfKey: true,
}));
et.addProperty(new DataProperty({
name: "personId",
dataType: DataType.Int32,
isNullable: false,
}));
et.addProperty(new DataProperty({
name: "dateConsumed",
dataType: DataType.DateTime,
isNullable: false,
}));
et.addProperty(new NavigationProperty({
name: "person",
entityTypeName: "Person",
isScalar: true,
associationName: "personMeals",
foreignKeyNames: ["personId"]
}));
et.addProperty(new NavigationProperty({
name: "dishes",
entityTypeName: "Dish",
isScalar: false,
associationName: "mealDishes",
}));
metadataStore.addEntityType(et);
et = new EntityType({
shortName: "Dish",
namespace: "Sample_WebApi.Models"
});
et.addProperty(new DataProperty({
name: "dishId",
dataType: DataType.Int32,
isNullable: false,
isPartOfKey: true,
}));
et.addProperty(new DataProperty({
name: "foodName",
dataType: DataType.String,
isNullable: false,
}));
et.addProperty(new DataProperty({
name: "servingSize",
dataType: DataType.Double,
isNullable: false,
}));
et.addProperty(new NavigationProperty({
name: "food",
entityTypeName: "Food",
isScalar: true,
associationName: "DishFood",
foreignKeyNames: ["foodName"]
}));
metadataStore.addEntityType(et);
et = new EntityType({
shortName: "Food",
namespace: "Sample_WebApi.Models"
});
et.addProperty(new DataProperty({
name: "foodName",
dataType: DataType.String,
isNullable: false,
isPartOfKey: true,
}));
et.addProperty(new DataProperty({
name: "calories",
dataType: DataType.Int32,
isNullable: false,
}));
metadataStore.addEntityType(et);
}