我们有一些涉及矩阵的互操作代码.我试图调用本机DLL,并且在大多数情况下它的工作非常可靠.
我依赖.net的默认编组,避免使用非托管指针,而不是大部分使用.net数组,也许是byref在这里和那里..net文章说,多维数组被隐式编组为列主要的一维数组,这很好.
唯一似乎不起作用的是尝试编组多维数组,因为F#编译器抱怨声明中float[,]不允许这样做extern.这种限制有什么办法吗?
我知道F#PowerPack的类型PinnedArray和PinnedArray2类型,但我一直在寻找依赖于托管指针的解决方案 - 更重要的是 - 我希望避免将F#PowerPack作为依赖项包含在PinnedArray类中.
在我们的应用程序中,我们被迫使用多个WebServices.在开始时,我们只使用"添加服务引用"菜单选项,以便创建WCF代理.
该向导不生成DataContract,而是生成XML-Serializable类.到目前为止,这么糟糕,但这不是杀手.但是,后来我们注意到,我们丢失了数据,因为生成的代理在归因时添加了Order属性,这导致了问题.
现在我们尝试使用SVCUTIL.EXE从WSDL生成代理类,但我们总是得到以下错误消息:
C:\temp\WSDL>svcutil /serializer:DataContractSerializer ReadSddsAddressOut.wsdl
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation. All rights reserved.
Warning: Das optionale WSDL-Erweiterungselement "body" aus Namespace "http://schemas.xmlsoap.org/wsdl/soap/" wurde nicht behandelt.
XPath: //wsdl:definitions[@targetNamespace='http://post.ch/sdds/address']/wsdl:binding[@name='ReadSddsAddressOutBinding']/wsdl:operation[@name='GeoSuchKanton']/wsdl:input
Warning: Das optionale WSDL-Erweiterungselement "body" aus Namespace "http://schemas.xmlsoap.org/wsdl/soap/" wurde nicht behandelt.
XPath: //wsdl:definitions[@targetNamespace='http://post.ch/sdds/address']/wsdl:binding[@name='ReadSddsAddressOutBinding']/wsdl:operation[@name='GeoSuchKanton']/wsdl:output
Warning: Das optionale WSDL-Erweiterungselement "body" aus Namespace "http://schemas.xmlsoap.org/wsdl/soap/" wurde nicht behandelt.
XPath: //wsdl:definitions[@targetNamespace='http://post.ch/sdds/address']/wsdl:binding[@name='ReadSddsAddressOutBinding']/wsdl:operation[@name='GeoSuchPlz']/wsdl:input
Warning: Das optionale WSDL-Erweiterungselement "body" aus Namespace "http://schemas.xmlsoap.org/wsdl/soap/" wurde nicht behandelt.
XPath: //wsdl:definitions[@targetNamespace='http://post.ch/sdds/address']/wsdl:binding[@name='ReadSddsAddressOutBinding']/wsdl:operation[@name='GeoSuchPlz']/wsdl:output
Warning: …Run Code Online (Sandbox Code Playgroud) 这有可能吗?(我没有对阵2010年,所以我不能自己尝试,对不起)
public interface IComplexList<out TOutput, in TInput> where TOutput : TInput
{
public IEnumerator<TOutput> GetEnumerator();
public void Add(TInput item);
}
public interface IList<T> : IComplexList<T, T>
{
}
Run Code Online (Sandbox Code Playgroud)
如果我做对了,你可以用它来实际在同一个界面中实现协方差和逆变.
我一般使用LINQ,特别是LINQ-to-Objects,因此我对LINQ非常流利.
我正在考虑使用LINQ-to-NHibernate作为我的NHibernate项目的查询语言.当我写一些测试时,我注意到LINQ-to-NHibernate没有和ICriteria做同样的查询.因为我更喜欢使用LINQ,所以我想问一下是否有人知道类似的差异,或者我是否应该一般不关心性能(无论如何,高性能操作都需要对NHibernate进行一些调整.它).请参阅以下示例:
var query = (from inputItem in session.Linq<InputItem>()
where inputItem.Project == project select inputItem).First();
Run Code Online (Sandbox Code Playgroud)
给我以下SQL:
SELECT this_.ID as ID0_1_, this_.Name as Name0_1_, this_.Project_id as Project3_0_1_, project1_.ID as ID1_0_, project1_.Name as Name1_0_
FROM "InputItem" this_ left outer join "Project" project1_ on this_.Project_id=project1_.ID
WHERE this_.Project_id = @p0 limit 1;@p0 = 1, @p1 = 1
Run Code Online (Sandbox Code Playgroud)
而
var criteria = session.CreateCriteria<InputItem>();
criteria.Add(Expression.Eq("Project", project));
criteria.SetMaxResults(1);
criteria.List();
Run Code Online (Sandbox Code Playgroud)
给
SELECT this_.ID as ID0_0_, this_.Name as Name0_0_, this_.Project_id as Project3_0_0_
FROM "InputItem" this_
WHERE this_.Project_id = @p0 …Run Code Online (Sandbox Code Playgroud) 我需要对xml结构进行过多的模式匹配,所以我声明了一个表示xml节点的类型.xml是一个多树,我需要以某种方式迭代节点.为了使树可枚举,我使用嵌套序列推导.我的XML永远不会太大,所以简单性在我的情况下胜过性能,但是下面的代码对于更大的输入有点危险,或者可以保持原样.
type ElementInfo = { Tag : string; Attributes : Map<string, string> }
type Contents =
| Nothing
| String of string
| Elements of Node list
and Node =
| Element of ElementInfo * Contents
| Comment of string
member node.PreOrder =
seq {
match node with
| Element (_, Elements children) as parent -> yield parent; yield! children |> Seq.collect (fun child -> child.PreOrder)
| singleNode -> yield singleNode
}
Run Code Online (Sandbox Code Playgroud) 我们希望在持续集成中使用 FsCheck 作为单元测试的一部分。因此,确定性和可重复的行为对我们来说非常重要。
FsCheck 是一个随机测试框架,可以生成有时可能会中断的测试用例。关键是,我们不仅使用必须为每个输入保留的属性,例如 say List.rev >> List.rev === id。相反,我们做一些数字,一些测试用例可能会因为条件不好而导致测试中断。
问题是:我们如何保证,一旦测试成功,它就永远成功?
到目前为止,我看到以下选项:
在这种设置中使用 FsCheck 的惯用方法是什么?
f# ×3
.net ×1
c# ×1
c#-3.0 ×1
covariance ×1
fscheck ×1
generics ×1
ilist ×1
linq ×1
marshalling ×1
nhibernate ×1
nunit ×1
performance ×1
svcutil.exe ×1
unit-testing ×1
wcf-client ×1
wsdl ×1