• nhibernate的不支持


    linq的不支持:

    IQueryable<Model.MessageBoard> iq = new ManagerBase<Model.MessageBoard, Model.MessageBoard>().Query();
     IQueryable<Model.Author> iq2 = new ManagerBase<Model.Author, Model.Author>().Query();

    IQueryable<Model.Order> iq2 = new ManagerBase<Model.Order, Model.Order>().Query();
               IList<Gx.Model.MessageBoard> MessBoard = (from m in iq2
                                                         join m2 in iq
                                                         on m.AuthorId equals m2.Author.AuthorId into m3
                                                         from t in m3
                                                         // where m2.AuthorId<15   .............................没编译就直接报错

                                                        //where m.AuhtorID<15   .................................没有问题(但是,我想要的是用m2.AuthorId作条件,不知道如何解决。)
                                                         select new Gx.Model.MessageBoard { Mb_id = t.Mb_id, FromID = t.FromID, Realname = t.FromID != 0 ? t.Author.RealName : t.Realname, MBIP = t.FromID != 0 ? t.Author.OtherAddress : t.MBIP, MBMessage = t.MBMessage, MBMessageDate = t.MBMessageDate, Author = t.Author })
                                                         .Take(Count)
                      //.where(o=>o.AuthorId) .......................编译后也会报错。
                                                         .ToList<Gx.Model.MessageBoard>()

                                                         ;
               MessBoard = MessBoard
                                  .OrderByDescending(o => o.Mb_id)
                                  .ToList();

    ------------------------------------------------------------------------------------------------------------------------------------------------

    from c in Customers
      from p in c.Purchases.DefaultIfEmpty()//DefaultIfEmpty()在linq中可以实现左连接,但是在nhibernate to linq中却不行。
                            select new { c.Name, p.Description, Price = (decimal?)p.Price }

    -----------------------------------------------------------------------------------------------------------------------------------------------------

    -----------------------------------------------------------------------------------------------------------------------------------------------------

    HQL的不支持:

    string HQL = "SELECT  t.Mb_id ,t.FromID ,(case when t.FromID!=0 then A.RealName  else t.Realname  end),(cast(t.MBMessage as string)),t.MBMessageDate,cast(A.Username as string)  from Author A right join MessageBoard t on A.AuthorID=t.FromID//当两张表不存在父子关系的时候,不能使用这种方式连表(用linq和sql可以实现)

    where A.AuthorId=:AID  group by t.Mb_id,t.FromID,A.RealName,t.Realname,t.MBMessage,t.MBMessageDate,A.Username";

  • 相关阅读:
    Codeforces 1182E Product Oriented Recurrence 矩阵快速幂
    Codeforces 1182D Complete Mirror hash
    HDU
    HDU
    HDU
    HDU
    HDU
    HDU
    web框架之Vue渐进式框架-安装及入门
    web框架之Jqeury基本使用
  • 原文地址:https://www.cnblogs.com/zhuhoumo/p/2837643.html
Copyright © 2020-2023  润新知