nhibernate-projections

Nhibernate projection with child collection

喜你入骨 提交于 2019-12-01 10:06:46
问题 Using NHibernate 2.1, I'm trying to project an entity and its child collection into a DTO. My entity looks like this.. public class Application { public int Id {get;set;} public string Name {get;set;} public List<ApplicationSetting> Settings {get;set;} // A bunch of other properties that I don't want in the DTO } public class ApplicationSetting { public int Id {get;set;} public string Name {get;set;} public string Code {get;set;} // A bunch of other properties that I don't want in the DTO }

Are there any arithmetic operation projections in NHibernate?

与世无争的帅哥 提交于 2019-11-30 07:30:49
I would like to get this SQL from NHibernate: SELECT SUM(color_pages) * SUM(total_pages) FROM connector_log_entry GROUP BY department_name But I can't find any arithmetic operation (*) projections anywhere. This is the code that I have so far: Session.QueryOver<ConnectorLogEntry>() .SelectList(list => list .SelectGroup(m => m.DepartmentName) .WithAlias(() => dto.Department) .Select(Projections.Sum<ConnectorLogEntry>(m => m.TotalPages)) //.Select(Projections.Sum<ConnectorLogEntry>(m => m.ColorPages)) .WithAlias(() => dto.TotalColorPercentage)) .TransformUsing(Transformers.AliasToBean

Can someone better explain what 'Projections' are in nHibernate?

a 夏天 提交于 2019-11-29 21:23:29
As a new user of nHibernate and its utility library, fluent nhibernate, I am trying to learn enough to be dangerous with a good database. I am having an exceptionally great deal of difficulty understanding the concept of Projections . Specifically, What in the world are they? I have literally done exact searches on ' What are projections? ' and ' Projects in nHibernate ' and ' nHibernate, Projections, Definition ', etc. And I am still very confused. The most helpful posts so far are This other StackOverflow Question and This Blog Post by Colin Ramsay . But I am still vastly confused. My

Nhibernate count distinct (based on multiple columns)

久未见 提交于 2019-11-29 14:49:30
Basically, i have been trying to do this (count distinct based on two columns): select count(distinct(checksum(TableA.PropertyA, TableB.PropertyB))) from TableA left outer join TableB on TableA.TableBId = TableB.Id where PropertyA like '%123%' Been googling on how to do this but with no luck. Tried this, but never actually worked. This does not count distinctly based on the two properties from two tables: var queryOver = c.QueryOver<TableA>(); TableB tableBAlias = null; TableA tableAAlias = null; ProjectionList projections = Projections.ProjectionList(); queryOver.AndRestrictionOn(x => x

Are there any arithmetic operation projections in NHibernate?

こ雲淡風輕ζ 提交于 2019-11-29 09:40:15
问题 I would like to get this SQL from NHibernate: SELECT SUM(color_pages) * SUM(total_pages) FROM connector_log_entry GROUP BY department_name But I can't find any arithmetic operation (*) projections anywhere. This is the code that I have so far: Session.QueryOver<ConnectorLogEntry>() .SelectList(list => list .SelectGroup(m => m.DepartmentName) .WithAlias(() => dto.Department) .Select(Projections.Sum<ConnectorLogEntry>(m => m.TotalPages)) //.Select(Projections.Sum<ConnectorLogEntry>(m => m

Can someone better explain what 'Projections' are in nHibernate?

馋奶兔 提交于 2019-11-28 17:07:46
问题 As a new user of nHibernate and its utility library, fluent nhibernate, I am trying to learn enough to be dangerous with a good database. I am having an exceptionally great deal of difficulty understanding the concept of Projections . Specifically, What in the world are they? I have literally done exact searches on ' What are projections? ' and ' Projects in nHibernate ' and ' nHibernate, Projections, Definition ', etc. And I am still very confused. The most helpful posts so far are This

Fluent NHibernate - ProjectionList - ICriteria is returning null values

﹥>﹥吖頭↗ 提交于 2019-11-28 09:32:08
问题 I'm quite new in NHibernate, but I have googled around and didn't found anything to help with this issue. I hope you guys can ! ;) I'm changing names of properties, and methods, because this code is company's property but basically this is what I need some help. I have the following scenario: My Domain Entity: public class Structure { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual Person Manager { get; set; } //I need to fill here. //and others }