我经常使用代表工厂生产的实体的类.为了使我的工厂简单的测试很容易,我通常执行IEquatable<T>,同时也覆盖GetHashCode和Equals(由所建议的MSDN).
例如; 采用以下实体类,这是为了示例目的而简化的.通常我的类有更多属性.偶尔会有一个集合,在Equals我检查的方法中使用SequenceEqual.
public class Product : IEquatable<Product>
{
public string Name
{
get;
private set;
}
public Product(string name)
{
Name = name;
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
Product product = obj as Product;
if (product == null)
{
return false;
}
else
{
return Equals(product);
}
}
public bool Equals(Product other)
{
return Name == other.Name; …Run Code Online (Sandbox Code Playgroud) 我有一个在 Visual Studio 中开发的 C# 库 Azure Function (v1 .Net Framework 4.6.1)。
我想在 Visual Studio 中通过 HTTPS 本地运行它。我怎样才能实现这个目标?
我已将应用程序参数设置如下:
host start --port 7112 --pause-on-error --useHttps --cors *
Run Code Online (Sandbox Code Playgroud)
添加--usehttps导致应用程序无法正确启动。
当应用程序启动时,它询问我是否要安装证书,我单击“是”。
然后控制台窗口显示这一点,并且应用程序似乎无法正确加载 - 最终消息只是不断重复。
Listening on https://localhost:7112/
Hit CTRL-C to exit...
[10/07/2018 15:52:58] Reading host configuration file 'C:\Application.Server\bin\Debug\net461\host.json'
[10/07/2018 15:52:58] Host configuration file read:
[10/07/2018 15:52:58] {}
The host is taking longer than expected to start.
Run Code Online (Sandbox Code Playgroud)
(旁白;我正在尝试这样做,因为我认为这可能会有所帮助)。
我有以下内容。
<form method="post" action="/send" enctype="multipart/form-data">
<input type="file" name="filename" id="AttachFile">
</form>
Run Code Online (Sandbox Code Playgroud)
我想更改用户上传的文件的名称。
如果用户选择“Document.docx”,我想将其更改为“Bank - Document.docx”。
我仍然想读取用户选择的文件,而不是其他文件,只是在发送到服务器时使用不同的名称。
我在不允许控制服务器端的应用程序范围内工作,所以理想情况下我需要在客户端上执行此操作。此外,我需要它在form.
我尝试了以下变体但没有成功:
document.getElementById("AttachFile").name = "test.txt"
document.getElementById("AttachFile").files = "test.txt"
document.getElementById("AttachFile").value ="test.txt"
Run Code Online (Sandbox Code Playgroud) 好吧,我在一些同事刚刚开始支持的代码中遇到了这个问题.我从来没有做过这样的事情但不会,但我很惊讶编译器没有将它标记为错误.
基本上你可以看到这个小片段的"奇怪"行为:
array[3/4] = 3;
这是允许的,即使3/4,我认为,将返回双倍.如果您将其更改为:
array[3.0/4] = 3;
您确实收到编译器错误.
我假设第一个没有创建编译器错误,因为它执行整数除法并返回一个整数.
我有以下架构。
哪里:
我正在使用隐式流从Azure AD访问JWT访问令牌。
https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?
client_id=6731de76-14a6-49ae-97bc-6eba6914391e
&response_type=id_token+token
&redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F
&scope=openid%20https%3A%2F%2Fgraph.microsoft.com%2Fmail.read
&response_mode=fragment
&state=12345
&nonce=678910
Run Code Online (Sandbox Code Playgroud)
然后,此JWT令牌将作为承载授权传递到资源服务器。同一令牌可以在到期之前多次重用。
作为Authorize请求的一部分,我传递了state和一个nonce值。
目前,我使用简单的JavaScript验证客户端上的状态if:
function isValid() {
if (token.state !== expectedState) {
return false;
}
...
}
Run Code Online (Sandbox Code Playgroud)
如果我正确理解,nonce是为了防止重放攻击-我认为这意味着针对资源服务器,也可能针对客户端。
我不确定应该在哪里(或是否)验证随机数。
在服务器上看起来不正确,整个令牌都在验证中,并且令牌可以重用(在其有效期内)。
在客户端上,这似乎是一个更好的位置,但这与验证状态有什么不同吗?
oauth-2.0 jwt single-page-application azure-active-directory openid-connect
我试过将参数设置为:
array("item1","item2","item3")
Run Code Online (Sandbox Code Playgroud)
还有:
new array("item1","item2","item3")
Run Code Online (Sandbox Code Playgroud)
还有:
var Labels = new array("item1","item2","item3")
Run Code Online (Sandbox Code Playgroud)

但我似乎无法将数组传递给以下函数:
function BoldLabel(Labels) {
var length = Labels.length;
var element = null;
for (var i = 0; i < length; i++) {
element = Labels[i];
document.getElementById(element).style.fontWeight="bolder";
document.getElementById(element).style.fontSize="13px";
}
}
Run Code Online (Sandbox Code Playgroud)
我一直收到"数组未定义"的错误.我当然认为我在某个地方看到了这个,但是再也找不到这个例子了.问题是我希望能够重用这段代码,因此只需传递我想要粗体的项目数组就比将代码剪切并粘贴到新函数并单独写入每个标签名称更容易
document.getElementById("new_pricingsubtotal_c").style.fontWeight="bolder";
document.getElementById("new_pricingsubtotal_c").style.fontSize="13px";
document.getElementById("new_pricingsubtotal1_c").style.fontWeight="bolder";
document.getElementById("new_pricingsubtotal1_c").style.fontSize="13px";
document.getElementById("new_lineitemtotal_c").style.fontWeight="bolder";
document.getElementById("new_lineitemtotal_c").style.fontSize="13px";
document.getElementById("new_trucktotalcost_c").style.fontWeight="bolder";
document.getElementById("new_trucktotalcost_c").style.fontSize="13px";
Run Code Online (Sandbox Code Playgroud)
任何帮助都将非常感谢!!
具体来说,我正在研究JavaScript库;JavaScript InfoVis Toolkit和D3绘制流程图和状态机。
两者都提供了许多可视化数据的方法。但是,这些示例似乎都不符合以下要求(尤其是流程图)。
明确地说,我的意思是这些。
流程图

(资料来源:http : //philosophy.hku.hk/think/strategy/chart.php)
状态机

(来源:http : //www.oracle.com/technetwork/systems/fsm-156381.html)
这些库中的任何一个都可以满足我的要求吗?
我的要求甚至适当地使用了那些库吗?
干杯,
我有用例,我需要创建角色,在crm实例中创建用户并将角色与用户相关联。
我已经探索了用于创建用户和创建角色的api。
下面是代码:
private void createUser(IntegrationUserDTO integrationUserDTO, STSDto stsDetails, CRMAuthContext crmAuthContext)
throws IntegrationsException {
Map<String, Object> requestBody = new HashMap<>();
URI uri = new MSCRMHttpDelegate().odataUriBuilder(crmAuthContext.getCrmApiUrl())
.appendEntitySetSegment("systemusers").build();
HttpPost httpPost = new HttpPost(uri.toString());
httpPost.setHeader("Authorization", "Bearer " + crmAuthContext.getAccessToken());
httpPost.setHeader("Accept", MediaType.APPLICATION_JSON);
httpPost.setHeader("OData-MaxVersion", "4.0");
httpPost.setHeader("OData-Version", "4.0");
httpPost.setHeader("Content-Type", "application/json");
requestBody.put("accessmode", "4");
requestBody.put("applicationid", UUID.fromString(stsDetails.getClientId()));
requestBody.put("firstname", integrationUserDTO.getUsername());
requestBody.put("lastname", integrationUserDTO.getSecretToken());
requestBody.put("internalemailaddress", integrationUserDTO.getExtraParams());
requestBody.put("isintegrationuser", true);
MSCRMUser user = getBusinessUnitId(crmAuthContext);
if (StringUtils.isNoneBlank(user.getBusinessUnitId())) {
requestBody.put("businessunitid@odata.bind",
"/businessunits(" + UUID.fromString(user.getBusinessUnitId()) + ")");
}
if (StringUtils.isNoneBlank(user.getOrganizationId())) {
requestBody.put("organizationid", UUID.fromString(user.getOrganizationId()));
}
try {
httpPost.setEntity(new StringEntity( …Run Code Online (Sandbox Code Playgroud) java microsoft-dynamics dynamics-crm dynamics-crm-online microsoft-dynamics-webapi
c# ×3
javascript ×3
dynamics-crm ×2
arrays ×1
compilation ×1
d3.js ×1
html ×1
https ×1
iequatable ×1
indexing ×1
infovis ×1
java ×1
jwt ×1
oauth-2.0 ×1
svg ×1
unit-testing ×1