English 中文(简体)
NHibern 3.0 - 在不向分局引入分局的情况下,在选定清单中只列出一个表述。
原标题:NHibernate 3.0 - Only one expression can be specified in the select list when the subquery is not introduced with EXISTS."

我们正在设法升级至3国,现在我对以下林克问题表示怀疑。 它的回报是,“只有一种表述可以在选择清单中具体指明,而该次顺序没有出现EXISTS错误。

这是控制器中的lin。

var list = (from item in ItemTasks.FindTabbedOrDefault(tab)
                    select new ItemSummary
                               {
                                   Id = item.Id,
                                   LastModifyDate = item.LastModifyDate,
                                   Tags = (from tag in item.Tags
                                           select new TagSummary
                                                      {
                                                          ItemsCount = tag.Items.Count,
                                                          Name = tag.Name
                                                      }).ToList(),
                                   Title = item.Title
                               });

如下:

select   TOP ( 1 /* @p0 */ ) item0_.Id             as col_0_0_,
                 item0_.LastModifyDate as col_1_0_,
                 (select (select cast(count(* ) as INT)
                          from   dbo.ItemsToTags items3_,
                                 dbo.Item item4_
                          where  tag2_.Id = items3_.Tag_id
                                 and items3_.Item_id = item4_.Id),
                         tag2_.Name
                  from   dbo.ItemsToTags tags1_,
                         dbo.Tag tag2_
                  where  item0_.Id = tags1_.Item_id
                         and tags1_.Tag_id = tag2_.Id) as col_2_0_,
                 item0_.Title          as col_3_0_ from     dbo.Item item0_ order by item0_.ItemPostDate desc

ps: 如果拆除了林克矿区中的塔格斯财产,则会进行罚款。

问题在哪里?

提前感谢。

问题回答

I ve got the same Generic ADO Exception error, I think it s actually the limitation of SQL server; Is it possible somehow load object graph with projections in collections?

如果我尝试:

var cats = q.Select(t => new cat()
                                          {
                                              NickName = t.NickName,
                                              Legs = t.Legs.Select(l => new Leg()
                                                                            {
                                                                                Color = l.Color,
                                                                                Size = l.Size
                                                                            }).ToList()
                                          }).ToList();

这同样是错误的。





相关问题
nHibernate one-to-many inserts but doesnt update

Instead of getting into code, I have a simple question. Default behavior for a simple one-to-many is that it inserts the child record then updates the foreign key column with the parent key. Has ...

How Do I copy an existing nhibernate object as a new object?

I a persisted NHibernate object that I would like to repersist as a new entity. How do I get NHibernate to save this object as if it was a new? I am thinking I might create a session interceptor to ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

WPF - MVVM - NHibernate Validation

Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on ...

NHibernate Search in a List using ICriteria

I have my class X : public class ClassX { public virtual IList<ClassY> ListY { get; set; } ... } My ClassX mapping (using Fluent) ... HasMany<ClassX>(x => x.ListY ) ....

热门标签