1 / 10

Introduction to LinqToSQL AWW YEA FOO!

Introduction to LinqToSQL AWW YEA FOO!. Jonas Avellana TYCO Thermal Controls. Who is Jonas?. Work for. Let’s Start. What is LINQ? Short for Language-Integrated Query An “SQL”-like syntax to query in-memory collections Frikken awesome! Why LINQ? DEMO. What is LinqToSQL ?

arch
Download Presentation

Introduction to LinqToSQL AWW YEA FOO!

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to LinqToSQLAWW YEA FOO! Jonas Avellana TYCO Thermal Controls

  2. Who is Jonas? • Work for

  3. Let’s Start • What is LINQ? • Short for Language-Integrated Query • An “SQL”-like syntax to query in-memory collections • Frikken awesome! • Why LINQ? • DEMO

  4. What is LinqToSQL? • Another OR\M • Queries are written in LINQ • Instead of in-memory collection queries, we go to a SQL Server database • One-to-one implementation

  5. Other ORM’s • NHibernate • Castle ActiveRecord (Runs under NHibernate) • Linq To Entities (Microsoft’s “NHibernate”) • Many more!

  6. Scenario • Photo Album • Has many photos • Has many sets • A set can have many photos • A set has details • A.K.A. Jonas’ Ghetto Flickr

  7. Database Diagram

  8. UML

  9. Pros • Very easy to write LINQ • No more mapping files (Photo.hbm.xml) • Can be used with existing SQL Server databases • Can call SQL & Stored Procs • Less string keys to use that may cause errors (gateway.CreateParameter(“itemId”, item.ItemId)) • Lazy Loading!

  10. Cons • SQL Server only. • Could be slower than other ORM or hand rolled data access objects. • Could be a pain to maintain if you use the LinqToSql designer (drag + drop) if you keep on refactoring your database • May cause multiple database calls • Can be avoided with DataLoadOptionsor with a proper IQueryable<T> query

More Related