我使用了微软随视觉工作室提供的这个工具,因为它快速而又脏
http://msdn.microsoft.com/en-us/library/bb552364.aspx
但它有点笨重,难以合作.是否有您使用的其他有用的测试客户端,并且不需要创建新的Visual Studio项目和编译代码?
编辑:我正在寻找一个图形测试工具,我可以使用它来在不同的环境中对系统进行快速的临时测试,而无需编写一堆不同的测试.
我目前处理这个问题的方法是使用多个配置文件,例如:
web.config
web.Prod.config
web.QA.config
web.Dev.config
Run Code Online (Sandbox Code Playgroud)
当项目部署到不同的环境时,我只需使用正确的设置重命名相应的文件.
有人建议如何更好地处理这个问题?
编辑:以下是每个配置中的一些变化:
我很好奇每个人在ASP.NET中处理/抽象QueryString的工作.在我们的一些网络应用程序中,我在网站上看到了很多这样的内容:
int val = 0;
if(Request.QueryString["someKey"] != null)
{
val = Convert.ToInt32(Request.QueryString["someKey"]);
}
Run Code Online (Sandbox Code Playgroud)
有什么更好的方法来处理这种严重性?
有没有一种快速的方法将通用字典从一种类型转换为另一种类型
我有这个
IDictionary<string, string> _commands;
Run Code Online (Sandbox Code Playgroud)
并需要将它传递给一个函数,该函数采用稍微不同的类型字典
public void Handle(IDictionary<string, Object> _commands);
Run Code Online (Sandbox Code Playgroud) 我们有一个现有的ServiceContract
[ServiceContract(Namespace = "http://somesite.com/ConversationService")]
public interface IConversationService
{
[OperationContract(IsOneWay = true)]
void ProcessMessage(Message message);
[OperationContract(IsOneWay = true)]
void ProcessMessageResult(MessageResult result);
}
Run Code Online (Sandbox Code Playgroud)
我们需要为它添加一个方法
[ServiceContract(Namespace = "http://somesite.com/ConversationService")]
public interface IConversationService
{
[OperationContract(IsOneWay = true)]
void ProcessMessage(Message message);
[OperationContract(IsOneWay = true)]
void ProcessMessageResult(MessageResult result);
[OperationContract(IsOneWay = true)]
void ProcessBlastMessage(BlastMessage blastMessage);
}
Run Code Online (Sandbox Code Playgroud)
这会破坏使用此服务的任何现有wcf客户端吗?或者我们是否必须更新所有现有的wcf客户端?
编辑:此服务使用netTcpBinding和netMsmqBinding
我有一个对象,其中包含一个通用的IList,它从WCF Web服务方法返回:
[DataContract(Name = "PageableList_Of_{0}")]
public class PageableResults<T>
{
[DataMember]
public IList<T> Items { get; set; }
[DataMember]
public int TotalRows { get; set; }
}
[OperationContract]
PageableResults<ContentItem> ListCI();
Run Code Online (Sandbox Code Playgroud)
当我在服务上调用此方法时,它会很好地执行整个方法,但最后它会抛出System.ExecutionEngineException而不会发生InnerException.我已经尝试返回一个具体的List <>对象,这似乎有效,但不幸的是我需要找到一个解决方法来返回一个IList.我需要输入任何属性来解决这个问题吗?
我有这个功能:
public bool IsValidProduct(int productTypeId)
{
bool isValid = false;
if (productTypeId == 10 ||
productTypeId == 11 ||
productTypeId == 12)
{
isValid = true;
}
return isValid;
}
Run Code Online (Sandbox Code Playgroud)
但我想知道是否有更简单的方法来编写它,例如:
public bool IsValidProduct(int productTypeId)
{
bool isValid = false;
if (productTypeId.In(10,11,12))
{
isValid = true;
}
return isValid;
}
Run Code Online (Sandbox Code Playgroud)
我知道我可以编写一个扩展方法来处理这个问题,我只是好奇是否已经存在某些东西或者是否有更好的方法来编写它.
在我们的代码库中,我们有这种重复的模式,其中有一个接口有一个方法.这是一个真正的设计模式吗?如果是这样,它的好处是什么?
这里有一些例子:
public interface IRunnable
{
void Run();
}
public interface IAction
{
void Perform();
}
public interface ICommand
{
void Execute(ActionArgs _actionargs);
}
Run Code Online (Sandbox Code Playgroud) 我有一个使用WCF服务(WSHttpBinding)的mvc控制器类,有时在一个http请求中有多个调用,并且想知道为该服务创建客户端的成本是多少.是否可以为每次调用创建客户端实例,还是应该在类中创建成员变量?
public class RingbacksController : Controller
{
private void LoadContactsIntoViewData(int page)
{
RingbackServiceClient client = new RingbackServiceClient();
...
client.Close();
}
private void LoadGroupsIntoViewData(int page)
{
RingbackServiceClient client = new RingbackServiceClient();
...
client.Close();
}
}
Run Code Online (Sandbox Code Playgroud)
要么
public class RingbacksController : Controller
{
private RingbackServiceClient client = new RingbackServiceClient();
private void LoadContactsIntoViewData(int page)
{
...
client.Close();
}
private void LoadGroupsIntoViewData(int page)
{
...
client.Close();
}
}
Run Code Online (Sandbox Code Playgroud) c# ×8
.net ×5
wcf ×4
asp.net ×2
web-services ×2
asp.net-mvc ×1
collections ×1
generics ×1
oop ×1