zoukankan      html  css  js  c++  java
  • 抽时间回答一下

    http://www.cnblogs.com/leotsai/p/aspnet-tests-for-juniors.html

    第4题 只是考会不会扩展方法

    public static IQueryable<T> WhereNotDeleted<T>(this IQueryable<T> query) where T : Product
    {
    return query.Where(t => t.IsDeleted == "No");
    }

    public static IQueryable<Product> WhereNotDeleted(this IQueryable<Product> query) 
    {
    return query.Where(t => t.IsDeleted == "No");
    }


    第5题 2表关联group by 

    SELECT a.`Name` NAME,b.`Year` YEAR,b.`Month` MONTH,SUM(b.`Amount`) Icome FROM USER a,Income b WHERE a.`ID`=b.`UserId`
    GROUP BY a.`Name`,b.`Year`,b.`Month`
    ORDER BY a.`Name`,b.`Year`,b.`Month`


    第6题 考linq的2表关联Group By 

                var rtSource = from a in users
                               from b in incomes
                               where a.Id == b.UserId
                               group new { a, b } by new { a.Name, b.Year, b.Month } into g
                               select new UserIncomeDto() { Name=g.Key.Name,Year=g.Key.Year,Month=g.Key.Month,Income=g.Sum(t=>t.b.Amount)};
                return rtSource.ToList();


    第7题 mvc内容目前没有接触到
    第8题用 Func<Product, string> 来做的吧??

    class Product1
        {
            public string Name { get; set; }
            public string Description { get; set; }
    
            public void Validate1()
            {
                if (string.IsNullOrEmpty(this.Name))
                {
                    throw new Exception("please enter a name for the product");
                }
                if (string.IsNullOrEmpty(this.Description))
                {
                    throw new Exception("product description is required");
                }
            }
    
            public void Validate2()
            {

                 //this.Require(x => x.Name, "please enter a name for the product");
                 //this.Require(x => x.Description, "product description is required");

    this.Require(GetName, "please enter a name for the product");
                this.Require(x => { string baba = x.Description + "bbbbb"; return baba; }, "product description is required");
            }
    
            string GetName(Product1 haha)
            {
                return haha.Name;
            }
    
            void Require(Func<Product1, string> aaa, string erro)
            {
                if ((aaa(this) + "").Length == 0)
                    Console.WriteLine(erro);
                else
                    Console.WriteLine(aaa(this));
            }
        }
  • 相关阅读:
    微信公众号开发问题总结(坑)
    map 取值报空指针,明明值存在
    关于客户端Socket连接服务端,客户端只有在服务端关闭后才收到数据的问题
    关于Spine动画,关于cocosCreator
    cocsoCreator实现镜头跟随节点移动
    cocos节点添加Touch监听代码
    使用git管理你的代码,使用git托管代码至gitee
    关于ccoosCreator里的物理系统
    Python Scrapy 爬虫简单教程
    quasar 参考文档
  • 原文地址:https://www.cnblogs.com/m7777/p/4109636.html
Copyright © 2011-2022 走看看