Tip

    Tip

    C# xml parsing simple linq
    C#  
    <div>
    //EntityFrameWork query 예제

    //Order by
    GetBoardCateList().OrderBy(c => c.sort_id);
    GetBoardCateList().OrderBy(c => c.id).ThenBy(c => c.sort);
    GetBoardCateList().OrderByDescending(c => c.id).ThenByDescending(c => c.sort);



                              // index like 사용 방법

                            from user in _iOnBR.oncd_users
                          where user.sort == (
                                       (
                                          from userS in _iOnBR.oncd_users
                                        where userS.user == rUser
                                        select userS.sort
                                       ).FirstOrDefault()
                                    )
                                    && user.path.StartsWith(
                                      (
                                         from userC in _iOnBR.oncd_users
                                       where userC.user == rUser
                                        select userC.path
                                      ).FirstOrDefault()
                                    )
                           select userGroup


            // Where 사용 방법 Connection 한번 하는 것으로 확인 됨

            public List<oncd_test> GetUser(string rTesetID, string rSearch1, string rSearch2)
            {
                var xTests = from test in _iOnBR.oncd_tests
                            where test.test_id == rTestID
                           select user;

                if (!string.IsNullOrEmpty(rSearch1)) {
                    xTests = xTests.Where(u => u.search1 == rSearch1);
                }
                if (!string.IsNullOrEmpty(rSearch2))
                {
                    xTests = xTests.Where(u => u.search2 == rSearch2);
                }

                return xTests.ToList();
            }
    </div>

    Comment (0)
    댓글 등록 폼
    덧글 입력박스
    유동형 덧글모듈