我遇到过一些非常奇怪,简单的WPF应用程序
<Window x:Class="ListBoxSelection.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<ListBox ItemsSource="{Binding Path=Strings}" SelectionMode="Single"/>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
代码背后
public class ViewModel
{
public List<string> Strings { get; set; }
public ViewModel ()
{
Strings = new List<string> ();
Strings.Add ("A");
// add many items ...
Strings.Add ("A");
}
}
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow ()
{
InitializeComponent ();
DataContext = new ViewModel ();
}
}
Run Code Online (Sandbox Code Playgroud)
当我点击一个项目时,

如果我继续点击项目,他们只会聚合.单击已选择的项目不执行任何操作.抓我的头,我之前有数据包列表给ListBoxes,之前从未见过这个.运行Win7(64),VS2010,行为呈现.Net 3.5,.Net 3.5 …
我感兴趣的是冒充知名的Web服务和Wcf服务进行集成测试.为此,我想在自托管环境中捕获服务元数据,自动生成服务存根和主机服务存根.
在这篇文章之后,我能够获得远程Wcf服务元数据并生成合同.但是,我在为远程Asmx Web服务做同样的事情时遇到了一些困难.
我有一套用于审查这个问题的米老鼠解决方案.
我的Asmx解决方案包含一个默认的"Hello World"Web服务,如下所示
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class SimpleAsmxService : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld () { return "Hello World"; }
}
Run Code Online (Sandbox Code Playgroud)
我的Wcf解决方案包含默认的"Hello World"服务,也可在下面找到
[ServiceContract]
public interface ISimpleWcfService
{
[OperationContract]
string GetData(int value);
[OperationContract]
CompositeType GetDataUsingDataContract(CompositeType composite);
}
[DataContract]
public class CompositeType
{
[DataMember]
public bool BoolValue { get; set; }
[DataMember]
public string StringValue { get; set; }
}
public class SimpleWcfService : ISimpleWcfService
{
public string GetData(int value) …Run Code Online (Sandbox Code Playgroud) 我是Windows Workflow [WF]的新手,并且有兴趣为业务目的评估WF.我决定通过介绍
[TestMethod]
public void TestMethod ()
{
TextWriter writer = new StringWriter ();
Sequence sequence = new Sequence
{
Activities =
{
// so, assigning a reference type [eg StringWriter]
// as target is prohibited in WF4RC. what or how do
// i assign a target? introduction cited above may
// not be current [ie may be Beta2, not RC] so ... ?
new WriteLine { Text = "Hello", TextWriter = writer },
new WriteLine { Text …Run Code Online (Sandbox Code Playgroud) 为Sql Server 2005编写脚本.我正在注册一个模式
CREATE XML SCHEMA COLLECTION [dbo].[MySchema] AS N'<xsd:schema ... >'
Run Code Online (Sandbox Code Playgroud)
现在,当我做出改变时,我想放弃它,打电话给
DROP XML SCHEMA COLLECTION [dbo].[MySchema]
Run Code Online (Sandbox Code Playgroud)
我在开发过程中经常运行这些东西,比如
DROP ...
CREATE ...
Run Code Online (Sandbox Code Playgroud)
但是这会在Schema不存在的第一次运行时出现问题.我想做类似的事情
IF OBJECT_ID ('MySchema') IS NOT NULL
DROP ...
CREATE ...
Run Code Online (Sandbox Code Playgroud)
但OBJECT_ID ('MySchema')只是回来NULL.是否有正确的方法来测试Sql Server 2005中是否存在已注册的Xml架构集合?
muchos gracias mis amigos :)
我们有一个应用程序,其中我们有一个物化的项目数组,我们将通过Reactive管道进行处理.它看起来有点像这样
EventLoopScheduler eventLoop = new EventLoopScheduler();
IScheduler concurrency = new TaskPoolScheduler(
new TaskFactory(
new LimitedConcurrencyLevelTaskScheduler(threadCount)));
IEnumerable<int> numbers = Enumerable.Range(1, itemCount);
// 1. transform on single thread
IConnectableObservable<byte[]> source =
numbers.Select(Transform).ToObservable(eventLoop).Publish();
// 2. naive parallelization, restricts parallelization to Work
// only; chunk up sequence into smaller sequences and process
// in parallel, merging results
IObservable<int> final = source.
Buffer(10).
Select(
batch =>
batch.
ToObservable(concurrency).
Buffer(10).
Select(
concurrentBatch =>
concurrentBatch.
Select(Work).
ToArray().
ToObservable(eventLoop)).
Merge()).
Merge();
final.Subscribe();
source.Connect();
Await(final).Wait();
Run Code Online (Sandbox Code Playgroud)
如果你真的很想玩这个,那么替身方法就像
private async static …Run Code Online (Sandbox Code Playgroud) 如此摆弄MSBuild任务,我发现Regex元数据属性只评估一次,而不是每个项目。
例如
<!--
actual items, we use standard project reference items and extend via
ItemDefinitionGroup. add project references through IDE to extend
coverage
-->
<ItemGroup>
<ProjectReference Include="..\Example.UnitTests-x86\Example.UnitTests-x86.csproj">
<Project>{7e854803-007c-4800-80f9-be908655229d}</Project>
<Name>Example.UnitTests-x86</Name>
</ProjectReference>
<ProjectReference Include="..\Example.UnitTests\Example.UnitTests.csproj">
<Project>{eaac5f22-bfb8-4df7-a711-126907831a0f}</Project>
<Name>Example.UnitTests</Name>
</ProjectReference>
</ItemGroup>
<!-- additional item properties, defined with respect to item declaring it -->
<ItemDefinitionGroup>
<ProjectReference>
<Isx86>
$([System.Text.RegularExpressions.Regex]::IsMatch(%(Filename), '.*x86*'))
</Isx86>
</ProjectReference>
</ItemDefinitionGroup>
<!-- additional task target, invoke both x64 and x86 tasks here -->
<Target Name="AdditionalTasks">
<Message
Text="%(ProjectReference.Filename) Isx86 '%(Isx86)' Inline
'$([System.Text.RegularExpressions.Regex]::IsMatch(%(Filename), '.*x86*'))'"
Importance="high" />
</Target> …Run Code Online (Sandbox Code Playgroud)