• 검색 결과가 없습니다.

Language INtegrated Query

N/A
N/A
Protected

Academic year: 2021

Share "Language INtegrated Query"

Copied!
13
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

Language INtegrated Query (LINQ) in C#

강대기

동서대학교 컴퓨터정보공학부

(2)

차례

• LINQ to Objects

• LINQ to XML

• LINQ to ADO.NET

(3)

LINQ

• 데이터를 쿼리하는 기능을 언어 구문의 일부로 통 합핚 것

• 언어의 데이터 형식에 안전핚 방식으로 데이터 쿼 리를 지원하는 일련의 언어 확장

• http://msdn.microsoft.com/ko-

kr/library/bb397926.aspx

(4)

기본 구조

(5)

LINQ building blocks, LINQ

providers, 그리고 데이터 소스

(6)

Hello, LINQ to Objects #1

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace HelloLINQ1 {

class Hello {

public static void Main() {

string[] words = { "hello", "wonderful", "linq", "beautiful", "world" };

var shortWords = from word in words where word.Length <= 5 select word;

foreach (var word in shortWords) Console.WriteLine(word);

} } }

(7)

Hello, LINQ to Objects #1 결과

hello

linq

world

(8)

Hello, LINQ to Objects #2

namespace HelloLINQ2 {

class Hello {

public static void Main() {

string[] words = { "hello", "wonderful", "linq", "beautiful", "world" };

var groups =

from word in words orderby word ascending

group word by word.Length into lengthGroups orderby lengthGroups.Key descending

select new { Length = lengthGroups.Key, Words = lengthGroups };

foreach (var group in groups) {

Console.WriteLine("Words of length " + group.Length);

foreach (string word in group.Words) Console.WriteLine(" " + word);

} }

} }

(9)

Hello, LINQ to Objects #2 결과

Words of length 9 beautiful

wonderful

Words of length 5 hello

world

Words of length 4

linq

(10)

LINQ to XML

(11)

LINQ to ADO.NET

• http://msdn.microsoft.com/ko-

kr/library/bb397942.aspx

(12)

LINQ to DataSet

• http://msdn.microsoft.com/ko-

kr/library/bb386977.aspx

(13)

LINQ to SQL

• http://msdn.microsoft.com/ko-

kr/library/bb386976.aspx

참조

관련 문서

박지성이 구매한 책의 출판사와 같은 출판사에서 책을 구매한 고객들 이름 2. 박지성이 구매한 책의 출판사와 같은 출판사에서

Using web page, user sends to web server information about database, web server creates query sentence for database connection. Using created query sentence,

 To describe ideal behaviors of analog circuits, we used to build artificial circuits with ideal sources/RLC, switches, and dependent elements Analog behavioral

à simple data types, good query language, high protection. Advanced

A resolver sends a query message to a local server to find the IP address for the host “chal.fhda.edu.”. Make format of the query and response messages separately. -shows the

Oracle Optimzer 는 대부분의 경우 최적화된 실행계획을 수립하지만 OPTIMIZER 는 3 개 이상의 Table 간의 Join, InLine View 나 SubQuery 가 포함된 복잡한 Query

If there are no results in each case, then your query result is identical to the answer query result, and therefore your query is correct (or at least, it is good enough that

Objects ofthi s research are uni ts rel ated to the anti -bi as educati on i n the 7th mi ddl e schoolKorean Language educati on curri cul um,and 211 mi ddl e school