June 10, 2006Applied Information Sciences, Inc Leveraging.NET Attributes to build a simple Relational Object Mapping Framework Jason Fabritz Applied Information.

Slides:



Advertisements
Similar presentations
1. Write an Excel text function in cell Company Data!A4, which may be copied down, to string together the first and last name with only the first letter.
Advertisements

The OWASP Foundation OWASP OWASP Conference 2008 Application Security – The code analysis way Maty Siman CTO Checkmarx.
Object Oriented Programming: Classes and Objects.
Adding a database to web service Add a database – Service->Add new item->SQL server database Add table to database – Server explorer->tables->Add new table.
Denotational Semantics Syntax-directed approach, generalization of attribute grammars: –Define context-free abstract syntax –Specify syntactic categories.
SQL Components DML DDL DAL. Overview u Getting the records onto the disk - mapping u Managing disk space u SQL Modes u Ceating database.
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
Microsoft Access – Tutorial 1 if you need to review general Microsoft Office procedures such as: menus toolbars task panes files help printing please go.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Programming with Visual Basic.NET An Object-Oriented Approach  Chapter 8 Introduction to Database Processing.
DBA Developer. Responsibilities  Designing Relational databases  Developing interface layer Environment Microsoft SQL Server,.NET SQL Layer: Stored.
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University.
Microsoft Access – Tutorial 1 if you need to review general Microsoft Office procedures such as: menus toolbars task panes files help printing please go.
11 Updating a Database Table Textbook Chapter 14.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
PART 1 CREATING THE PRODUCT CATALOG. ROADMAP FOR THIS CHAPTER To implement the departments list, you’ll start with the database and make your way to the.
Problem Session Working in pairs of two, solve the following problem...
ADO.Net CS795. What is ADO.Net? Database language spoken by managed applications ADO.net database accesses go through modules: data providers –SQL Server.Net.
Application Internet Azure Cloud Internet Azure Cloud LB TDS (tcp) Applications use standard SQL client libraries: ODBC, ADO.Net, PHP, … Load balancer.
SQL Server 2005: The CLR Integration What Developers and DBAs need to know.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Working with Disconnected Data The DataSet and SqlDataAdapter ADO.NET - Lesson.
11 Using ADO.NET II Textbook Chapter Getting Started Last class we started a simple example of using ADO.NET operations to access the Addresses.
Emall id name description owner address1 address2 city state zip country created updated storefront id name description owner address1 address2 city state.
Tips & Tricks: Scrubbing Source Code For Common Coding Mistakes (FxCop And PREfast) Nicholas Guerrera TLNL06 Software Design Engineer Microsoft Corporation.
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.
Module 7: Accessing Data by Using ADO.NET
Module 3: Performing Connected Database Operations.
1 11/10/05CS360 Windows Programming ADO.NET. 2 11/10/05CS360 Windows Programming ADO.NET  Behind every great application is a database manager o Amazon.
More ASP.NET Database In a properly organized application, your data access code is never embedded directly in the code-behind for a page. Instead, it’s.
Presentation & Business Tier Design Patterns Pearce.
The Problems HTTP is disconnected So many database vendors Create a simple consistent versatile interface on the data Look at ADO.NET classes OleDb SQL.
Distributed Database Systems INF413. ADO.NET is a set of classes that comes with the Microsoft.NET framework to facilitate data access from managed languages.
ADO.Net CS795. What is ADO.Net? Database language spoken by managed applications ADO.net database accesses go through modules: data providers –SQL Server.Net.
HNDIT Rapid Application Development
public class UsLocationRecord { public int Id { get; set; } public string ZipCode { get; set; } public string City { get; set; } public string.
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
DISTRIBUTED TRANSACTIONS IN.NET Presented By Divya Josyala.
C# .NET Software Development
Active Data Objects Using.Net ADO.Net Farooq Ahmed Amna Umber Summayya Shehzad.
Session 8: Data Management (with Stored Procedures)
1. Write an Excel text function in cell Company Data!A4, which may be copied down, to string together the first and last name with only the first letter.
DataGridView. Displaying data in a tabular format is a task you are likely to perform frequently. The DataGridView control is designed to be a complete.
IT420: Database Management and Organization Triggers and Stored Procedures 24 February 2006 Adina Crăiniceanu
Lab 6: Geocoding You have received a dBase file that contains the address list of over 500 homes in your neighborhood that have had reports of lead poisoning.
public class UsLocationRecord { public int Id { get; set; } public string ZipCode { get; set; } public string City { get; set; } public string State.
1 Working with MS SQL Server Beginning ASP.NET in C# and VB Chapter 12.
Thank you to our AWESOME sponsors!
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Using Stored Procedures ADO.NET - Lesson 07  Training time: 15 minutes  Author:
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.
1 c6212 Advanced Database and Client Server MS SQL Server 2000 Stored Procedures and Parameters What ? Why ? How ?
Lecture Select Operation 2. Insert Operation 3. Update Operation 4. Delete Operation.
Common SQL keywords. Building and using CASE Tools Data Base with Microsoft SQL-Server and C#
Unit 9.1 Learning Objectives Data Access in Code
ADO.NET and Stored Procedures
How to use ADO.NET to write your own data access code
DataSet и SqlDataAdapter
VB.NET Using Database.
מתחברים למסד נתונים היכרות עם ADO.Net.
Stored Procedures
.NET and .NET Core 10. Enabling Contracts Pan Wuming 2017.
RELATIONAL DATABASES AND XML
[Payee Name] [Street Address] [City, ST ZIP Code]
04 | Data Acess Technologies
Engine Part ID Part 1.
Engine Part ID Part 2.
Engine Part ID Part 2.
M S COLLEGE OF ART’S, COMM., SCI. & BMS Advance Web Programming
Dictionary basics Consider typing the word “infinite” in the Google search:
solve the following problem...
Presentation transcript:

June 10, 2006Applied Information Sciences, Inc Leveraging.NET Attributes to build a simple Relational Object Mapping Framework Jason Fabritz Applied Information Sciences, Inc.

June 10, 2006Applied Information Sciences, Inc Attributes Describing how to Serialize Data [Serializable] [XmlElement] Describing how to Serialize Data [Serializable] [XmlElement] Security Characteristics [CodeAccessSecurity] Security Characteristics [CodeAccessSecurity] Affect the Just-in-Time (JIT) Compiler [StructLayout] [MarshalAs] Affect the Just-in-Time (JIT) Compiler [StructLayout] [MarshalAs] Code Interoperability [ComVisible] Code Interoperability [ComVisible]

June 10, 2006Applied Information Sciences, Inc Usage Example using System; using System.Xml.Serialization; [Serializable] [XmlRoot( Namespace = " IsNullable = false, ElementName = "Address" )] public class Address { [XmlAttribute( "id" )] public int Id { get; set; } [XmlElement( "Street1" )] public String Street { get; set; } [XmlElement( "City" )] public String City { get; set; } …

June 10, 2006Applied Information Sciences, Inc Rolling Your Own [AttributeUsage( AttributeTargets.Property, AllowMultiple=true )] public class SqlParameterAttribute : Attribute { public SqlParameterAttribute( String name, params String[] mode ) { //… } public bool ReturnsData { get { //… } set { //… } }

June 10, 2006Applied Information Sciences, Inc Calling a Stored Procedure public int addAddress( int personId, int type, String street, String city, String state, String zip ) { using( SqlConnection connection = new SqlConnection( connectionString ) ) { connection.Open( ); using( SqlCommand command = connection.CreateCommand( ) ) { command.CommandType = CommandType.StoredProcedure; command.CommandText = "sp_add_address"; command.Parameters.Add( SqlDbType.Int ).Value = personId; command.Parameters.Add( SqlDbType.Int ).Value = type; command.Parameters.Add( SqlDbType.NVarChar, 255 ).Value = street; command.Parameters.Add( SqlDbType.NVarChar, 32 ).Value = city; command.Parameters.Add( SqlDbType.NVarChar, 120 ).Value = state; command.Parameters.Add( SqlDbType.NVarChar, 12 ).Value = zip; return command.ExecuteNonQuery( ); }

June 10, 2006Applied Information Sciences, Inc Calling a Stored Procedure public int addAddress( Address address ) { using( SqlConnection connection = new SqlConnection( connectionString ) ) { connection.Open( ); using( SqlCommand command = connection.CreateCommand( ) ) { command.CommandType = CommandType.StoredProcedure; command.CommandText = "sp_add_address"; command.Parameters.Add( SqlDbType.Int ).Value = address.PersonId; command.Parameters.Add( SqlDbType.Int ).Value = address.AddressType; command.Parameters.Add( SqlDbType.NVarChar, 255 ).Value = address.Street; command.Parameters.Add( SqlDbType.NVarChar, 32 ).Value = address.City; command.Parameters.Add( SqlDbType.NVarChar, 120 ).Value = address.State; command.Parameters.Add( SqlDbType.NVarChar, 12 ).Value = address.ZipCode; return command.ExecuteNonQuery( ); }

June 10, 2006Applied Information Sciences, Inc Calling a Stored Procedure public int addAddress( Address address ) { using( SqlEngine engine = factory.CreateSqlEngine( ) ) { return engine.Execute( address, "add" ); }

June 10, 2006Applied Information Sciences, Inc Calling a Stored Procedure using( SqlEngine engine = factory.CreateSqlEngine( ) ) { engine.Execute( address, "add" ); }

June 10, 2006Applied Information Sciences, Inc The Big Idea public class Address { public int PersonId {...}; public int AddressType {...}; public String Street {...}; public String City {...}; public String State {...}; public String ZipCode {...}; } CREATE PROCEDURE dbo.sp_add_address NVARCHAR(12) ) AS BEGIN …

June 10, 2006Applied Information Sciences, Inc The Big Idea [SqlProcedure("sp_add_address“)] public class Address { public int PersonId {...}; public int AddressType {...}; public String Street {...}; public String City {...}; public String State {...}; public String ZipCode {...}; } CREATE PROCEDURE dbo.sp_add_address NVARCHAR(12) ) AS BEGIN …

June 10, 2006Applied Information Sciences, Inc The Big Idea public class Address { [SqlResult("person_id")] public int PersonId {...}; [SqlResult("address_type_id")] public int AddressType {...}; [SqlResult("street")] public String Street {...}; [SqlResult("city")] public String City {...}; [SqlResult("state")] public String State {...}; [SqlResult("zip")] public String ZipCode {...}; } CREATE PROCEDURE int ) AS BEGIN SELECT person_id, address_type_id, street, city, state, zip FROM address WHERE id END

June 10, 2006Applied Information Sciences, Inc Mapping Objects [SqlProcedure( "sp_add_address", "add" )] [SqlProcedure( "sp_update_address", "update" )] [SqlProcedure( "sp_delete_address", "delete" )] public class Address { [SqlResult( "id", "add", "get" )] public int Id { get; set } [SqlResult("person_id","get")] public int PersonId { get; set; } [SqlResult("street","get")] public String Street { get; set; }...

June 10, 2006Applied Information Sciences, Inc Using Mapped Objects Address address; FindAddress finder = new FindAddress( ) ; finder.AddressId = 100 ; using( SqlEngine engine = factory.CreateSqlEngine( ) ) { address = engine.Execute ( finder, "get" ) ; } … // modify address using( SqlEngine engine = factory.CreateSqlEngine( ) ) { engine.Execute( address, "update" ) ; }

June 10, 2006Applied Information Sciences, Inc CODE

June 10, 2006Applied Information Sciences, Inc Resources MSDN MSDN NUnit NUnit Applied Information Sciences, Inc. Applied Information Sciences, Inc.