我有一个方法暴露为我的WCF服务的OperationContract,我想重做.以前的程序员写过类似的东西:
public ReportResultObject GetReport(string stringContainingParameters)
Run Code Online (Sandbox Code Playgroud)
我想有一个更像这样的方法:
public ReportResultObject GetReport(int[] someIds, bool includeAdditionalInformation)
Run Code Online (Sandbox Code Playgroud)
由于WCF不允许重载方法而不在OperationContract中指定Name属性,并且我不想打破当前客户端,是否存在这样的情况的命名约定?像GetReportV2或GetReportHeyUseMeInstead?
假设我有一个带有DateTime字段和int字段的表,并执行如下查询:
var query = context.tblSomeTable.Where(s=>s.Name == "Hello World").OrderBy(s=>s.SignUpDate);
Run Code Online (Sandbox Code Playgroud)
如果我随后用结果执行两个子查询,它们是否仍按日期排序?:
var sub1 = query.Where(s=>s.Id = 5);
var sub2 = query.Where(s=>s.Id = 8);
Run Code Online (Sandbox Code Playgroud)
我的直觉说它们仍处于有序状态,但是如果原始查询已被迭代/执行了,这是否重要?
我有一个自定义绑定定义如下:
<customBinding>
<binding name="binaryHttpBinding">
<binaryMessageEncoding />
<httpTransport />
</binding>
Run Code Online (Sandbox Code Playgroud)
这用于Silverlight 3应用程序用于连接服务的端点.这在HTTP下工作正常,但我想指定此绑定使用HTTPS,我有点失去了如何定义它.我使用IIS资源工具包中的selfSSL.exe在我的本地计算机上设置SSL.我可以通过HTTPS很好地浏览svc文件(尽管浏览器会发出警告,表明它不是公认的证书).如何设置此自定义绑定以通过HTTPS使用传输安全性?
我有一个固定在页面底部的 div(位置:固定),在普通浏览器中工作正常,但在移动浏览器(iphone、android 和 WP7)上它显示在屏幕外。如果我在移动设备上放大然后缩小,我可以看到 div 重新定位到它认为底部的位置。如果有人能提供快速修复或为我指出正确的方向,那就太好了,但我真的正在寻找有关移动浏览器处理坐标和桌面的差异的很好的参考。
我刚刚使用PhoneGap CLI 安装了PhoneGap 3.5和PushPlugin.我使用PhoneGap CLI创建了一个项目.在receivedEventindex.js 的方法中,我添加了以下行:
var pushNotification = window.plugins.pushNotification;
pushNotification.register(myTokenMethod, onError, {"badge": "true", "sound": "true", "alert":"true", "ecb": "mycallback"}
Run Code Online (Sandbox Code Playgroud)
这会导致xCode中的错误:
CDVPlugin class PushPlugin (pluginName: PushPlugin) does not exist
ERROR: Plugin 'PushPlugin' not found or is not a CDVPlugin. Check your plugin mapping in config.xml
Run Code Online (Sandbox Code Playgroud)
虽然说明并没有表明我需要自动安装插件,但我继续补充说
<feature name="PushPlugin">
<param name="ios-package" value="PushPlugin" />
</feature>
Run Code Online (Sandbox Code Playgroud)
到我的config.xml并收到相同的错误.插件版本是2.4,我使用iPhone 6作为测试设备和xCode 6.
任何想法在哪里看?
plugins apple-push-notifications ios cordova phonegap-pushplugin
这很简单:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title></title>
<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$.get("http://twitter.com/statuses/user_timeline/19092829.rss");
});
</script>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
在IE和Opera中,这非常有效,但在FF 3.5,Chrome和Safari中我得到了400 Bad Request.使用Fiddler2和FireBug查看请求,有些东西正在用OPTIONS替换GET.但在IE和Opera中,它仍然显示为GET.我不明白????
编辑:我觉得这样的白痴甚至没有考虑XSS政策.多谢你们.
我有两个<div/>以"A列"和"B列"的方式排列.B列是设定宽度,我希望A列占用剩余空间.有没有办法在CSS中实现这一点?或者也许是我正在做的更好的选择?
这是结构:
<div>
<div id='colA'>style is float right</div>
<div id='colB'>this has a set width of 50px</div>
<div>
Run Code Online (Sandbox Code Playgroud) 我知道这可能是一个简单的问题,但我开始迷路了。我用于为强名称(在 Visual Studio 项目属性中)签署程序集的私钥是否与生成 CSR 相关/需要?
我有Web API方法调用另一个标记为async的方法来更新数据库(使用EF 6).我不需要等待db方法来完成(它的火和忘记),因此我await在调用这个异步方法时不会使用它.如果我不调用await,则抛出NullReferenceException,它永远不会传递给我的代码,只是在VS2013的输出窗口中显示为第一次机会异常.
没有await-ing 处理异步方法的正确方法是什么?
以下是我正在做的事情的一个例子:
数据回购方法:
public async Task UpdateSessionCheckAsync(int sessionId, DateTime time)
{
using (MyEntities context = new MyEntities())
{
var session = await context.Sessions.FindAsync(sessionId);
if (session != null)
session.LastCheck = time;
await context.SaveChangesAsync();
}
}
Run Code Online (Sandbox Code Playgroud)
Web api存储库方法:
public async Task<ISession> GetSessionInfoAsync(int accountId, int siteId, int visitorId, int sessionId)
{
//some type of validation
var session =await GetValidSession(accountId, siteId, visitorId, sessionId);
DataAdapter.UpdateSessionCheckAsync(sessionId, DateTime.UtcNow); // this is the line causing the exception if …Run Code Online (Sandbox Code Playgroud) 是否可以将IEnumerable<KeyValuePair<string,string>>KeyValuePair的aa转换为匿名类型?
Dictionary<string, string> dict= new Dictionary<string, string>();
dict.add("first", "hello");
dict.add("second", "world");
var anonType = new{dict.Keys[0] = dict[0], dict.Keys[1] = dict[1]};
Console.WriteLine(anonType.first);
Console.WriteLine(anonType.second);
********************output*****************
hello
world
Run Code Online (Sandbox Code Playgroud)
我想这样做的原因是因为我从web服务中检索一个对象,该对象表示wsdl中不存在的对象.返回的对象仅包含KeyValuePair集合,该集合包含自定义字段及其值.这些自定义字段可以命名为任何内容,因此我无法将xml反序列化方法映射到我将使用的最终对象(其属性必须绑定到网格).
*仅仅因为我使用Dictionary<string,string>并不意味着它绝对是一本字典,我只是用它来说明.真的是它IEnumerable<KeyValuePair<string,string>>
我一直试图想办法做到这一点,但我画了一个空白.这是c#.NET 4.0.
我试图写一个Asp.Net形式的文件(.aspx).我可以使用创建文件,
if (!File.Exists(Settings.Default.FileLocation))
{
File.Create(Settings.Default.FileLocation);
}
Run Code Online (Sandbox Code Playgroud)
但是当我使用这段代码写入文件时:
File.WriteAllBytes(Settings.Default.FileLocation, someByteArray);
Run Code Online (Sandbox Code Playgroud)
我得到一个例外:
System.IO.IOException: The process cannot access the file 'C:\inetpub\wwwroot\mysite.com\captured\captured.xml' because it is being used by another process.
Run Code Online (Sandbox Code Playgroud)
(在这种情况下'C:\ inetpub\wwwroot\mysite.com\captured\captured.xml'== Settings.Default.FileLocation)
在此期间,我无法在Windows资源管理器中删除或复制该文件.但是,如果我停止或重新启动WebForm正在运行的应用程序池,则错误消失.造成这种情况的原因是什么?如何预防?
这是在Win服务器2012 R2和IIS 7.5上运行
c# ×7
.net ×5
html ×2
javascript ×2
wcf ×2
asp.net ×1
async-await ×1
cordova ×1
css ×1
ios ×1
jquery ×1
linq ×1
linq-to-sql ×1
plugins ×1
silverlight ×1