1 / 71

Neue Mobilität

Neue Mobilität. .NET Compact Framework 2.0 & SQL Server 2005 Mobile Edition. Frank Prengel Developer Evangelist Developer Platform & Strategy Group Microsoft Deutschland GmbH http://blogs.msdn.com/frankpr http://www.frankpr.de. Agenda. Intro .NET Compact Framework 1.0 + SQLCE 2.0

jerod
Télécharger la présentation

Neue Mobilität

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Neue Mobilität .NET Compact Framework 2.0 & SQL Server 2005 Mobile Edition Frank Prengel Developer Evangelist Developer Platform & Strategy Group Microsoft Deutschland GmbH http://blogs.msdn.com/frankpr http://www.frankpr.de

  2. Agenda • Intro • .NET Compact Framework 1.0 + SQLCE 2.0 • Was geht? • Was geht nicht? • Workarounds • .NET Compact Framework 2.0 + SQL Mobile • Was ist neu? • Future Windows Mobile • Managed APIs

  3. Sie können gewinnen!

  4. Intro Windows Mobile? Smartphone? Second Edition? Windows CE? Pocket PC? Phone Edition?

  5. UI HtmlControls WebControls .NET Compact Framework 1.0 System.Web System.WinForms Services Design ComponentModel Description Discovery System.Drawing Protocols Caching Security Drawing2D Printing Text Configuration SessionState Imaging System.Data System.Xml ADO.NET SqlClient XmlDocument Serialization Reader/Writers Design SqlServerCe Xslt/XPath System Collections IO Configuration commonlanguageruntime Security Net ServiceProcess InteropServices Text Reflection Diagnostics Remoting Serialization Globalization Resources Threading nichtunterstützt verfügbar

  6. Entwicklung mit dem CF Webservices Visual Studio.NET SOAP Smart Device Extensions Code .NET Compact Framework"Desktop-Version" .NET CompactFramework Device OS Windows Endgerät Entwicklermaschine

  7. Unterstützte APIs • Common Base Classes • IO, Collections, Reflection, math. Funktionen, Zeichnen, Text • Connectivity • Networking, HTTP-Klassen, Aufrufen von Web Services • Datenzugriff • ADO.NET, SQL Server CE, SQL Server • XML • XmlDocument, XmlReader/Writer • Windows Forms • Custom Controls

  8. PPC SP CF 2.0 Desktop Vergleich der Versionen

  9. P/Invoke • Win32-Aufrufe als Ersatz für fehlende Funktionalität • Beschränkungen: • Pass by value: nur Typen <= 32 Bit (auch Structs!) • Pass by value: keine Floats • kein explizites Struct-Layout (nur "Sequential") • keine Strings oder Arrays in Structs • keine Funktionszeiger •  keine Callbacks • kein DateTime • kein MarshalAs-Attribut

  10. Pocket PC & Smartphone • "out of the box" in VS.NET 2003: Pocket PC 2002 • DLLs, Emulator • kein Smartphone 2002! • CF-Unterstützung zur .NET-Programmierung: • Pocket PC 2003 SDK • Emulatoren • Smartphone 2003 SDK • DLLs, Emulatoren

  11. demo Smartphone Games Lutz Roeder's Digger

  12. Was fehlt? • Wichtige Controls & UI-Features • User Controls • Visual Inheritance • Security :-( • Code Access Security • Kryptographie • Typisierte DataSets • Vorsicht bei Verwendung von Webservices • Komfortable Tools für Daten & SQLCE • WSE, Application Building Blocks, ...

  13. Was fehlt noch? • ASP.NET • COM Interop • XSLT, XPath • Remoting • Serialisierung (SOAP, binary) • Install-time JIT (nGen) • Managed POOM, Telephonie etc.

  14. “Inherited does not mean supported.” – Seth Demsey, .NET Compact Framework Team, Microsoft Corporation ... oder: Warum bleibt mein Button grau?

  15. Was tun?

  16. Tip: OpenNETCF

  17. demo PocketRK Web ServicesCOM Interop & Inking mit CFCOM Visual Inheritance "Light"

  18. SQL Server CE 2.0 • kompakte relationale Datenbank (< 2 MB) • SQL-Syntax (kompat. mit SQL Server 2000) • hohe Performance durch Query Optimizer • unterstützt Replikation & Synchronisation • 128-Bit-Verschlüsselung der DB • Zugriff per ADO.NET, ADOCE, OLEDBCE • unterstützt Transaktionen • Mgmt. Tool (ISQLW) auf dem Gerät

  19. SQLCE & ADO.NET • Zugriff vom CF • System.Data.SqlServerCe • SqlCeEngine, SqlCeConnection, SqlCeCommand, ... • SqlCeDataReader, SqlCeDataAdapter • Referenzieren von SqlServerCe  Deployment von SQLCE auf Gerät oder Emulator public void CreateDatabase() { if (!File.Exists(@”\My Documents\My Data.sdf”)) { string connStr = @“Data Source=\My Documents\My Data.sdf” ; SqlCeEngine engine = new SqlCeEngine(connStr); engine.CreateDatabase(); } }

  20. Datenabgleich (1) • muß Besonderheiten mobiler Anwendungen berücksichtigen • Firewalls • Netzwerk"aussetzer" • unauffällig im Hintergrund • zwei Möglichkeiten: • Remote Data Access (RDA) • Merge Replication

  21. Datenabgleich (2)Architektur Application SQL Server OLE DB Provider SQL CE Server Agent HTTP OLE DB SQL CE Client Agent OLE DB Internet Information Server (IIS) SQL CE Engine SQL 2000 Database Database

  22. Remote Data Access • lose Kopplung SQLCE  SQL Server • keine "Verbindung", sondern HTTP • Query-Resultate lokal gespeichert • Änderungen können zurückgeschrieben werden • Zugang im CF: SqlCeRemoteDataAccess • RDA Pull: lokale Tabelle aus Servertabelle oder Stored Procedure • RDA Push: lokale Änderungen zurück an den Server • Table Tracking muß eingeschaltet sein

  23. RDA Pull/Push public void RDAPull(){ SqlCeRemoteDataAccess rda = new SqlCeRemoteDataAccess(); string ServerOledbStr = “Provider=sqloledb; Data Source=dataserver;”+ “Initial Catalog=Pubs;User Id=sa;Password=;”; rda.LocalConnectionString = @”Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;” + @”Data Source=\My Documents\test.sdf”; rda.InternetURL = @“http://www.dataserver.com/sqlce/sscesa20.dll”; rda.InternetLogin = “MyDomain\someuser”; rda.InternetPassword = “HaRd2GuEsS!$*”; rda.Pull( “Authors”, “Select * from authors where state = ‘CA’”, ServerOledbStr, RdaTrackOption.TrackingOn); } public void RDAPush(){ SqlCeRemoteDataAccess rda = new SqlCeRemoteDataAccess(); string ServerOledbStr = “Provider=sqloledb; Data Source=dataserver;”+ “Initial Catalog=Pubs;User Id=sa;Password=;”; rda.LocalConnectionString = @”Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;” + @”Data Source=\My Documents\test.sdf”; rda.InternetURL = @“http://www.dataserver.com/sqlce/sscesa20.dll”; rda.InternetLogin = “MyDomain\someuser”; rda.InternetPassword = “HaRd2GuEsS!$*”; rda.Push( “Authors”, ServerOledbStr, RdaBatchOption.BatchingOn); }

  24. Merge Replication • Datensynchronisation SQLCE  SQL Server • über HTTP • SQLCE erhält Snapshot vom Server • Änderung auf beiden Seiten möglich • Abgleich beim nächsten Synchronisieren • anpaßbare Konfliktbehandlung • Server agiert als Subscription Publisher • zusätzliche Serverlast & Ressourcen! • Verwendung im CF: SqlCeReplication

  25. RDA oder Merge Replication? • RDA ist "kostengünstiger" • benutzen, wenn begrenzte Funktionalität ausreicht • Merge Replication bietet "Komplettlösung" • aber: belastet Server & Netzwerk mehr

  26. demo SQLCE & RDA Traffic

  27. Probleme mit SQLCE 2.0 • Single-User/-Proc DB • keine Mgmt.-Tools für den Desktop • keine Trigger, Stored Procedures • nur eine Subscription pro DB (Merge Repl.) • DB wächst unbegrenzt •  SqlCeEngine.Compact • DataReader oder DataSet • kein scrollable Cursor • keine Unterstützung für Smartphone

  28. Fazit CF 1.0 & SQLCE 2.0 • vertraute .NET-Entwicklung für mobile Geräte • RAD, Webanbindung, kompakte Datenbank • viele Wünsche offen, aber... • 3rd Party-Apps & Community-Unterstützung

  29. Literatur

  30. Tools, Infos & Programmefür Windows Mobile Entwickler • Machen Sie sich schlau im Windows Mobile Developer Center:Im Developer Center finden Sie relevante Informationen aus erster Hand: Entwicklungstools, Online Communities, Webcasts, Technische Artikel, Downloads und vieles mehr. • Werden Sie Mitglied im Windows Mobile Solutions Partner Programm:Hier erhalten Developer Unterstützung bei der Entwicklung und Vermarktung von Windows Mobile Lösungen. • Zertifizieren Sie Ihre Anwendung über Mobile2Marketund erhalten ein Qualitätssiegel für Ihre Windows Mobile basierten Anwendungen. http://www.microsoft.com/germany/ms/mobile/entwickler

  31. Neue Welten

  32. 2.0 Introducing...

  33. .NETCF 1.0 (ROM) .NETCF 2.0 Allgemeines • näher am "vollen" .NET Framework  • neue Klassen, Protokolle, Funktionalität • Kompatibilität mit Version 1.0 • SxS, <supportedRuntime …/> • Performance • neuer JIT-Compiler • besseres Stringhandling • Unterstützung der Whidbey-Features • Generics, partielle Klassen, Iteratoren, anonyme Methoden

  34. Windows.Forms • Visual Inheritance (!) • User Controls (!) • Bildschirmorientierung • Bildschirmauflösung • Clipboard • Control.DoubleClick  • Docking • Anchoring

  35. Neue Controls • DateTimePicker • MonthCalendar • DocumentList • LinkLabel • Notification Bubble • Help • WebBrowser • DataContainer • Splitter • RichInk

  36. demo CF WinForms 2.0 Neue Controls Neue Features

  37. P/Invoke - Neues • Strings & Arrays in Structs • Marshaling von Delegates als Funktionszeiger • Attribut MarshalAs • explizites Struct-Layout • Floats und DateTime • Typen > 32 Bit können by value übergeben werden

  38. Version 1.0 Version 2.0 Application Code Application Code Managed Wrapper Managed Call Managed Interfaces P/Invoke Native Wrapper .NET CF Interop Layer COM Call COM Call COM Object COM Object Your Code Generated COM Object COM Interop • Managed Wrapper wird generiert (VS oder TLBIMP.EXE) • Projekt verweist auf Wrapper • COM-Interfaces & -typen verwenden wie .NET-Typen

  39. CF: COM aus .NET aufrufen • Threads als MTA initialisiert • verantwortlich: System.Runtime.InteropServices • Marshal, MarshalAs • keine Unterstützung für Custom Marshaler • IDispatch-Einschränkungen • keine Structures (VT_RECORD) • keine Int64, UInt64 • kein automatisches ActiveX-Control-Hosting • Infrastruktur für eigene Wrapper vorhanden

  40. demo COM Interop POOM

  41. Netzwerk & Web Services • System.Messaging • Web Services • Performancesteigerung durch schnelleren XmlSerializer • Unterstützung für SOAP 1.2 • CredentialCache • verbesserte Authentifizierung • Kerberos & NTLM • IPv6

  42. Weiteres • System.IO.Ports  serieller Port • System.Security.Cryptography • (Triple)DES, MD5, SHA1, DSA, RSA, Rijndael, ... • X.509 • System.Xml • XPath 1.0 • Schemavalidierung • System.Drawing • Image.Save(...), custom pens

  43. Smartphone-Unterstützung • Daten • SQL Mobile • DataGrid • Textbox: Wechsel der Eingabeart (abc, 123, T9, ...)  InputModeEditor • linkes Menü unterstützt mehrere Menüpunkte

  44. Visual Studio 2005 • IDE für CF-Entwicklung ab Standard Edition • CF nicht von Express Edition unterstützt • native (C++) Device-Programmierung • Ersatz für eMbedded VC++ • MFC 8.0, ATL 8.0 (auch für Smartphone), STL, CRT • neue Forms-Designer • neuer Emulator • Sichern verschiedener Zustände

  45. Managed Server side Native ASP .NETMobile Controls MFC ATL .NET Compact Framework 2.0 Win32 Software Platform (APIs) Data Access Device Management Communication Presentation Multimedia Remote APIConfiguration*Bluetooth Security State & Notifi. * Pocket Watson Connection ManagerTAPI*SMS* MAPI* POOM* ActiveSync SQL CEADO CEXMLCE DBOLE DB Home ScreenUser Interface/ShellHTML ControlDOM GAPICameraD3DMLocation* Windows Mobile CE DBActiveSync SQL CE Pocket OutlookPocket Internet ExplorerWindows Media Player Windows CE Device Hardware Radio ProcessorMemory GSM/GPRSCDMA/1xRTT WiFiBluetooth DisplayUSB or Serial Windows Mobile Development Visual Studio 2005 Drivers * = Managed wrappers

  46. Mobile Edition Introducing...

  47. SQL Mobile • kommt mit SQL Server 2005 und VS 2005 • Integration in die SQL Workbench • gleiche Oberfläche wie SQL Server 2005 • Integration mit CF 2.0 • Unterstützung für • Pocket PC, PPC Phone Edition (ab WM2003) • Smartphone (ab WM2003) • Windows CE 5.0 (kein CE 4.x) • Win32 (Tablet PC, Deployment)

More Related