for sql anyyeewhere usus ging visual studio - sap · for sql anyyeewhere usus ging visual studio...

24
Developing Applications Developing Applications f or SQL An ywher e Using Visual Studio Eric Farrar Product Manager

Upload: others

Post on 18-Mar-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

Developing ApplicationsDeveloping Applications for SQL Anywhere Using o SQ y e e Us gVisual Studio

Eric FarrarProduct Manager

Page 2: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

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

Page 3: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

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

Page 4: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

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

Page 5: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

SQL Anywhere Explorer – DemonstrationSQL Anywhere Explorer  Demonstration

• Adding new connectionsg

• Drag & drop

• Configuring the SQL Anywhere Explorer

Page 6: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

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)

Page 7: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

Desktop Database Application – DemonstrationDesktop Database Application  Demonstration

Page 8: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

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

Page 9: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

Web Database Application – DemonstrationWeb Database Application  Demonstration

Page 10: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

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

Page 11: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

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

Page 12: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

Mobile Database Application – DemonstrationMobile Database Application  Demonstration

Page 13: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

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

Page 14: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

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

Page 15: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

Entity Framework RequirementsEntity Framework Requirements

• Visual Studio 2008 SP1

• .NET Framework 3.5 SP1

• SQL Anywhere 11.0.0.1390 or greater

Page 16: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

ADO.NET Entity Framework – DemonstrationADO.NET Entity Framework  Demonstration

Page 17: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

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;

Page 18: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

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)

Page 19: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

CLR External Environment – DemonstrationCLR External Environment  Demonstration

Page 20: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

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

Page 21: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

MobiLink .NET Sync Logic – DemonstrationMobiLink .NET Sync Logic  Demonstration

Page 22: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

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

Page 23: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

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

Page 24: for SQL Anyyeewhere UsUs ging Visual Studio - SAP · for SQL Anyyeewhere UsUs ging Visual Studio Eric Farrar Product Manager. Agenda ... • If you want to drag & drop onto form,

Questions?Questions?

Thank you!Thank you!