//SELECT *, NEWID() AS NEWID FROM Sys_Company
[NUnit.Framework.Test]
public void SelectALLGuidFromTableOrderBy()
{
var session = Z.Core.NHibernateCore.NHibernateHelper.GetCurrentSession();
var crit = session.CreateCriteria<Model.Sys.Company>();
crit.SetProjection(NHibernate.Criterion.Projections.ProjectionList()
.Add(NHibernate.Criterion.Projections.SqlProjection("NEWID() AS NEWID"
, new string[] { "NEWID" }
, new NHibernate.Type.IType[] { NHibernate.NHibernateUtil.Guid }))
);
var list = crit.List();
Console.Write(list.Count);
}以上是生成
SELECT NEWID() AS NEWID FROM Sys_Company
但怎么生成
SELECT *, NEWID() AS NEWID FROM Sys_Company
谢谢
我现在是想知道用Ceriteria是怎么来写
谢谢
");
http://big5.webasp.net/article/13/12204.htmhttp://stackoverflow.com/questions/1164371/how-to-query-a-subproperty-with-nhibernates-criteria-api-and-the-entity-to-loadhttp://translate.google.com.hk/translate?hl=zh-TW&sl=en&tl=zh-CN&u=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2007%2F07%2F26%2Fwriting-a-custom-criteria-in-nhibernate%2F