Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to...

33
Sponsoren Softwaresponsoren Mediasponsoren

Transcript of Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to...

Page 1: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Sponsoren

Softwaresponsoren

Mediasponsoren

Page 2: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

VB 9 & LINQ

Page 3: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Agenda

Vorstellung KnowledgeCenterNeue Sprachfeautres in VB 9.0LINQ to SQL in der Praxis

Page 4: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

www.dnug-koeln.de www.justcommunity.de

LINQ mit VB 9.0 in der Praxis

Page 5: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Agenda

VorstellungDie Anwendung: KnowledgeBaseMotivation, Architektur & TechnologieDie neuen Sprachfeatures in VB 9.0LINQ im EinsatzTipp & Tricks zu Performance und Wartbarkeit

Page 6: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Motivation

Vorhandene KnowledgeBase bereits seit 4 Jahren im EinsatzKeine Erweiterungsmöglichkeiten, da closed sourceHersteller hat keine Updates mehr herausgebrachtUns fehlte eine .NET 3.5 Referenzanwendung ;-)

Page 7: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Die Anwendung

KnowledgeBase für Artikel und FachbeiträgeLive im Einsatz auf VB-Magazin.deFeatures:

Artikel posten, bearbeitenBewerten, kommentierenWindows Live Writer AnbindungRSS & XML für alle BereicheWebService für externe Datenschnittstellen (Forum)

Page 8: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Technologien

100 % .NET 3.5100 % Visual Basic!Entwickelt unter Visual Studio 2008WebFrontendWindows Communication FoundationSchnittstelle für den Windows Live WriterMicrosoft SQL Server 2005 (auch kompatibel zu 2008)LINQ to SQL für Verbindung zur Datenbank

Page 9: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Architektur

Klassische 3-Schichten ArchitekturBestehend aus:

WebFrontendBusiness LogikDataAccess

Modularer aufbau

Page 10: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Sprachfeatures VB9

demo

Page 11: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

www.dnug-koeln.de www.justcommunity.de

Linq to Sql in der Praxis

Jan-Cornelius Molnar

Page 12: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Fazit

Linq ist super

Vielen Dank!!!

Page 13: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Agenda

Query ExecutionDataContextDisconnected Data (N-Tier ?)Query Compilation

Page 14: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Linq To Sql

DataContextSteuert DatenbankzugriffMappt Daten auf ObjekteSpeichert Änderungen

From x In dbx.ArticlesWhere x.IsPublished Take 5

Page 15: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Linq To SqlNameTitleGroup

demo

Page 16: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Linq Expressions

From x In dbx.ArticlesWhere x.IsPublished Take 5

Compiler

dbx.Articles.Where(Function(a As Article)

a.IsPublished ).Take(5)

Page 17: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Linq Expressions

Select

Where

Linq QueryProvider

dbx.Articles.Where(Function(a As Article)

a.IsPublished ).Take(5)

Take

Articles

Tags

&

Page 18: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Linq Expressions

SELECT TOP (5) * FROM [dbo].[Articles] WHERE [IsPublished] = 1

Select

Where

Take

Articles

Tags

&

Expression Visitor

Page 19: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Linq To SqlQuery Comprehension

demo

Page 20: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

DataContext Lifetime

Dispose wann immer möglichNötig für Ausführung von Queries

Dispose Kein Change-Tracking

Page 21: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

DataContext per Unit of work+ Transparent+ Threadsicher

- Nested Functions

Page 22: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Shared DataContext

+ Einfacher Zugriff+ Nested Functions

- Nicht transparent- Änderungen verwerfen?- Nicht threadsicher

Page 23: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Ambient DataContext

+ Mehr Transparenz+ Nested Functions+ Threadsicher

- Dispose?- Änderungen bei mehreren

Operationen

Page 24: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

DataContext per BusinessObject+ Transparent+ Threadsicher+ Änderungen pro Instanz

? Nested Functions

Page 25: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Disconnected Data

ASP.NET, WCF, …DataContext = Connected Object

Problem:Update mit „alten“ Daten

Page 26: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Disconnected Data

demo

Page 27: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Query Compilation

dbx.Articles.Where( … ) …

Expression Tree

Sql

Page 28: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Query Compilation

demo

Page 29: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Query Compilation

Spart bis zu 30% der Ausführungszeit

Gewinnt immer

Page 30: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Summary

Gutes R.A.D. Tool

“Problemzonen”DataContext LifeTimeDisconnected ObjectsQuery Compilation

Page 31: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Q&A

Page 32: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

www.dnug-koeln.de

www.justcommunity.de

Page 33: Softwaresponsoren Mediasponsoren. Vorstellung KnowledgeCenter Neue Sprachfeautres in VB 9.0 LINQ to SQL in der Praxis.

Sponsoren

Softwaresponsoren

Mediasponsoren