为什么使用"MapRoute"进行"默认"路由,而使用"MapHttpRoute"进行"DefaultApi"路由?
routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}"
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
Run Code Online (Sandbox Code Playgroud) 环境:
数据源:
productsDataSource = new kendo.data.DataSource({
type: "odata",
transport: {
read: "http://www.mydomain.com/odata.svc/products",
dataType: "json",
contentType: "application/json"
}
schema: {
type: "json",
data: function(data){
return data.value;
},
total: function(data){
return data['odata.count'];
},
model: product
},
pageSize: 50,
serverPaging: true,
serverFiltering: true,
serverSorting: true
});
Run Code Online (Sandbox Code Playgroud)获取数据:
productsDataSource.filter([{field:"Id",operator:"eq",value:5}]); //这将发送一个httprequest
productsDataSource.fetch(function(e){tempDataStorage = e.items; //处理数据的更多逻辑;});
问题:
尝试对浏览器窗口执行某些操作:
$(window).width(), $(window).height()使用Knockout 使窗口大小()可观察?任何建议表示赞赏!
语境:
User使用public virtual ICollection<Topic> CreatedTopics导航属性(延迟加载);Topic具有public virtual User Creator导航属性;DataServiceController : DbDataController<DefaultDbContext>,Web API beta,ASP.NET MVC 4 Beta,单页应用程序;Web API操作:
public IQueryable<Topic> GetTopics()
{
// return DbContext.Topics; // OK
return DbContext.Topics.Include("Creator"); //With Exception
}
Run Code Online (Sandbox Code Playgroud)结果:"w3wp.exe中出现未处理的microsoft .net框架异常"
这里的问题似乎是:我不应该在两个实体中添加导航属性(导致循环引用?),如果我CreatedTopics在User类中删除导航属性,它将再次正常.
所以,在上面列出的类似上下文中,这是我的问题:
我看过很多相关的帖子,但还不够清楚:(,
谢谢你的帮助!
院长
navigation-properties entity-framework-4 ef-code-first asp.net-web-api
这是真的:(或者我错过了什么?)
如果是,如何定义自定义css绑定?
我在这里找到了一个实现,但我只有缩小的kendo js文件,任何人都可以提供下载未压缩的kendo js文件的链接吗?
更新
临时解决方案:http://feedback.kendoui.com/forums/127393-kendo-ui-feedback/suggestions/2782980-add-an-mvvm-css-binding
必须修改kendo.web.js源代码.
情况:
kendo DataSource
var ordersDataSource = new kendo.data.DataSource({
type: "odata",
transport: {
read: {
url: "http://localhost/odata.svc/Orders?$expand=OrderDetails"
}
},
schema: {
type: "json",
data: function(response){
return response.value;
}
total: function(response){
return response['odata.count'];
}
},
serverPaging: true,
serverFiltering: true,
serverSorting: true
})
Run Code Online (Sandbox Code Playgroud)从odata源读取的json数据如下:
{
odata.metadata: "xxxx",
odata.count: "5",
value: [
{
OrderId: 1,
OrderedDate: "2013-02-20",
OrderInfoA: "Info A",
OrderInfoB: "Info B"
OrderDetails: [
{
OrderDetailId: 6,
OrderDetailInfoC: "Info C",
OrderDetailInfoD: "Info D"
},
{
//Another OrderDetail's data
}
]
},
{
// …Run Code Online (Sandbox Code Playgroud)