dynamic linq

Post on 24-Jan-2015

1.168 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Dynamic LINQ

Martin Hey

21.07.2010

Communardo Software GmbH

2Communardo Software GmbH · Kleiststraße 10a · D-01129 Dresden/Germany

info@communardo.de · www.communardo.de · Tel. +49 (351) 8 33 82-0

im .NET-Framework integrierte Abfragesprache

erlaubt typsichere Abfragen

SQL-ähnliche Syntax

Beispiele:

LINQ To Objects – was ist das?

3Communardo Software GmbH · Kleiststraße 10a · D-01129 Dresden/Germany

info@communardo.de · www.communardo.de · Tel. +49 (351) 8 33 82-0

wird bereits zur Entwurfszeit auf Korrektheit geprüft

erlaubt typsichere Abfragen auch über komplexe

Objektstrukturen, z.B. durch Aggregierung,

Projektion, Joins, Berechnungen etc.

LINQ To Objects – was ist das?

4Communardo Software GmbH · Kleiststraße 10a · D-01129 Dresden/Germany

info@communardo.de · www.communardo.de · Tel. +49 (351) 8 33 82-0

wird über Extension-Methods realisiert

LINQ To Objects – was ist das?

5Communardo Software GmbH · Kleiststraße 10a · D-01129 Dresden/Germany

info@communardo.de · www.communardo.de · Tel. +49 (351) 8 33 82-0

Use-Case: Die Anwender sollen selbst im User-

Interface definieren können, nach welchen Attributen

die anzuzeigenden Objekte gefiltert und sortiert

werden sollen.

eines der großen Pro‘s von LINQ wird zum

„Verhängnis“ – die Typsicherheit

Warum dynamisch?

6Communardo Software GmbH · Kleiststraße 10a · D-01129 Dresden/Germany

info@communardo.de · www.communardo.de · Tel. +49 (351) 8 33 82-0

LINQ Queries sind aufgebaut als sog. Expression-

Tree

visualisierbar z.B. mit Expression Tree Viewer

(http://sourceforge.net/projects/exprview/)

Dynamisch… aber wie?

7Communardo Software GmbH · Kleiststraße 10a · D-01129 Dresden/Germany

info@communardo.de · www.communardo.de · Tel. +49 (351) 8 33 82-0

Liste von Objekten vom Typ

„Restaurant“

dynamische Filterung und Sortierung der

Daten nach vom Anwender gewählten

Kriterien

dynamischer Aufbau des ExpressionTrees

ggf. per Reflection mögliche Kriterien ermitteln

Visualisierung der Ergebnisse in einem

Grid

Was ist zu tun?

8Communardo Software GmbH · Kleiststraße 10a · D-01129 Dresden/Germany

info@communardo.de · www.communardo.de · Tel. +49 (351) 8 33 82-0

jetzt wird programmiert

Demo

9Communardo Software GmbH · Kleiststraße 10a · D-01129 Dresden/Germany

info@communardo.de · www.communardo.de · Tel. +49 (351) 8 33 82-0

LINQ Dynamic Query Library

http://weblogs.asp.net/scottgu/archive/2008/01/07/d

ynamic-linq-part-1-using-the-linq-dynamic-query-

library.aspx

Was gibt‘s noch?

Vielen Dank

für Eure

Aufmerk-

samkeit.

Communardo Software GmbH · Kleiststraße 10a · D-01129 Dresden/Germany

info@communardo.de · www.communardo.de · Tel. +49 (351) 8 33 82-010

11Communardo Software GmbH · Kleiststraße 10a · D-01129 Dresden/Germany

info@communardo.de · www.communardo.de · Tel. +49 (351) 8 33 82-0

25.08.2010

Einführung in die Windows Phone 7 Entwicklung (Martin Hey)

ggf. Buildmanagement, Branching- und Merging-Strategien mit dem

TFS (Robert Mühsig)

22.09.2010

ASP.NET MVC Deep Dive (Albert Weinert)

Nächste Termine

top related