110 likes | 337 Views
Welcome . Mike DiRenzo , CEO Business Automation Systems, Inc . Cool Coyotes, Inc. Mike@coolcoyotes.com Micha l.direnzo@gmail.com Twitter: @ mike_direnzo Software Architect and Developer with 20 years of experience Published on: CodeProject.com TopXML.com SQLServerCentral.com
E N D
Welcome • Mike DiRenzo, CEO Business Automation Systems, Inc. Cool Coyotes, Inc. Mike@coolcoyotes.com Michal.direnzo@gmail.com Twitter: @mike_direnzo • Software Architect and Developer with 20 years of experience • Published on: CodeProject.com TopXML.com SQLServerCentral.com • I have been using LINQ for two years.
What is LINQ? • LINQ - Language Integrated Query • Created by Matt Warren of Microsoft 2003 • Query information from: • In memory collections • Database • XML files • WMI • Other • Same capabilities as SQL and more
Why use LINQ? • Why do we need another query language? • Productivity (most cases) • LINQ is Integrated with C# (or VB) • Eliminates the impedance mismatch between programming languages and databases (switch between TSQL and C#) • Provides a single query interface for multiple data sources
Why use LINQ? • Simpler, tidier, higher-level than TSQL • working in a modern language and not having to worry about lower-level details is a big win. • Query Multiple Data Sources • SQL • Objects • XML • WMI • Almost anything • LINQ is easier to master than SQL Select * from customers or Customers.Take(50);
Why use LINQ and not SQL?SQL isn't broken, so why fix it? • SQL is old (1974) and relatively complex
Why use SQL and not LINQ? • When not to use LINQ for querying databases • Hand-tweaked queries (locking hints) Select * from customers (nolock) • Queries that involve selecting into temporary tables and then querying said tables • Predicated updates and bulk inserts • Triggers, stored procedures, and functions (If you still use them!)
Where is LINQ being Used? • Corporate application development • In DotNetNuke development • Modules • http://www.adefwebserver.com/DotNetNukeHELP/Blogs/Linq_FirstLook.htm
Linqpadwww.linqpad.com • A very useful tool for writing: • Scratch applications • Building LINQ Queries • Examining the generated SQL • It is mini Visual Studio C# compiler • Allows App and web config file references • Allows Snippets, third party libraries and/or GAC integration
Linqpadwww.linqpad.com LINQPAD for the Dot Net Framework • LINQ to SQL For Dot Net Framework 3.5 http://www.linqpad.net/GetFile.aspx?LINQPad.exe • Entity Framework For Dot Net Framework 4.0 http://www.linqpad.net/GetFile.aspx?LINQPad4.zip
Useful LINQs • Origin of LNQ http://blogs.msdn.com/b/mattwar/archive/2007/05/31/the-origin-of-linq-to-sql.aspx • Why LINQ? http://www.linqpad.net/WhyLINQBeatsSQL.aspx • Linq Pad http://www.linqpad.com • Linq Kit – Extensions http://www.albahari.com/nutshell/linqkit.aspx • Predicate Builder http://www.albahari.com/nutshell/predicatebuilder.aspx
Useful LINQsMike DiRenzo Articles • XSLT - Search and Replace • XSLT - HTML Image Tag • XSLT- HTML Input Tag • XSLT- Select/Option Tag • XSLT- Date Filtering and Sorting • Dynamic Node Tree Fragment • XML Pivot Table • Using the Information Schema Views • Yet Another TSQL PAD Utility