Table Storage. Access Table storage Add the following namespace declarations to the top of any C# file in which you wish to programmatically access Windows.

Slides:



Advertisements
Similar presentations
Store RDF Triples In A Scalable Way Liu Long & Liu Chunqiu.
Advertisements

A Guide to SQL, Seventh Edition. Objectives Create a new table from an existing table Change data using the UPDATE command Add new data using the INSERT.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Blob Storage. What is Blob Storage Windows Azure Blob storage is a service for storing large amounts of unstructured data that can be accessed from anywhere.
Chapter 14: Advanced Topics: DBMS, SQL, and ASP.NET
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Confidential ODBC May 7, Features What is ODBC? Why Create an ODBC Driver for Rochade? How do we Expose Rochade as Relational Transformation.
Stored Procedures Dr. Ralph D. Westfall May, 2009.
Advanced Tables Lesson 9. Objectives Creating a Custom Table When a table template doesn’t suit your needs, you can create a custom table in Design view.
CSCI 6962: Server-side Design and Programming
Module 3: Table Selection
Databases and LINQ Visual Basic 2010 How to Program 1.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
Introduction to SQL Steve Perry
Data File Access API : Under the Hood Simon Horwith CTO Etrilogy Ltd.
PHP meets MySQL.
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
UNIT 9.2: Learning Objectives Agile Development – Bruce Feiler on Agile Programming Database access from code – Database Cycle Review – SQL Command Types.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
PHP MySQL Introduction. MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
(Chapter 10 continued) Our examples feature MySQL as the database engine. It's open source and free. It's fully featured. And it's platform independent.
Microsoft Access You will need a pen/pencil.. What is Microsoft Access? Access is a database management system.  Create a database, add/change delete.
Presentation. Recap A multi layer architecture powered by Spring Framework, ExtJS, Spring Security and Hibernate. Taken advantage of Spring’s multi layer.
Natural vs. Generated Keys. Definitions Natural key—a key that occurs in the data, that uniquely identifies rows. AKA candidate key. Generated key—a key.
Chapter 9 Selecting, Updating, and Deleting Data Syed Rizvi.
Objectives In this lesson, you will learn to: *Identify the need for ADO.NET *Identify the features of ADO.NET *Identify the components of the ADO.NET.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
Christopher M. Pascucci.NET Programming: Databases & ADO.NET.
Chapter 2 Views. Objectives ◦ Create simple and complex views ◦ Creating a view with a check constraint ◦ Retrieve data from views ◦ Data manipulation.
Microsoft Access. Microsoft access is a database programs that allows you to store retrieve, analyze and print information. Companies use databases for.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
IBS 520 Introduction to Internet Technology Database Fundamentals Week 4.
.  A multi layer architecture powered by Spring Framework, ExtJS, Spring Security and Hibernate.  Taken advantage of Spring’s multi layer injection.
C# Classes and Inheritance CNS 3260 C#.NET Software Development.
Objectives Database triggers and syntax
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 9 Database Triggers.
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC PROGRAMMING FUNDAMENTALS Bilal Munir Mughal 1 Chapter-8.
SQL ACTION QUERIES AND TRANSACTION CONTROL CS 260 Database Systems.
Normalizing Database Files Professor Ralph Westfall May, 2011.
PL/SQLPL/SQL Oracle11g: PL/SQL Programming Chapter 9 Database Triggers.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 9 Database Triggers.
HNDIT Rapid Application Development
Session 1 Module 1: Introduction to Data Integrity
Visual Basic for Application - Microsoft Access 2003 Finishing the application.
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
Architecture Multi Layered Architecture (n-tier): Application: Model Controllers Database Access Graphical User Interface (GUI): Forms, components, controls.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
IMS 4212: Constraints & Triggers 1 Dr. Lawrence West, Management Dept., University of Central Florida Stored Procedures in SQL Server.
A Guide to MySQL 6. 2 Objectives Create a new table from an existing table Change data using the UPDATE command Add new data using the INSERT command.
Retele de senzori Curs 2 - 1st edition UNIVERSITATEA „ TRANSILVANIA ” DIN BRAŞOV FACULTATEA DE INGINERIE ELECTRICĂ ŞI ŞTIINŢA CALCULATOARELOR.
Entity Framework Database Connection with ASP Notes from started/getting-started-with-ef-using-mvc/creating-an-
SQL Basics Review Reviewing what we’ve learned so far…….
Data in Windows 10 UWP Andy Wigley XML, JSON, SQLite or EF Core ?
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
 ADO.NET is an object-oriented set of libraries that allows you to interact with data sources  Commonly, the data source is a database, but it could.
SQL IMPLEMENTATION & ADMINISTRATION Indexing & Views.
ASP.NET Programming with C# and SQL Server First Edition
Data Virtualization Demoette… Packaged Query Single Select Option
SQL – Application Persistence Design Patterns
Windows Azure Storage Queue Storage.
Teaching slides Chapter 8.
Developing a Model-View-Controller Component for Joomla Part 3
Azure Table Storage Ivan.
Oracle9i Developer: PL/SQL Programming Chapter 8 Database Triggers.
SQL – Application Persistence Design Patterns
M S COLLEGE OF ART’S, COMM., SCI. & BMS Advance Web Programming
Presentation transcript:

Table Storage

Access Table storage Add the following namespace declarations to the top of any C# file in which you wish to programmatically access Windows Azure Storage: using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Auth; using Microsoft.WindowsAzure.Storage.Table; Microsoft.WindowsAzure.Storage.dll assembly is to be added.

