我在postgresql中有一个数据库,我想在我的项目中使用vs 2010(v4.0)中的向导生成edmx(实体框架).
我按照本博客http://fxjr.blogspot.in/2011/05/npgsql-design-time-support-preview.html中给出的所有步骤进行了操作, 但在生成edmx时我找不到postgresql的数据提供程序.
我也见过http://ud-csharp.blogspot.in/2010/02/entity-framework-con-postgresql.html,但没有取得任何成功.
我有一个下面的课
public class SearchModel
{
public string Locations { get; set; }
public string City { get; set; }
public string Address { get; set; }
public string MaxRecord { get; set; }
public string PageSize { get; set; }
....
....
Approx 80 properties
}
Run Code Online (Sandbox Code Playgroud)
我有一个查询字符串 "my location_Locations/new york_City/city street_Address/200_MaxRecord/20_PageSize"
上面的字符串包含类的确切属性名称SearchModel.现在我想做以下事情: -
SearchModel model = new SearchModel();
string[] Parameters = "my location_Locations/new york_City/city street_Address/200_MaxRecord/20_PageSize".Split('/');
foreach (string item in Parameters)
{
string[] value=item.Split('_');
model.value[1] = value[0];
}
Run Code Online (Sandbox Code Playgroud) 如何实现以下类型的东西?
dynamic prod = vid.HasValue ?
CatalogRepository.GetProductDetailByProductId(pid.Value, vid)
: CatalogRepository.GetProductDetailByProductId(pid.Value);
Run Code Online (Sandbox Code Playgroud)
GetProductDetailByProductId(pid.Value)返回一个Object of Productwhile GetProductDetailByProductId(pid.Value, vid)返回一个Object ProductVariant.
我将对象分配给动态变量,因此应该在运行时识别它,但它在编译时给出了类型转换错误.
我创建了一个通过MSMQ发送消息但在执行时获得异常的函数.以下是我的功能.
public void SendMessageToQueue(ChessQueue chessQueue)
{
MessageQueue queue = null;
Message m = null;
if (!MessageQueue.Exists(".\\Private$\\" + chessQueue.QueueName))
{
queue = new MessageQueue(".\\Private$\\chessqueue");
chessQueue.Messages = new List<MessageObject>();
chessQueue.Messages.Add(chessQueue.Message);
queue.Formatter = new BinaryMessageFormatter();
m = new Message();
m.Body = chessQueue;
}
else
{
queue = new MessageQueue(".\\Private$\\" + chessQueue.QueueName);
queue.Formatter = new BinaryMessageFormatter();
m = queue.Receive();
ChessQueue ExistingChessQueue = m.Body as ChessQueue;
ExistingChessQueue.Messages.Add(chessQueue.Message);
m.Body = ExistingChessQueue;
}
queue.Send(m);
// Getting Exception at this Line
}
Run Code Online (Sandbox Code Playgroud)
例外: - 队列不存在或您没有足够的权限来执行操作.
此外,我无法在"计算机管理"下打开"消息队列"的安全选项卡.请参见附件截图.

我尝试在私人手动下创建消息队列,系统允许我这样做.见下文

下面是mmc跨度.

我使用下面的代码来缩短长网址
public static string UrlShorten(string url)
{
string post = "{\"longUrl\": \"" + url + "\"}";
string shortUrl = url;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.googleapis.com/urlshortener/v1/url?key=" + ReadConfig("GoogleUrlShortnerApiKey"));
try
{
request.ServicePoint.Expect100Continue = false;
request.Method = "POST";
request.ContentLength = post.Length;
request.ContentType = "application/json";
request.Headers.Add("Cache-Control", "no-cache");
using (Stream requestStream = request.GetRequestStream())
{
byte[] postBuffer = Encoding.ASCII.GetBytes(post);
requestStream.Write(postBuffer, 0, postBuffer.Length);
}
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (Stream responseStream = response.GetResponseStream())
{
using (StreamReader responseReader = new StreamReader(responseStream))
{
string json = responseReader.ReadToEnd();
shortUrl …Run Code Online (Sandbox Code Playgroud) 我已经完成了一些URL路由,就像某些URL一样.
routes.MapRoute(
"ProductDetails",
"Product/{name}/{*other}",
new { controller = "Product", action = "Details" }
);
Run Code Online (Sandbox Code Playgroud)
上面的代码将路由所有/Product/{name}类型的URL /Product/Details/{parameter}.它工作正常,现在我想要,如果我输入网址/Product/List,这必须通过默认路由处理.
我不想再为List创建一条路线.
请指教.
在我的代码中,我添加onclick了父 div 并希望对内部 div 执行其他操作,但单击内部 div 也会触发父单击。如何阻止?
$(document).on('click', '.child', function(e) {
e.preventDefault();
e.stopPropagation();
console.log('child');
});
function parentfun(sender) {
console.log('parent');
}Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="parent" onclick="parentfun(this)">
parent
<div class="child">child</div>
</div>Run Code Online (Sandbox Code Playgroud)
点击孩子,也会触发父母的点击。preventDefault 和 stopPropagation 不起作用。
仅供参考:我的问题与单击子锚点时如何防止父级的 onclick 事件触发不同?
如何使用像这样的URL从雅虎本地获得评论和评级http://local.yahoo.com/info-11057512-gray-s-papaya-new-york;_ylt=AqfdTH3jqpVj68gKIK09u6WGNcIF;_ylv=3.
.net ×3
c# ×3
asp.net ×2
asp.net-mvc ×2
api ×1
google-api ×1
javascript ×1
jquery ×1
msmq ×1
npgsql ×1
review ×1
send ×1
yahoo ×1
yahoo-api ×1