MasterPage.cs
-----------------
protected void Page_Load(object sender, EventArgs e)
{
Debug.WriteLine("hello");
}
我想拥有这种商店结构。
我如何用打字稿界面来描述它。
我的意思是有多级嵌套对象,每个都可以有一些自定义属性。
或许ngrx商店有更好的设计。
API看起来像这样
api.com/user - 这给用户列表
api.com/user/ [id] / products - 这提供了用户产品列表
api.com/user/ [id] / products / [id] - 这为用户提供了具体的产品
我尝试过这样的事情
{
data: {
user: {
selected: 1502205502995,
entities: {
11: {
actual: {id: 11, name: 'User A changed'},
persist: {id: 11, name: 'User A'},
validationError: {},
serverError: {},
products: {
selected: 1,
entities: {
1: {
actual: {id: 1, description: 'Description of product changed'},
persist: {id: 1, description: 'Description of product '},
deleted: true,
validationError: {},
serverError: {}
},
1502205955851: {
actual: {description: 'Description of product 2'}
}
},
list: {
page: 1,
page_count: 1,
page_size: 20,
total_items: 6,
items: [
{id: 1, description: 'Description of product '},
{id: 1, description: 'Description of product 2'}
]
}
},
notes: {
entities: {}
}
},
23: {
actual: {id: 23, name: 'Karik Guna'},
persist: {id: 23, name: 'Karik Guna'},
validationError: {},
serverError: {}
},
1502205502995: {
actual: {name: 'Karan Gupta'},
validationError: {},
serverError: {},
address: {
entities: {
1502224087221: {
actual: {id: 1502224087221, description: "Description of product"},
validationError: {}
}
}
}
}
},
list: {
page: 1,
page_count: 1,
page_size: 20,
total_items: 8,
items: [
{}
],
loading: false
}
}
}
}
这里我被迫为父实体
拥有属性'self'答案 0 :(得分:0)
将 self 属性设为可选可能会有所帮助:
...
self?: EntityInfo<User, UserResponse>
...