0
我尝试手动创建数据模型的元数据时遇到了一些问题。更具体地说,我使用以下命令创建元数据的字符串表示,然后将其保存到本地文件中。在BreezeJS中创建手动元数据
var metadata = JObject.Parse(new EFContextProvider<HelixDtoContext>().Metadata());
虽然有一些缺失的信息,当我这样做。以下Dto
public class LayoutManagerState
{
public string Widgets { get; set; }
}
public class AppState
{
public int Id{ get; set; }
public ViewOptionsDialogState ViewOptionsDialogState { get; set; }
public LayoutManagerState LayoutManagerState { get; set; }
...
}
我期望元数据包含LayoutManagerState复杂属性;但它不这样做。
"entityType": [
{
"name": "AppState",
"key": {
"propertyRef": {
"name": "Id"
}
},
"property": [
{
"name": "Id",
"type": "Edm.Int32",
"nullable": "false",
"annotation:StoreGeneratedPattern": "Identity"
},
{
"name": "ViewOptionsDialogState",
"type": "Edm.Self.ViewOptionsDialogState",
"nullable": "false"
}
]
},
正如您所见,元数据中没有名称为LayoutManagerState
的属性。
我找到了问题;我的解决方案中有以下项目。 1)MyApp.Models 2)MyApp.Dtos 3)MyApp.UI 4)MyApp.MetadataGenerator。当MVC应用程序启动时(MyAPP.UI),我调用返回元数据字符串的MyApp.MeatadataGenerator中的方法。当我这样做时,我没有得到我的数据模型的完整表示。但是,如果我将MetadataGenerator作为独立控制台应用运行,那么LayoutManagerState将包含在元数据中。 – ppoliani