17
Introduction to Object- Relational Mapping for .NET

Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Embed Size (px)

Citation preview

Page 1: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Introduction to Object-Relational Mapping for .NET

Page 2: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Little ‘bout Me

• dotNetTemplar.Net• ASP.NET MVP• ASPInsiders• ASPAlliance.com• GTE

Federal Credit Union• Life Beyond the Bits

Page 3: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

What is Object-Relational Mapping?

• The need for RDBMS.• The need for OOD/OOP.• The need for OOD/OOP to talk to RDBMS.• The need for RAD and long-term manageability.

Page 4: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Problems

• Querying• Updating• Mapping• Performance

Page 5: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Solutions

• Querying: OPath, Query Builder, Sprocs, Etc.• Updating: SQL, Commands, Transactions, Etc.• Mapping: XML/text files, Attributes.• Performance: Caching

Page 6: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Mapping• XML Configuration (Wilson O/R Mapper)

• XML Configuration (NHibernate)

Page 7: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Mapping

• Custom Attributes (DataAspects)

Page 8: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Querying• OPath (an OO SQL/XPath)

• Query Building (NHibernate)

Page 9: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Querying• Query Building (eXpress Persistent Objects)

• (DefaultAddress.City <> "Chicago" AND not (Company is null))

Page 10: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Querying

• Stored Procedures and Dynamic T-SQL• Custom Attributes (DataAspects)

Page 11: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Updating

• Commands and SQL Generation

• Use Mappings to Generate Commands and Parameters and, optionally, T-SQL.

Page 12: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Updating

• Transactions

Page 13: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Performance

• Is this as fast as straight, hand-written (or generated) ADO.NET?– Compared to 2-tier?– Compared to n-tier?

• 1000 DataAspects CRUD operations took 5046.8427 milliseconds.

• 1000 straight ADO.NET CRUD operations took 5281.2162 milliseconds.

• How is this possible?

Page 14: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Extensibility

• Does your O-R mapper allow you to use more than one database?

Page 15: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Some Examples

Page 16: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Future Features

• Built-In Paging Procedure Generation

• Easier API for Collections

• More Options for Querying

• VB Examples

Page 17: Copyright © 2004 J. Ambrose Little Introduction to Object-Relational Mapping for.NET

Other Resources

• DotNetTemplar – http://dotNetTemplar.net• Get Demo Project & Library - http://dotNetTemplar.Net/Downloads/LearnDataAspects.zip

• Object Spaces

– http://msdn.microsoft.com/data/winfs/

– http://blogs.msdn.com/aconrad/

• WilsonORMapper

– http://www.wilsondotnet.com/

• eXpress Persistent Objects

– http://www.devexpress.com/products/NET/XPO/

• Other O-R Libraries (Some Free, Some Not)

– http://url123.com/z7mqb