ADO.NET Training.ppt


Published on

1 Comment
  • IT Pathshala, Noida-Sector-63, offers Guaranteed JOB with .NET Training Programs.


    CALL US - +91-9871350999 or +91-8800394970

    Technology Centre Address: H-110, Sector-63, Noida (UP)

    Program Takeaways:

    - GUARANTEED JOB in your technology domain
    - Live Major Project development
    - Experience Letter on Training Completion
    - Certification on Training Completion
    - Project Source Code available in CD

    Program Highlights:

    - 100% Guaranteed Job – Don’t pay us if you don’t get a JOB!
    - Industry Ready Courses
    - LIVE International Project Experience
    - Exposure to corporate culture at our IT services facility
    - Networking & Interaction with Industry Experts
    - Training Provided by a reputed IT Company
    - Live Project Source Code made available in CD
    - Technology certification and experience letter at program completion
    - Online Study Content

    CALL US - +91-9871350999 or +91-8800394970

    Our website:
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

ADO.NET Training.ppt

  1. 1. Introduction to ADO.NET Accessing Notes/Domino data using Proposion N2N © Copyright 2004, Proposion, Inc. All rights reserved.
  2. 2. Introductions: Stephen Walch <ul><li>Microsoft technologies developer – 12 years </li></ul><ul><li>Notes developer - 11 years </li></ul><ul><li>Built 9 products </li></ul><ul><li>Presented at 2 Lotuspheres, 1 MEC, others </li></ul><ul><li>Proposion, Inc. </li></ul><ul><ul><li>Started January 2002 </li></ul></ul><ul><ul><li>Integrating Microsoft .NET with Notes and Domino </li></ul></ul>
  3. 3. Proposion Products (Q1 2005)
  4. 4. Agenda <ul><li>Basic principles of ADO.NET </li></ul><ul><li>Introduction to Proposion N2N </li></ul><ul><li>Programming with ADO.NET classes </li></ul><ul><li>Lab #1: Web Contact List </li></ul><ul><li>Programming with ADO.NET DataSets </li></ul><ul><li>Proposion N2N Specifics </li></ul><ul><li>Lab #2: Notes Data Integrator </li></ul>
  5. 5. ADO.NET Basic principles (1) <ul><li>All data providers implement the same set of standard interfaces: </li></ul><ul><ul><li>DataConnection </li></ul></ul><ul><ul><li>DataCommand </li></ul></ul><ul><ul><li>DataParameter </li></ul></ul><ul><ul><li>DataReader </li></ul></ul><ul><ul><li>DataAdapter </li></ul></ul>
  6. 6. ADO.NET Basic principles (2) <ul><li>Microsoft ships some data providers: </li></ul><ul><ul><li>SQL Server </li></ul></ul><ul><ul><li>Oracle </li></ul></ul><ul><ul><li>OleDb </li></ul></ul><ul><ul><li>ODBC </li></ul></ul><ul><li>But third parties can implement their own: </li></ul><ul><ul><li>IBM (for DB2) </li></ul></ul><ul><ul><li>Proposion N2N (for Notes/Domino) </li></ul></ul>
  7. 7. Basic principles (3) <ul><li>ADO.NET includes common classes for representing in-memory data: </li></ul><ul><ul><li>DataSet, DataTable, DataView </li></ul></ul><ul><li>May include schema and constraints </li></ul><ul><li>Designed to work with .NET XML classes </li></ul><ul><li>Great for caching or transporting data </li></ul><ul><li>Able to track state changes </li></ul><ul><li>Typed DataSets may be auto-generated </li></ul>
  8. 8. Basic principles (4) <ul><li>Data binding allows DataSets (etc.) to be “plugged in” to user interface components </li></ul><ul><ul><li>Data grids, List boxes, Text boxes </li></ul></ul><ul><ul><li>Third-party components (charts, etc.) </li></ul></ul><ul><ul><li>Windows, Web, Mobile </li></ul></ul><ul><li>Support for development tools part of the plumbing </li></ul><ul><ul><li>Visual Studio.NET, etc. </li></ul></ul>
  9. 9. Example: Basic SQL Server query
  10. 10. So what about Notes/Domino? <ul><li>NSF databases are loosely structured collections of documents/objects (“notes”) </li></ul><ul><li>Notes have named data elements (“items”) </li></ul><ul><ul><li>Usually typed (text, number, date) </li></ul></ul><ul><ul><li>Can be multi-valued or binary (attachments) </li></ul></ul><ul><ul><li>Rich text and MIME </li></ul></ul><ul><li>Notes can be linked in as parent/child </li></ul><ul><li>Views & Folders select and index notes </li></ul>
  11. 11. More “weird” Notes stuff <ul><li>No schema or guarantee of data consistency! </li></ul><ul><li>Forms allow entry/display of notes </li></ul><ul><li>Agents and actions </li></ul><ul><li>Full-text search </li></ul><ul><li>Security </li></ul><ul><ul><li>Database ACLs, roles, groups, encryption </li></ul></ul><ul><ul><li>Per-note reader and author restrictions </li></ul></ul>
  12. 12. Introducing…
  13. 13. About Proposion N2N <ul><li>Data driver for connecting to Lotus Notes/Domino data and services </li></ul><ul><li>Managed ADO.NET data provider </li></ul><ul><ul><li>Use any .NET language </li></ul></ul><ul><ul><li>Plug into ADO.NET components </li></ul></ul><ul><ul><li>Leverage data binding </li></ul></ul><ul><li>Direct access to Notes core interfaces </li></ul><ul><ul><li>Managed C++ and Notes C API </li></ul></ul><ul><ul><li>Extremely fast and robust </li></ul></ul>
  14. 14. Proposion N2N features <ul><li>Read/write/delete/mail documents </li></ul><ul><li>Navigate views/folders, Use full-text search </li></ul><ul><li>Use Forms to select data or validate inputs </li></ul><ul><li>Access Rich text, Attachments, Images </li></ul><ul><li>Run LotusScript agents, Use @Formulas </li></ul><ul><li>Unread marks, parent/response hierarchies </li></ul><ul><li>Access to design information </li></ul>
  15. 15. Alternatives <ul><li>COM interfaces and .NET COM Interop </li></ul><ul><ul><li>Familiar to LotusScript developers </li></ul></ul><ul><ul><li>Good option for Windows apps </li></ul></ul><ul><ul><li>Not good for robust, scaleable, multi-threaded web apps or web services </li></ul></ul><ul><li>NotesSQL data driver and ODBC data provider </li></ul><ul><ul><li>Slow and buggy </li></ul></ul><ul><ul><li>Feature poor </li></ul></ul><ul><li>Notes C API and PInvoke </li></ul><ul><li>Web Services </li></ul>
  16. 16. Agenda <ul><li>Basic principles of ADO.NET </li></ul><ul><li>Introduction to Proposion N2N </li></ul><ul><li>Programming with ADO.NET classes </li></ul><ul><li>Lab #1: Web Contact List </li></ul><ul><li>Programming with ADO.NET DataSets </li></ul><ul><li>Proposion N2N Specifics </li></ul><ul><li>Lab #2: Notes Data Integrator </li></ul>
  17. 17. ADO.NET Data Connection <ul><li>Represents an open connection to a data source </li></ul><ul><li>IDbConnection -> NsfConnection </li></ul><ul><li>Properties </li></ul><ul><ul><li>ConnectionString </li></ul></ul><ul><li>Methods </li></ul><ul><ul><li>Open() </li></ul></ul><ul><ul><li>Close() </li></ul></ul><ul><ul><li>BeginTransaction() * </li></ul></ul>
  18. 18. ADO.NET Data Command <ul><li>Represents a command statement that is executed while connected to a data source </li></ul><ul><li>IDbCommand -> NsfCommand </li></ul><ul><li>Properties </li></ul><ul><ul><li>Connection </li></ul></ul><ul><ul><li>CommandType, CommandText </li></ul></ul><ul><ul><li>Parameters </li></ul></ul><ul><li>Methods </li></ul><ul><ul><li>ExecuteNonQuery() </li></ul></ul><ul><ul><li>ExecuteReader() </li></ul></ul>
  19. 19. ADO.NET Data Reader <ul><li>Provides a means of reading a forward-only stream of results from a command </li></ul><ul><li>IDataReader, IDataRecord -> NsfDataReader </li></ul><ul><li>Properties </li></ul><ul><ul><li>FieldCount </li></ul></ul><ul><ul><li>Item[“name”], Item[index] </li></ul></ul><ul><li>Methods </li></ul><ul><ul><li>Read() </li></ul></ul><ul><ul><li>GetName(index) </li></ul></ul><ul><ul><li>GetValue(index), GetString(index)… </li></ul></ul><ul><ul><li>GetEnumerator() </li></ul></ul>
  20. 20. Sample: Query with Data Reader <ul><li>Create a connection </li></ul><ul><li>Create an SELECT command </li></ul><ul><li>Navigate the data </li></ul><ul><li>Create an INSERT command </li></ul><ul><li>Also: </li></ul><ul><ul><li>Try/Finally, Using </li></ul></ul><ul><ul><li>Using visual data components </li></ul></ul>
  21. 21. Building a Data Access Layer <ul><li>Best practice to separate raw data access from application logic </li></ul><ul><li>Encapsulate use of ADO.NET classes </li></ul><ul><li>Results in reusable classes that can be called from multiple applications </li></ul><ul><li>Optional: Encapsulate all business rules </li></ul><ul><li>Optional: Design to be remotable via COM+, XML Web Services, or .NET Remoting </li></ul>
  22. 22. Sample: Data Access Layers <ul><li>Create a new data access component </li></ul><ul><li>Implement data access method </li></ul><ul><li>Use the component in a Web Service </li></ul>
  23. 23. LAB #1: Web Contact List <ul><li>Create ASP.NET project </li></ul><ul><li>Add reference to Proposion N2N </li></ul><ul><li>Populate a data grid from Notes </li></ul><ul><li>Post a web form </li></ul><ul><li>Send an email </li></ul>
  24. 24. Agenda <ul><li>Basic principles of ADO.NET </li></ul><ul><li>Introduction to Proposion N2N </li></ul><ul><li>Programming with ADO.NET classes </li></ul><ul><li>Lab #1: Web Contact List </li></ul><ul><li>Programming with ADO.NET DataSets </li></ul><ul><li>Proposion N2N Specifics </li></ul><ul><li>Lab #2: Notes Data Integrator </li></ul>
  25. 25. ADO.NET DataSet <ul><li>Represents an in-memory cache of data. </li></ul><ul><li>A class, not an interface! </li></ul><ul><li>Properties </li></ul><ul><ul><li>DataSetName </li></ul></ul><ul><ul><li>Tables //Data and schema </li></ul></ul><ul><ul><li>Relations </li></ul></ul><ul><li>Methods </li></ul><ul><ul><li>Clear(), Copy(), Merge() </li></ul></ul><ul><ul><li>GetChanges(), AcceptChanges(), RejectChanges() </li></ul></ul><ul><ul><li>ReadXml(), WriteXml() </li></ul></ul>
  26. 26. ADO.NET DataTable <ul><li>Properties </li></ul><ul><ul><li>TableName </li></ul></ul><ul><ul><li>Columns //DataColumn </li></ul></ul><ul><ul><li>Constraints //Constraint </li></ul></ul><ul><ul><li>Rows //DataRow </li></ul></ul><ul><ul><li>DefaultView //DataView </li></ul></ul><ul><ul><li>ParentRelations, ChildRelations </li></ul></ul><ul><li>Methods </li></ul><ul><ul><li>NewRow(), ImportRow() </li></ul></ul><ul><ul><li>Select(“expression”), Compute(“expression”) </li></ul></ul>
  27. 27. ADO.NET Data Adapter <ul><li>Represents a set of methods and mappings to read/write a DataSet from/to a data source </li></ul><ul><li>IDbDataAdapter -> NsfDataAdapter </li></ul><ul><li>Properties </li></ul><ul><ul><li>SelectCommand, InsertCommand </li></ul></ul><ul><ul><li>UpdateCommand, DeleteCommand </li></ul></ul><ul><ul><li>TableMappings </li></ul></ul><ul><li>Methods </li></ul><ul><ul><li>Fill(DataSet) </li></ul></ul><ul><ul><li>Update(DataSet) </li></ul></ul>
  28. 28. Sample: Data Adapters <ul><li>Configure a DataAdapter </li></ul><ul><li>Fill a DataSet </li></ul><ul><li>Navigate a DataSet </li></ul><ul><li>Bind to a DataGrid </li></ul><ul><li>Using visual tools to create an adapter </li></ul><ul><ul><li>Dealing with the fact that Notes database do not have schema! </li></ul></ul><ul><li>Read/Write data </li></ul>
  29. 29. Schemas and Typed DataSets <ul><li>DataSets can have schemas </li></ul><ul><ul><li>Data types, constraints, relations </li></ul></ul><ul><ul><li>Rules are enforced when loading data </li></ul></ul><ul><li>Typed DataSets can be generated </li></ul><ul><ul><li>Classes derived from DataSet </li></ul></ul><ul><ul><li>Schema information compiled in </li></ul></ul><ul><ul><li>Adds type-safe properties and methods </li></ul></ul><ul><ul><li>Based on XSD standard </li></ul></ul><ul><li>Tools can use schema at design time </li></ul>
  30. 30. Sample: Schemas and Typed DataSets <ul><li>Generating schema and Typed DataSet </li></ul><ul><li>Using a Typed DataSet in your code </li></ul><ul><li>Binding to Typed DataSets </li></ul>
  31. 31. Agenda <ul><li>Basic principles of ADO.NET </li></ul><ul><li>Introduction to Proposion N2N </li></ul><ul><li>Programming with ADO.NET classes </li></ul><ul><li>Lab #1: Web Contact List </li></ul><ul><li>Programming with ADO.NET DataSets </li></ul><ul><li>Proposion N2N Specifics </li></ul><ul><li>Lab #2: Notes Data Integrator </li></ul>
  32. 32. N2N: Selecting columns (1) <ul><li>Basic: </li></ul><ul><ul><li>SELECT “item1”, ITEM(“item2”), ITEM(“item3”) AS “name3” </li></ul></ul><ul><li>Strong typing: </li></ul><ul><ul><li>SELECT ITEM(“item1”, STRING), ITEM(“item2”, DATE) … </li></ul></ul><ul><li>View/Folder Columns: </li></ul><ul><ul><li>SELECT COLUMN(“name”), COLUMN(0, STRING)… </li></ul></ul><ul><li>Multi-valued items: </li></ul><ul><ul><li>Select ITEM(“item1”, STRING, MULTI), ITEM(“item2”, FLAT) … </li></ul></ul><ul><li>Notes identifiers </li></ul><ul><ul><li>SELECT NOTEID(), UNID(), ISREAD() … </li></ul></ul>
  33. 33. N2N: Selecting columns (2) <ul><li>Parent documents: </li></ul><ul><ul><li>SELECT PARENTNOTEID(), PARENTUNID(), PARENTITEM(“item1”) </li></ul></ul><ul><li>Formulas </li></ul><ul><ul><li>SELECT FORMULA(“@Created”), PARENTFORMULA(“@Created”)… </li></ul></ul><ul><li>Rich Text: </li></ul><ul><ul><li>SELECT RICHTEXT(“body”), RICHTEXT(“body”, XML), RICHTEXT(“body”, MIME)… </li></ul></ul><ul><li>Render with form: </li></ul><ul><ul><li>SELECT RENDER(“form1”, XML) </li></ul></ul><ul><li>Attachments: </li></ul><ul><ul><li>SELECT ATTACHMENT(“body”, 0), ATTACHMENTID(“body”, 0), ATTACHMENTNAME(“body”, 0)… </li></ul></ul><ul><li>Images: </li></ul><ul><ul><li>SELECT IMAGE(“body”, 0), IMAGETYPE(“body”, 0) </li></ul></ul>
  34. 34. N2N: Selecting rows <ul><li>Use a View/Folder index: </li></ul><ul><ul><li>SELECT … FROM “view” </li></ul></ul><ul><li>Lookups: </li></ul><ul><ul><li>SELECT … FROM “view” WHERE KEY(“value”) </li></ul></ul><ul><ul><li>SELECT … FROM “view” WHERE BEGIN(“val1”) AND END(“val2”) </li></ul></ul><ul><li>Lookup by ID </li></ul><ul><ul><li>SELECT … WHERE NOTEID(1234) </li></ul></ul><ul><ul><li>SELECT … WHERE UNID(“0ae462f6663…”) </li></ul></ul><ul><li>Full-Text Search: </li></ul><ul><ul><li>SELECT … WHERE SEARCH(“expression”, FUZZY, VARIANTS) </li></ul></ul><ul><li>Dynamic Selection Formula </li></ul><ul><ul><li>SELECT … WHERE FORMULA(“@DocumentLength > 100”) </li></ul></ul><ul><li>Paging </li></ul><ul><ul><li>SELECT … SKIP 100 LIMIT 10 </li></ul></ul><ul><li>Unread documents </li></ul><ul><ul><li>SELECT … UNREADONLY </li></ul></ul>
  35. 35. N2N: Updating data <ul><li>Basic update: </li></ul><ul><ul><li>UPDATE FROM “view1” SET item1=“value”, item2=@param2, item3+=“value”, item4=“value”/ENCRYPT WHERE KEY(@param4) </li></ul></ul><ul><li>Form validation </li></ul><ul><ul><li>UPDATE … VALIDATE </li></ul></ul><ul><li>Unread marks </li></ul><ul><ul><li>UPDATE … MARKREAD </li></ul></ul><ul><li>Response documents </li></ul><ul><ul><li>UPDATE … MAKERESPONSE(5678) </li></ul></ul><ul><li>Insert </li></ul><ul><ul><li>INSERT INTO “form1” SET “item1”=value1… </li></ul></ul><ul><ul><li>INSERT … RETURN NOTEID() </li></ul></ul>
  36. 36. N2N: Updating data (2) <ul><li>Email </li></ul><ul><ul><li>INSERT INTO “Memo” SET SendTo=&quot;Stephen Walch&quot;, Subject=&quot;Product“… SEND </li></ul></ul><ul><ul><li>UPDATE … SENDONLY </li></ul></ul><ul><li>Delete </li></ul><ul><ul><li>DELETE FROM “Discussion” WHERE SEARCH(“VIM”) </li></ul></ul><ul><li>Run an agent: </li></ul><ul><ul><li>AGENT “agent1” </li></ul></ul><ul><ul><li>AGENT “agent1” SET input=“value” RETURN output </li></ul></ul>
  37. 37. N2N: Security issues <ul><li>By default, N2N uses credentials using local Notes ID file </li></ul><ul><li>N2N allows .NET apps to validate Domino names and passwords </li></ul><ul><li>N2N allows .NET apps to impersonate other users (requires R6 if remote) </li></ul><ul><li>N2N allows .NET apps to create/validate Domino Sign-On (LTPA) Tokens </li></ul>
  38. 38. LAB #2: Notes Data Integrator <ul><li>Create .NET Windows Forms project </li></ul><ul><li>Using Windows Grid and Tab controls </li></ul><ul><li>Visually creating DataAdapters for Notes and SQL Server </li></ul><ul><li>Typed DataSets </li></ul><ul><li>Implementing data transfer routines </li></ul>
  39. 39. For more information <ul><li>Ask Steve </li></ul><ul><ul><li>[email_address] </li></ul></ul><ul><li>.NET development </li></ul><ul><ul><li> </li></ul></ul><ul><ul><li>Visual Studio.NET Help </li></ul></ul><ul><li>Proposion N2N </li></ul><ul><ul><li>Proposion web site </li></ul></ul>