调用此方法:
public HttpResponseMessage PostProduct(Product item)
{
item = repository.Add(item);
var response = this.Request.CreateResponse<Product>CreateResponse(HttpStatusCode.Created, item);
string uri = Url.RouteUrl("DefaultApi", new { id = item.Id });
response.Headers.Location = new Uri(uri);
return response;
}
Run Code Online (Sandbox Code Playgroud)
导致编译时错误:
'System.Web.HttpRequestBase' does not contain a definition for 'CreateResponse' and the
best extension method overload 'System.Net.Http.HttpRequestMessageExtensions.CreateResponse<T>
(System.Net.Http.HttpRequestMessage, System.Net.HttpStatusCode, T)' has some invalid arguments.
Run Code Online (Sandbox Code Playgroud)
我在这里错过了什么?
我正在使用带有样式组件的材料 UI,根据文档,为了覆盖材料样式,需要添加此injectFirst属性:
然而,当尝试在 storybook 环境中使用这种方法时,它不会按预期工作,并且 JSS 样式仍然在样式组件之后注入。
.storybook/config.js:
import React from 'react'
import {configure, addDecorator} from '@storybook/react'
import { StylesProvider } from '@material-ui/styles'
addDecorator(storyFn => (
<StylesProvider injectFirst>
{ storyFn() }
</StylesProvider>
));
const req = require.context('../packages', true, /.story.js$/);
function loadStories() {
req.keys().forEach((filename) => req(filename));
}
configure(loadStories, module);
Run Code Online (Sandbox Code Playgroud)
我正在使用带有DataContract序列化的Web API .输出如下所示:
<Data>
<Status>
<Date>2014-08-13T00:30:00</Date>
<ID>312</ID>
<Option>No Limitation</Option>
<Value i:nil="true" />
</Status>
<Status>
<Date>2014-08-13T01:00:00</Date>
<ID>312</ID>
<Option>No Limitation</Option>
<Value i:nil="true" />
</Status>
<Status>
<Date>2014-08-13T01:30:00</Date>
<ID>312</ID>
<Option>No Limitation</Option>
<Value i:nil="true" />
</Status>
<Status>
<Date>2014-08-13T02:00:00</Date>
<ID>312</ID>
<Option>No Limitation</Option>
<Value i:nil="true" />
</Status>
Run Code Online (Sandbox Code Playgroud)
通过执行以下操作,我能够删除所有额外的命名空间:
[DataContract(Namespace="")]
public class Status
Run Code Online (Sandbox Code Playgroud)
但剩下的唯一属性是i:nil属性.我该怎么做才能删除i:nil属性?
我对AngularJS很新.当我打电话时,$http.get我得到一个$http is not defined错误.
这是我的模块的内容:
var demoApp = angular.module('demoApp', []);
demoApp.config(function ($routeProvider) {
$routeProvider.
when('/view1',
{
controller: 'SimpleController',
templateUrl: 'View1.html'
}).
when('/view2',
{
controller: 'SimpleController',
templateUrl: 'View2.html'
})
.otherwise({ redirectTo: '/view1' });
});
demoApp.factory('simpleFactory', function () {
var factory = {};
factory.getAnnounces = function ($http) {
$http.post("http://localhost:57034/Announce/GetAllAnnounces")
.success(function (data, status, headers, config) {
return data;
}).error(function (data, status, headers, config) {
return status;
});
};
return factory;
});
demoApp.controller('SimpleController', function ($scope,simpleFactory) {
$scope.announces = [];
init(); …Run Code Online (Sandbox Code Playgroud) 我有一个 lerna + 纱线工作区 monorepo,它使用故事书。
每个包/组件都有自己的 /assets 文件夹,其中包含静态图像,如下所示:
/packages
/component1
/assets
... 静态图像
index.tsx
/component2
/assets
... 静态图像
index.tsx
在官方文档中,它说包含-s选项,但它仅适用于单个通用资产文件夹,不适用于每个包:
start-storybook -p 6006 -s assets
我如何为每个组件提供故事书中的这些静态资产?
Please consider this style:
.root {
display: flex;
flex-direction: column;
height: 100%;
}
.header {
width: 100%;
background-color: red;
display: flex;
height: 100px;
justify-content: space-between;
.logo-pane {
width: 100px;
height: 100px;
background-color: green;
}
.user-actions {
width: 100px;
height: 100px;
background-color: blue;
}
}
.content {
flex-grow: 1;
background-color: pink;
}
Run Code Online (Sandbox Code Playgroud)
What I want to achieve is that the content element will take the remaining height of the viewport, but it takes only his content height.
HTML:
<div class="root"> …Run Code Online (Sandbox Code Playgroud) 我有以下课程:
public class DistributionItem
{
public int DeviceID { get; set; }
public string DeviceName { get; set; }
public double? Export { get; set; }
public double? Import { get; set; }
public List<double?> Tarrifs { get; set; }
public bool HasChild { get; set; }
public int OrderNum { get; set; }
public double PF { get; set; }
public int? MaxDmd { get; set; }
public string ImageUrl { get; set; }
public int ParentID { get; …Run Code Online (Sandbox Code Playgroud)