如果我在一个线程中多次调用一个查询,我只想为该线程缓存该查询(及其结果)(或者因为我每个线程使用一个会话,因为该会话),该怎么办?我这样做?
注意:我的第二级缓存已打开,但它主要用于session.get(...).但是我不想将它用于我的查询缓存,因为我只需要它在我的线程(/ session)期间存活.
谢谢
我试图比较nHibernate linq中的两个日期(DateTime):
query = query.Where(l => (l.datCriacao.Date == dtLote.Date)
Run Code Online (Sandbox Code Playgroud)
但我收到错误:
NHibernate.QueryException: could not resolve property: datCriacao.Date of: SAGP.Entities.Lote
Run Code Online (Sandbox Code Playgroud)
谁知道我怎么解决这个问题?谢谢
我一直在使用SendKeys.Send()&SendKeys.SendWait()将密钥发送到前台程序(与编写的应用程序不同的程序).
我尝试通过重复发送相同的密钥来发送连续的按键,它们之间有一定的延迟,但效果与该应用程序中的连续按键不同.
我的问题是:如何向程序发送连续按键?该按键的效果必须与在应用程序中连续按下该按键相同.
解决方案编辑
解决方案是调用方法:
[DllImport("User32.dll")]
static extern int SendMessage(IntPtr hWnd, uint wMsg, UIntPtr wParam, IntPtr lParam);
Run Code Online (Sandbox Code Playgroud)
参数来自:
public System.Diagnostics.Process [] p = System.Diagnostics.Process.GetProcessesByName("process");
p [0] .MainWindowHandle是hWnd
并在窗口上使用间谍:

右键单击Spy中的消息行显示wMsg,wParam和lParam(所有3个十六进制)
SendMessage(p [0] .MainWindowHandle,(uint)0x0100,(UIntPtr)0x00000041,(IntPtr)(0x001E0001));
通过仅发送一个WM_KEYDOWN消息,效果就是连续按下键.为了停止程序作为键持续按下,我必须按下键盘上的那个键并释放它,以便生成WM_KEYUP.在代码中发送WM_KEYUP会产生System.OverFlow"算术运算导致溢出".例外.任何想法为什么会发生这种情况?
感谢您的回复:Ation和takrl
鉴于这种:
namespace TheEntities
{
[DataContract(IsReference=true)]
public class Question
{
[DataMember] public virtual int QuestionId { get; set; }
[DataMember] public virtual string Text { get; set; }
[DataMember] public virtual string Poster { get; set; }
[DataMember] public virtual IList<QuestionComment> Comments { get; set; }
[DataMember] public virtual IList<Answer> Answers{ get; set; }
[DataMember] public virtual byte[] RowVersion { get; set; }
}
[DataContract]
public class QuestionComment
{
[DataMember] public virtual Question Question { get; set; }
[DataMember] public virtual …Run Code Online (Sandbox Code Playgroud) 如果我使用:
架构 - >生成依赖关系图 - >按类
它为整个解决方案生成图表.
有没有办法让VS只为某个项目的类生成依赖图?
我尝试仅为某个项目生成Architecture Explorer -> Create a new graph document from all the selected nodes(使用和不使用ctrl)但它只生成它们之间没有连接的类或连接到命名空间的类.
谢谢你的帮助!
拥有NHibernate实体:
Company,Invoice并且InvoiceLine具有小数属性Price.
A Company具有类型的集合Invoice,并且Invoice具有类型的集合InvoiceLine.
如何获取属于发票行的所有价格的总和,这些发票行属于由id指定的某个公司的发票?
我试着写这样的查询:
session
.Query<InvoiceLine>()
.Where(invoiceLine => invoiceLine.Invoice.Company.Id == companyId)
.Sum(invoiceLine => invoiceLine.Price);
Run Code Online (Sandbox Code Playgroud)
但它引发了一个例外:
NHibernate.Exceptions.GenericADOException
"Could not execute query[SQL: SQL not available]"
at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
at NHibernate.Impl.AbstractSessionImpl.List(IQueryExpression queryExpression, QueryParameters parameters)
at NHibernate.Impl.ExpressionQueryImpl.List()
at NHibernate.Linq.DefaultQueryProvider.ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression)
at NHibernate.Linq.DefaultQueryProvider.Execute[TResult](Expression expression)
at System.Linq.Queryable.Sum[TSource](IQueryable`1 source, Expression`1 selector)
Run Code Online (Sandbox Code Playgroud)
内在异常:
System.ArgumentNullException
"Value cannot be null.\r\nParameter name: item"
at …Run Code Online (Sandbox Code Playgroud) 我可以使用http://pcname:42424/projectname/view.
尝试使用 IP 访问它,例如。http://192.168.1.42:42424/projectname/view产量
OAuth 2.0 错误
未经授权的客户端:未注册的重定向 URI。客户端服务“Upsource”请求未在 Hub 中注册的 URI 的授权实体:http : //192.168.3.143 : 42424/。如果您拥有 Hub 管理员权限并且可疑 URI 确实属于“Upsource”,请将此 URI 添加到 Hub 服务设置中的“重定向 URI”列表中
链接到https://www.jetbrains.com/help/hub/2.0/OAuth-2.0-Errors.html#auth.unauthorized_client
我redirectUri在 Upsource 中找不到如何设置(可能浏览了所有设置页面)。
在哪里可以找到redirectUri设置以便我可以将我的 IP 添加到其中?
更新
我在不同的盒子上设置了另一个实例,并将 URL 和端口设置为http://192.168.1.42:42424,现在它可以成功地使用 IP 远程访问。
使用pgFouine 1.2,PostgreSQL 9.1.3.
postgresql.conf设置:
log_min_duration_statement = 0
log_duration = on
log_line_prefix = '%t [%p]: [%l-1] '
log_statement = 'all'
lc_messages = 'C' # locale for system error message strings
lc_monetary = 'C' # locale for monetary formatting
lc_numeric = 'C' # locale for number formatting
lc_time = 'C' # locale for time formatting
Run Code Online (Sandbox Code Playgroud)
运行pgFouine时出错:
C:\Users\Razvan\Desktop\pgfouine-1.2>php pgfouine.php -file log > report.html
pgFouine did not find any valid PostgreSQL log line in your log file:
* check that PostgreSQL uses an english …Run Code Online (Sandbox Code Playgroud) 有没有办法在满足某个条件时进入调试模式?
例如,假设我想在i == 1变为true 的行上进入调试模式:
using System;
namespace ConditionalDebug
{
public class Program
{
public static void Main(string[] args)
{
var r = new Random();
var i = r.Next(2);
i += r.Next(2);
i += r.Next(2);
i += r.Next(2);
i += r.Next(2);
i = 1;
Console.WriteLine(i);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我知道可以设置条件断点,如:

但当然我无法使用它,因为我必须为代码中的每一行添加条件断点,其中条件值可能会发生变化,并且在实际应用程序中会变得非常混乱.
那么,有没有办法全局设置条件,i == 1以便调试器在满足条件的行上中断?
谢谢你的帮助!
c# debugging visual-studio-2010 visual-studio conditional-statements
如果我在nix-shell它下面构建我的 Haskell 项目,则会出现关于缺少zlib.
如果我使用 nix-shell 构建项目,nix-shell -p zlib则该项目zlib会成功查看并构建。
如何将zlib包添加到shell.nix文件以便-p zlib不再需要传递?
注意:构建是使用 cabal v2-build
为了使用堆栈构建,我必须执行以下操作
这是我shell.nix目前的定义方式:
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:
let
inherit (nixpkgs) pkgs;
f = { mkDerivation, base, directory, stdenv, text, turtle, zlib }:
mkDerivation {
pname = "haskell-editor-setup";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [ …Run Code Online (Sandbox Code Playgroud)