Access Table storage Retrieving your connection string use the CloudConfigurationManager type to retrieve your storage connection string and storage account information from the Windows Azure service configuration: CloudStorageAccount storageAccount = CloudStorageAccount.Parse( CloudConfigurationManager.GetSetting("S torageConnectionString"));

Access Table storage A CloudTableClient type allows you to retrieve objects that represent tables stored within the Table Storage Service. The following code creates a CloudTableClient object using the storage account object we retrieved above: CloudTableClient tableClient = storageAccount.CreateCloudTableClient() ;

Access Table storage Create a Table use a CloudTableClient object to get a reference to the Table you want to use. You can create the Table if it doesn't exist:

Access Table storage Create a Table... // Retrieve a reference to a Table. CloudTable table=tableClient.GetTableReference(“co ntacts"); // Create the table if it doesn‘t alreadyexist. table.CreateIfNotExists();

Access Table storage Entities map to C# objects using a custom class derived from TableEntity. To add an entity to a table, create a class that defines the properties of the entity. For any property that should be stored in the table service, the property must be a public property of a supported type that exposes both get and set. Also, the entity type must expose a parameter-less constructor.

Access Table storage Entities with the same partition key can be queried faster than those with different partition keys, but using diverse partition keys allows for greater parallel operation scalability. The following code defines an entity class that uses the contact type as the row key and phone number as the partition key. Together, an entity's partition and row key uniquely identify the entity in the table.

Access Table storage public class ContactEntity : TableEntity { public ContactEntity(string contactType string lastName, string firstName,int contactNo) { this.PartitionKey = contactTYpe; this.RowKey = contactNo; this.firstName=firstName; this.lastName=lastName; } public ContactEntity() { } public string lastName{get;set;} public string firstName{get;set;} }

Access Table storage To create an entity // Create a new contact entity. ContactEntity contact1 = new ContactEntity(“friends”,"Harp“,"Walter“, );

Access Table storage To create an entity // Create the TableOperation that inserts the contact entity. TableOperation insertOperation = TableOperation.Insert(contact1); // Execute the insert operation. table.Execute(insertOperation);

Access Table storage To retrieve an entity from a table use a a TableQuery object. TableQuery query = new TableQuery ().Where(Table Query.GenerateFilterCondition("Partitio nKey", QueryComparisons.Equal, “friends"));

Access Table storage To retrieve an entity from a table use a a TableQuery object. foreach (ContactEntity entity in table.ExecuteQuery(query)) { Console.WriteLine("{0}, {1}\t{2}\t{3}", entity.PartitionKey, entity.RowKey, entity.firstName, entity.lastName); }

Access Table storage Replace an entity To update an entity, retrieve it from the table service, modify the entity object, and then save the changes back to the table service. The following code changes an existing contact's phone number. Instead of calling Insert, this code uses Replace. This causes the entity to be fully replaced on the server, unless the entity on the server has changed since it was retrieved, in which case the operation will fail.

Access Table storage Replace an entity This failure is to prevent your application from inadvertently overwriting a change made between the retrieval and update by another component of your application. The proper handling of this failure is to retrieve the entity again, make your changes (if still valid), and then perform another Replace operation.

Access Table storage Replace an entity // Create a retrieve operation that takes a customer entity. TableOperation retrieveOperation = TableOperation.Retrieve ( “ ", “ "); // Execute the operation. TableResult retrievedResult = table.Execute(retrieveOperation);

Access Table storage Replace an entity // Assign the result to a CustomerEntity object. ContactEntity updateEntity = (ContactEntity)retrievedResult.Result;

Access Table storage Replace an entity if (updateEntity != null) { // Change the phone number. updateEntity.RowKey = ; // Create the Replace TableOperation TableOperation updateOperation = TableOperation.Replace(updateEntity); // Execute the operation. table.Execute(updateOperation); Console.WriteLine("Entity updated."); } else Console.WriteLine("Entity could not be retrieved.");

Access Table storage Insert-or-replace an entity Replace operations will fail if the entity has been changed since it was retrieved from the server. Furthermore, you must retrieve the entity from the server first in order for the Replace to be successful. Sometimes, however, you don't know if the entity exists on the server and the current values stored in it are irrelevant - your update should overwrite them all.

Access Table storage Insert-or-replace an entity To accomplish this, you would use an InsertOrReplace operation. This operation inserts the entity if it doesn't exist, or replaces it if it does, regardless of when the last update was made. In the following code example, the contact entity for Ben Smith is still retrieved, but it is then saved back to the server using InsertOrReplace. Any updates made to the entity between the retrieval and update operation will be overwritten.

Access Table storage Replace an entity TableOperation insertOrReplaceOperation = TableOperation.InsertOrReplace(updateEn tity); // Execute the operation. table.Execute(updateOperation);

Access Table storage Delete an entity You can easily delete an entity after you have retrieved it, using the same pattern shown for updating an entity. The following code retrieves and deletes a customer entity.

Access Table storage Delete an entity // Create the Delete TableOperation. TableOperation deleteOperation = TableOperation.Delete(deleteEntity); // Execute the operation. table.Execute(deleteOperation);

Access Table storage Delete a table Finally, the following code example deletes a table from a storage account. A table which has been deleted will be unavailable to be recreated for a period of time following the deletion. // Delete the table it if exists. table.DeleteIfExists();