for sql anyyeewhere usus ging visual studio - sap · for sql anyyeewhere usus ging visual studio...
TRANSCRIPT
Developing ApplicationsDeveloping Applications for SQL Anywhere Using o SQ y e e Us gVisual Studio
Eric FarrarProduct Manager
AgendaAgenda
• SQL Anywhere and Visual StudioQ y
• Database Application Development• Desktop
• Web
• Mobile
• ADO.NET Entity Framework – Demonstration
Demonstration
y
• CLR External Environment – Demonstration
• MobiLink .NET Synchronization Logic – Demonstration
• Additional Resources
SQL Anywhere and Visual StudioSQL Anywhere and Visual Studio
• SQL Anywhere .NET Data ProviderQ y• .NET Framework 2.0 and 3.x
• .NET Compact Framework 2.0 and 3.5
SQL A h E l f Vi l St di• SQL Anywhere Explorer for Visual Studio• Visual Studio 2005 and 2008
• Desktop and Web (ASP.NET) applications
• Connect to SQL Anywhere and UltraLite databases
• Support for new features in VS 2008, including the Entity FrameworkFramework
SQL Anywhere ExplorerSQL Anywhere Explorer
• Visual Studio component to view connections from SQL Anywhere and UltraLite databases
• Launch Sybase Central and Interactive SQL• Drag & drop database objects onto code editor to• Drag & drop database objects onto code editor to automatically generate code
• Data connection → data connectionT bl d t d t• Table → data adapter
• View → data adapter• Stored procedure or function → command
h l f l ll b d h• SQL Anywhere Explorer functionality will be moved to the Server Explorer in future releases
SQL Anywhere Explorer – DemonstrationSQL Anywhere Explorer Demonstration
• Adding new connectionsg
• Drag & drop
• Configuring the SQL Anywhere Explorer
Database Application Development – DesktopDatabase Application Development Desktop
• Types of Database Applicationsyp pp• Client/Server
• Local database with sync
• Embedded database• Embedded database
• Database Interfaces• ADO.NET
• Entity Framework – new in VS 2008 SP1
• DeploymentD t b fil• Database file
• Database server binaries
• Client interface (ADO.NET Data Provider)
Desktop Database Application – DemonstrationDesktop Database Application Demonstration
Database Application Development – WebDatabase Application Development Web
• ASP.NET
• Login Credentials• SQL Anywhere support for ASP.NET providers (wizard)
• Implement new Membership Provider classp p
• Verify credentials from SQL Anywhere database
• Web Services• Produce and consume (handle SOAP requests)Produce and consume (handle SOAP requests)
• Deployment• Database file
• Database server binaries• Database server binaries
• Client interface (ADO.NET Data Provider)
• Make sure IIS can see all components
Web Database Application – DemonstrationWeb Database Application Demonstration
Desktop & Web Database Applications –p ppConsiderations• Add reference to iAnywhere.Data.SQLAnywhere.dlly Q y
• ADO.NET 2.0 or 3.x
• SQL Anywhere Explorer• Connect to database from Visual Studio
• Drag & drop into code editor (not form!)
• If you want to drag & drop onto form use Server ExplorerIf you want to drag & drop onto form, use Server Explorer
Database Application Development – MobileDatabase Application Development Mobile
• Windows Mobile• SQL Anywhere (ADO.NET)
• UltraLite (UltraLite.NET)
• Securityy• Device theft or loss
• Data interception
• SynchronizationSynchronization• Use MobiLink Synchronization Wizards
• Deployment• Database file• Database file
• Database server binaries
• Client interface (ADO.NET Data Provider) only if using SQL Anywhere
Mobile Database Application – DemonstrationMobile Database Application Demonstration
Mobile Database Applications – ConsiderationsMobile Database Applications Considerations
• References• SQL Anywhere → iAnywhere.Data.SQLAnywhere.dll
• UltraLite → iAnywhere.Data.UltraLite and iAnywhere Data UltraLite resourcesiAnywhere.Data.UltraLite.resources
• Ensure to use DLLs from correct folder (CE vs. Win32)
• SQL Anywhere Explorer for automatic code generation
• UltraLite• Must deploy runtime DLL
• Be careful when adding the UL database to Visual Studio project• Be careful when adding the UL database to Visual Studio project
• May break synchronization if constantly deploying same copy of udb
ADO.NET Entity Framework SupportADO.NET Entity Framework Support
• SQL Anywhere 11 supports ADO.NET Entity FrameworkQ y pp y
• Create entity models from SQL Anywhere data sources
• Access data using…• Control data bindingControl data binding
• EntityClient provider
• Object services
LINQ t titi• LINQ to entities
Entity Framework RequirementsEntity Framework Requirements
• Visual Studio 2008 SP1
• .NET Framework 3.5 SP1
• SQL Anywhere 11.0.0.1390 or greater
ADO.NET Entity Framework – DemonstrationADO.NET Entity Framework Demonstration
CLR External EnvironmentCLR External Environment
• New feature in SQL Anywhere 11
• Write stored procedures or functions in C# or VB.NET
• Execution takes place outside of the database server
• Support for NET Framework 2 0 3 0 and 3 5Support for .NET Framework 2.0, 3.0, and 3.5
• Example:
CREATE PROCEDURE clr_stored_proc( IN p1 INT, IN p2 UNSIGNED SMALLINT, OUT p3 LONG VARCHAR)
EXTERNAL NAME 'MyCLRTest.dll::MyCLRTest.Run( int, ushort, out string )'
LANGUAGE CLR;
CLR External Environment (cont.)CLR External Environment (cont.)
• Database server uses CLR executable: dbextclr11.exe
• CLR executable does not search GAC for assembly
• No need to execute INSTALL statement
• Benefits:• Leverage existing knowledge of NET programming languages• Leverage existing knowledge of .NET programming languages
• Re‐use existing libraries
• .NET language better suited than SQL for certain operations (e.g. string i l ti th t ti )manipulation, math computations)
CLR External Environment – DemonstrationCLR External Environment Demonstration
MobiLink .NET Synchronization LogicMobiLink .NET Synchronization Logic
• Write sync scripts in C# or VB.NET instead of SQLy p Q• MobiLink Server API
• .NET language may be more appropriate than SQL
• NET method returns string to MobiLink• .NET method returns string to MobiLink
• Handle authentication using .NET
• Debug .NET scripts in Visual Studio
• Direct row handling• Synchronize to non‐relational data sources
• Data source must have unique primary keysData source must have unique primary keys
• Portability across different RDBMS types
MobiLink .NET Sync Logic – DemonstrationMobiLink .NET Sync Logic Demonstration
SummarySummary
• SQL Anywhere has supported .NET since this technology was Q y pp gyintroduced in 2002
SQL A h 11 ti t t NET d t• SQL Anywhere 11 continues to support new .NET data access APIs, such as the ADO.NET Entity Framework
• Developers can take advantage of .NET capabilities when creating stored procedures and functions
Additional ResourcesAdditional Resources
• Sybase.com/ianywherey / y• Sample .NET code
• Whitepapers and tutorials about ADO.NET and the Entity Framework
• DOTNET developer center• DOT.NET developer center
• Product documentation• Lots of samples
• Available online with user comments
Questions?Questions?
Thank you!Thank you!