我正在尝试实现一个纯WCF场景,我想在不依赖SDK帮助程序类的情况下调用Dynamics CRM WCF服务.基本上,我想使用.net框架中的本机WCF支持对Dynamics CRM 2011实施联合身份验证.
我这样做的原因是我想稍后将这个场景移植到BizTalk上.
我已成功使用SvcUtil生成代理类,但部分策略和安全性断言与配置架构不兼容.SvcUtil建议从代码构建绑定,这正是我想要做的.
结果代码在这里:
private static void CallWcf()
{
OrganizationServiceClient client = null;
try
{
// Login Live.com Issuer Binding
var wsHttpBinding = new WSHttpBinding();
wsHttpBinding.Security = new WSHttpSecurity();
wsHttpBinding.Security.Mode = SecurityMode.Transport;
// Endpoint Binding Elements
var securityElement = new TransportSecurityBindingElement();
securityElement.DefaultAlgorithmSuite = SecurityAlgorithmSuite.TripleDes;
securityElement.IncludeTimestamp = true;
securityElement.KeyEntropyMode = SecurityKeyEntropyMode.CombinedEntropy;
securityElement.MessageSecurityVersion = MessageSecurityVersion.WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10;
securityElement.SecurityHeaderLayout = SecurityHeaderLayout.Strict;
var securityTokenParameters = new IssuedSecurityTokenParameters();
securityTokenParameters.InclusionMode = SecurityTokenInclusionMode.AlwaysToRecipient;
securityTokenParameters.ReferenceStyle = SecurityTokenReferenceStyle.Internal;
securityTokenParameters.RequireDerivedKeys = false;
securityTokenParameters.TokenType = …Run Code Online (Sandbox Code Playgroud) 我正在开发一个新的应用程序,一个经理正在推动业务规则管理系统(BRMS)和工作流管理系统的概念,我正在试图找出集成这些类型的最佳方法工具.
关于这些类型的系统,我不知道我不知道什么,所以我试图获得其他观点和信息.
管理者正在寻找的是业务用户无需开发人员时间(或开发人员时间最短)即可更改业务规则或流程的能力.
当我想到它如何适合代码时,我更容易理解BRMS.它非常简单,我可以看到逻辑如何完全驻留在应用程序之外.由于我没有对这些类型的系统做过多少工作,我将非常感谢有关与.NET集成的优质产品的任何信息,或者有关体验的信息.(我们正在关注InRule,Blaze Advisor和ILOG规则)
我不太确定的是工作流程部分.
Workflow Foundation对我来说很有意义,因为它是一个已知的,已定义的工作流程,它集成到应用程序代码中,但是管理员不是在寻找基础,他想要一个允许业务用户定义和更新工作流程的工具.允许最终用户动态创建工作流的任何类型的系统对我来说都不太合理.
我被要求将WorkflowGen视为工作流引擎的一个示例.对我而言,除非开发人员将.NET代码编写为与后端系统接口,否则它看起来完全是自包含的.
我可以理解一个工作流程系统,它允许用户定义特定的,有限的操作,如"电子邮件等等"和"需要批准",但我不知道应该如何动态定义应用程序的工作流系统flow可以集成到应用程序中,甚至可以集成到我刚刚描述的更简单的系统如何显示和更新后端数据.
我正在推动用例,这样我就可以更好地理解我的manger在应用程序代码之外移动这些类型的逻辑方面正在寻找的东西,但与此同时,我很欣赏任何人在这些类型的系统上的任何信息.正如我所说,我不知道我不知道什么,我们的业务用户似乎认为我们的新应用程序应该支持这些类型的工具.我想确保由于缺乏知识而限制了我们的功能.
感谢您提供任何信息或建议.
使用CRM 2011 SDK(v5.0.10)我遇到了少数Lookup字段的问题,其中目标没有填充,我希望有人可以帮助我确定在这些情况下确定引用实体的最佳方法.
具体来说,我正在使用此调用检索实体,属性和关系元数据:
var entityRequest = new RetrieveAllEntitiesRequest
{
RetrieveAsIfPublished = true,
EntityFilters = EntityFilters.Entity | EntityFilters.Attributes | EntityFilters.Relationships
};
var entityResponse = (RetrieveAllEntitiesResponse)_organizationService.Execute(entityRequest);
return entityResponse.EntityMetadata.ToList();
Run Code Online (Sandbox Code Playgroud)
稍后,在使用从该调用返回的EntityMetadata对象时,我检查Attributes集合,对于LookupAttributeMetadata对象,我尝试使用LookupAttributeMetadata对象的Targets属性确定查找引用的实体.
但是,在某些情况下,LookupAttributeMetadata对象具有空的Targets集合.例如,Campaign活动(逻辑名称:campaignactivity)实体将Service字段(逻辑名称:serviced)定义为Lookup字段,但LookupAttributeMetadata对象上的Targets属性为空.
当我查看实体的Web UI Customizations屏幕并打开Service字段时,在Type部分下显示Type:Lookup,Target Record Type:Account,Relationship Name:campaignactivity_account.
这些信息来自哪里?
另请注意:Campaign活动或帐户实体上没有名为"campaignactivity_account"的关系.
更新:我正在运行Dynamics CRM 2011 Rollup 8的库存安装(尽管我在Rolloup 7上也看到了这一点).虽然"广告系列活动"是我在我的示例中使用的字段,但总共有14个问题,如下所示.我正在寻找一个通用的解决方案(针对每个解决方案的一次性解决方案),以避免if (entityName=="rollupfield" && fieldName=="organizationid")...在我的代码中使用一堆逻辑,因为我正在使用的实体和字段是由用户在运行时选择的,我不知道我必须提前知道我会被交给谁.
更新:以下控制台应用程序可用于重现该问题.
//Requires the following Referenses:
// Microsoft.CSharp
// Microsoft.IdentityModel
// Microsoft.xrm.sdk
// System
// System.Core
// System.Data
// …Run Code Online (Sandbox Code Playgroud) 我正在使用WiX 3.7的Burn/Managed Bootstrapper应用程序功能来创建基于MBA的自定义安装程序.对于我的捆绑软件链中的每个软件包,在执行MinorUpdate时,我可以轻松检测已安装哪些软件包功能,以确保在升级期间通过使用WiX基类中为引导程序提供的这些事件来保留这些功能选择:DetectPackageComplete,DetectMsiFeature,DetectRelatedBundle,DetectRelatedMsiPackage,DetectComplete.
但是,在MajorUpgrade期间,我只看到一种方法来确定安装了哪些软件包,但是没有看到如何确定安装了哪些功能,因为DetectMsiFeature事件不会触发. 我尝试MigrateFeatures在产品的配置上使用标志,但这似乎不起作用(或者我没有正确使用它).
在WiX中使用自定义托管引导程序应用程序执行MajorUpgrade时检测/迁移现有功能的正确方法是什么?
注意:如果有帮助,我可以提供一个包含所有代码的完整工作的VS解决方案.
Bundle.wxs:<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="Bootstrapper1" Version="1.1.0.0" Manufacturer="Knights Who Say Ni" UpgradeCode="e6fbf160-d1d9-4b38-b293-94d60eae876f" Compressed="yes">
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost" >
<Payload SourceFile="$(var.ManagedBootstrapperApplication.TargetPath)" />
<!-- other files here -->
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="NetFx40Web" />
<MsiPackage SourceFile="$(var.SetupProject1.TargetPath)" EnableFeatureSelection="yes" Vital="yes" Compressed="yes" />
</Chain>
</Bundle>
</Wix>
Run Code Online (Sandbox Code Playgroud)
Product.wxs:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SetupProject1" Language="1033" Codepage="1252"
Version="1.1.0.0" Manufacturer="Knights Who Say Ni"
UpgradeCode="5fcd463a-3287-4fdf-bf00-d5d74baeccda">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade AllowSameVersionUpgrades="no" …Run Code Online (Sandbox Code Playgroud) 是否可以将NUnit的[TestCaseSource]属性与多个参数一起使用?这是我的代码(从MbUnit迁移):
public IEnumerable<object[]> GetTestSwitchMultiItems()
{
yield return new object[] { SwitchType.Sell, 0.94733,
new SwitchSourceItem[] { new SwitchSourceItem(1176, 100, 50, SwitchSourceItem.QuantityType.TotalQuantity, SwitchType.Sell)},
new SwitchEquivalentItem[] { new SwitchEquivalentItem(415318955, 35, 25, SwitchType.Buy), new SwitchEquivalentItem(4348, 65, 45, SwitchType.Buy) } };
yield return new object[] { SwitchType.Sell, 0.94733,
new SwitchSourceItem[] { new SwitchSourceItem(1176, 100, 50, SwitchSourceItem.QuantityType.TotalQuantity, SwitchType.Sell)},
new SwitchEquivalentItem[] { new SwitchEquivalentItem(415318955, 15, 25, SwitchType.Buy), new SwitchEquivalentItem(4348, 25, 45, SwitchType.Buy),
new SwitchEquivalentItem(430397879, 20, 15, SwitchType.Buy), new SwitchEquivalentItem(5330, 20, 85, SwitchType.Buy)} };
}
[Test, TestCaseSource("GetTestSwitchMultiItems")]
public …Run Code Online (Sandbox Code Playgroud) 有没有办法可以找出使用自定义查询或存储过程的视图使用的基表?
我正在使用Microsoft.EntityFrameworkCore.SqlServer v2.1.2(并且也尝试过 v2.2.0-preview1-35029)并使用 LINQ 从 Azure SqlServer 数据库中获取实体集合,在 DateTime 字段上进行过滤。
但是,由 LINQ 语句生成的 SQL 使用基于字符串的 DateTime 值,SqlServer 拒绝此错误:
从字符串转换日期和/或时间时转换失败。
我可以修改 SQL 语句以更改日期时间格式,以便查询正常工作(有关详细信息,请参见下文),但我不知道如何让框架生成相同的日期时间格式。
虽然 EntityFrameworkCore 仍然有点新,但似乎这是一个非常简单的用例,所以我假设我做错了什么,这不是框架问题。
如何防止 EF 在 SQL 中生成无效的日期时间值?
和/或
如何让生成的 SQL 为 DateTime 对象使用另一种格式?
我正在使用的 EntityFramework 模型如下所示:
public class DeskReading
{
public int DeskReadingId { get; set; }
//... some other fields ...
public DateTime Timestamp { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我的 LINQ 查询值如下所示:
IQueryable<DeskReading> readings =
_dbContext.DeskReadings
.OrderBy(gr => gr.Timestamp)
.Where(gr => gr.Timestamp > new …Run Code Online (Sandbox Code Playgroud) 我有一个字典,我想将其转换为另一个字典,使用以下示例隐含的规则:
输入:
Dictionary<string, string> inputs = new Dictionary<string, string>(3)
{
{ "A", "First" },
{ "Z", "Third" },
{ "J", "Second" }
};
Run Code Online (Sandbox Code Playgroud)
输出:
Dictionary<int, string> output = new Dictionary<string, string>(3)
{
{ 0, "First" },
{ 1, "Second" },
{ 2, "Third" }
};
Run Code Online (Sandbox Code Playgroud)
我可以使用lambda语法和没有中间对象吗?
谢谢.
我已经配置了VSTS构建作业,以从GitHub 构建我的MockingFrameworkExamples .NET 4.7.1(C#)解决方案。该解决方案包括五个具有NUnit v3.10单元测试的程序集。
我Visual Studio Test在构建定义中包括了一个步骤,但是当它运行时,控制台输出显示测试程序集中没有可用的测试:
D:\ a \ 1 \ s \ MSFakesExamples \ bin \ Release \ MSFakesExamples.dll D中没有测试可用:D:\ a \ 1 \ s \ MoqExamples \ bin \ Release \ MoqExamples.dll D:\ a \ 1 \ s \ NSubstituteExamples \ bin \ Release \ NSubstituteExamples.dll D:\ a \ 1 \ s \ RhinoMocksExamples \ bin \ Release \ RhinoMocksExamples.dll。确保已注册测试发现者和执行者,并且平台和框架版本设置正确,然后重试。
我需要更改什么才能让测试跑步者找到并运行我的测试?
我的本地Visual Studio 2017实例在查找和运行测试方面没有问题。该步骤的文档Visual Studio Test说它将运行NUnit测试:
具有Visual Studio测试适配器的测试框架,例如xUnit,NUnit,Chutzpah等,也可以运行。 …
标题说明了一切.我似乎找不到一个完整的命令/标志/事物列表 - 我可以从命令行执行操作.
我正在使用NUnit 2.5.10测试中的Microsoft UI Automation API来为WPF应用程序执行自动UI测试.
在某些情况下,在我的开发机器上运行测试能够找到某些UI元素,但是当在我们的构建代理机器上针对相同的二进制文件运行相同的脚本时,它无法找到这些元素.
我找不到代理机器行为不同的任何原因.我怀疑它与UIAccess标志或UAC有关,但没有遇到任何具体问题.
任何人都可以提供一些指导,说明构建代理为什么会有不同的行为,或者如何修复代理以查看与其他机器相同的元素?
例如,我有一个comboBox,其中有十几个选项.使用Win7 SDK中的"Inspect Objects"工具,我可以看到每个选项都有一个包含实际显示文本的子元素.所以在我的测试代码中,我做了类似这样的事情:
// get the child elements
var options = comboBoxElement.FindAll(TreeScope.Children, (System.Windows.Automation.Condition) new PropertyCondition(AutomationElement.IsControlElementProperty, (object) true));
foreach (AutomationElement child in viewOptions)
{
var subControls = child.GetChildren();
Console.WriteLine("Child: {0} w/ {1} children", child.Current.Name, subControls.Count);
foreach (AutomationElement subControl in subControls)
Console.WriteLine("SubControl: {0}", subControl.Current.Name);
}
Run Code Online (Sandbox Code Playgroud)
在我的开发机器上,我得到了这些结果:
Child: My.BoundObject.ClassName w/ 1 children
SubControl: Displayed Text for first item
Child: My.BoundObject.ClassName w/ 1 children
SubControl: Displayed Text for second item
Child: My.BoundObject.ClassName w/ 1 …Run Code Online (Sandbox Code Playgroud) 那是我的弹出窗口:
<Popup Name="Tedavi_Popup" IsOpen="False" Placement="MousePoint" >
<Border BorderBrush="Gray" BorderThickness="1" >
<TextBlock Background="WhiteSmoke" Padding="9,4,9,4" TextWrapping="Wrap" Name="popup"/>
</Border>
</Popup>
Run Code Online (Sandbox Code Playgroud)
我有主网格,所有东西都在那个网格中。
那是我的MouseMove事件处理程序:
this.Tedavi_Popup.ClearValue(Popup.IsOpenProperty);
this.Tedavi_Popup.IsOpen = true;
Run Code Online (Sandbox Code Playgroud)
我想让弹出窗口始终在网格中打开并让弹出窗口跟随鼠标。
目前,当鼠标移动时不会出现弹出窗口。当鼠标停止时,弹出窗口会出现在鼠标底部。鼠标停止时一切正常。但是鼠标移动它不会出现。
当鼠标移动时如何让它出现?
有人可以向我解释,为什么这行不通?
builder.Setup(b => b.BuildCommand(query ?? It.IsAny<string>())).Returns(command);
Run Code Online (Sandbox Code Playgroud)
如果query是null,BuildCommand将通过null,而不是It.IsAny<string>()
相反,我必须这样做:
if(query == null)
builder.Setup(b => b.BuildCommand(It.IsAny<string>())).Returns(command);
else
builder.Setup(b => b.BuildCommand(query)).Returns(command);
Run Code Online (Sandbox Code Playgroud)
与代表有关吗?
编辑-完整示例
public static void ReturnFromBuildCommand(this Mock<IQueryCommandBuilder> builder, IQueryCommand command, string query = null)
{
if(query == null)
builder.Setup(b => b.BuildCommand(It.IsAny<string>())).Returns(command);
else
builder.Setup(b => b.BuildCommand(query)).Returns(command);
}
Run Code Online (Sandbox Code Playgroud)
然后我可以这样称呼它
var command = new Mock<IQueryCommand>();
var builder = new Mock<IQueryCommandBuilder>();
builder.ReturnFromBuildCommand(command.Object);
Run Code Online (Sandbox Code Playgroud)
要么
string query = "SELECT Name FROM Persons;";
builder.ReturnFromBuildCommand(command.Object, query);
Run Code Online (Sandbox Code Playgroud)
取决于我是否关心该参数。
c# ×8
burn ×2
nunit ×2
sql-server ×2
wix ×2
azure-devops ×1
bootstrapper ×1
dynamic ×1
dynamics-crm ×1
inrule ×1
mbunit ×1
moq ×1
null ×1
nunit-2.5 ×1
popup ×1
t-sql ×1
unit-testing ×1
views ×1
wcf ×1
wcf-client ×1
wcf-security ×1
wix3.7 ×1
workflow ×1
wpf ×1