Tag | LINQ Posts

Some time ago I wrote a post in which I talk about how you can do unit tests over your text templates using the GAX Host. In that example I used a very simple template which receives just a couple of string properties. But it becomes more complicated when you have properties which are complex types ok I know, most probably you're thinking that can resolve that just creating your own mock objects and you're right. But the thing is that you can do that in a really easiest way using a mock framework. ...
Serious VB Booklist Looking for VB.NET books that don't insult your intelligence? Tired of "Hello World" examples? Ready to get your hands dirty with some hardcore programming? Look no further than this list of serious VB.NET titles: Expert VB 2005 Business Objects - Rocky Lhotka Doing Objects in Visual Basic 2005 - Deborah Kurata LINQ in Action - Fabrice Marquerie, Steve Eichert, Jim Wooley (VB Samples) The Rational Guide to SQL Server CLR Integration - Greg Low Hitchhikers Guide to Visual Studio ...
I was recently introduced to a UK based publisher called Pact Publishing. They are a UK based publisher and have a book focused on the new Language Integrated Query (LINQ) features available in .NET 3.5 called LINQ Quickly: A practical guide to programming Language Integrated Query with C# by N Satheesh Kumar. The book provides a good overview of LINQ and it's supporting language features, such as anonymous types, implicit typing, object initializers, extension methods, and expressions. It then builds ...
Do you ever feel like there's just too much stuff to learn and not enough time in the day to learn it? I mean seriously...I've got the following things on my plate at the moment: VB.NET 2008 (as in exploring the new language features more in depth)MVCMore AJAX StuffLINQ (to Objects, to SQL)Entity FrameworkWCFWPFBiz TalkMobile Development using Mobile 6 and VS.NET 2008NHibernateSubversion and GitCastle Windsor[Edit]NDependNUnit [/Edit]... A co-worker made an interesting comment today that I think ...
Another great meeting!!! Tonight I walked in with Bill; I got to help push the mounds of food and drinks in. As usual the meeting was held at the Microsoft Malvern campus. The meeting started with Dani Diaz our local MS rep. His course was named VS c# Tips and Tricks for the MS Visual Studio 2008 IDE. Dani started out with showing us around VS 2008, key commands, explaining the versioning and how it works, etc. Some of the key commands that he showed were pretty cool, ones I never saw before. Then ...
I came across a need the other day to recurse the page control tree (or any control tree really) to find all controls of a certain type, so this is the extension method I wrote to help me do that. Hopefully it will help others as well. /// <summary> /// Recurses the control tree and finds all controls in the control collection that are of the specified type. /// </summary> /// <typeparam name="T">The type of control you want to find</typeparam> /// <param name="controls">The ...
This Thursday I'll be giving on presentation on LINQ to SQL at the CMAP Developer group: http://cmap-online.org/Meetings/Details/2008-02-21.aspx
Note this article is primarily based on Microsoft/.Net technologies, although the principle apply to any technology. Before development of any reasonable business software project begins the following areas need to be nailed down: Application Architecture (application structure) ORM (Object/Relational Mapping - data source access and translation to/from business objects) Base framework (system framework, helper classes, base classes, etc) UI. There are many tools available that will dictate or guide ...
A recent announcement was made on the altdotnet mailing list that made me jump for joy today. Ilya Ryzhenkov and the great folks at JetBrains have published the nightly builds for Resharper 4.0. The download for this can be found here and you might want to read the release notes here. It's important to note that the LINQ syntax is still not supported yet. As with any product in nightly builds, please use with caution, but download it and play with it today ...
I've received some comments and composed some responses, included below: First Comment/Question: I've got questions about performance in LINQ and LINQ to SQL. Is it more effective to create a query against the context or against a collection on another object? For example, which is better: = from t in db.Things where t.Something = "MyVal" && t.ForeignKeyId = 28 or is it better to do this: = from t in db.ForeignKeys where t.Something = "MyVal" ? In the former, I'm running against the data ...
Just thought I'd give you an idea of some of the content that will be presented at the Raleigh Code Camp 2008 this Saturday. Jim Wooley - What's new in VB 9 Richard Campbell - Performance and Scalability Mark Dunn - BizTalk Miguel Castro - How to Work with Recruiters Rob Zelt - Silverlight Bill Jones - LINQ in VS 2008 Josh Carlisle - Customizing MOSS Publishing Brian Gough - Wrapping a User Control in a SharePoint Web Part Josh Carlisle - SharePoint for ASP.NET Developers Kevin Boles - SQL Server ...
I have been working on getting around the concurrency issues that LINQ has while working with disconnected DataContext's in an nTier environment. I currently have a Timestamp field in all of my tables to act as a row version number to help LINQ keep track of what is going on with my data. Up to this point I haven't had any issues as I have been working with objects that were either stored in session/cache as whole objects or I have been reconstituting the object from a new DataContext prior to updating ...
I was aware of lambda expressions because I was reading about them in the C# 3.0 white paper specification, along with other new language features like extension methods, anonymous types, basis for LINQ, etc. I thought it was cool enough, it makes passing anonymous delegates much better in terms of code writing/reading. However, actually using them takes a bit of getting used to. As such, I'd like to give a short example as to how I visualize writing lambda expressions. Consider the following class ...
Glad to say we have upgraded all of main software products to .NET 3.5. So far we have been very impressed with LINQ and WCF. We look forward to play with WWF, WPF, and Silverlight in 2008.
In the way distant past, I ended up creating a new delegate for just about each function I need represented as a delegate. And as I experienced an explosion of delegates and needing to come up with the names for it, I ended up creating 2 sets of delegates as follows: public delegate void VoidFunction(); public delegate void VoidFunction<T>(T argument1); public delegate void VoidFunction<T, U>(T argument1, U argument2); public delegate R Function<R>(); public delegate R Function<R, ...
Read 3 good books this month: 1) the Emotion Machine - by Marvin Minsky - postulates how emotional states are a mechanism for changing the priority weighting of our cognitive machinary in regards to goals and tasks. A fair bit of conjecture as opposed to experimentally backed up theorum, and some rehash of his previous work 'The Society of Mind'. 2) MultiAgent Systems - Wooldridge - design of distributed workflow services that have different goals and tasks, and often which must compete , communcate ...
Countdown till the 2008 launch in Belgium and the start of the TechDays summit has started. Proud to see loads of great Belgian speakers here. Here a list speakers I like, collegeas, community (visug) friends, Microsoft.be guys and other certified trainers and people I met at other Microsoft events. Gill Cleeren : A collegea at Ordina, MVP, SilverLight geek presenting Next Generation Web Applications. Dandy Weyn : A Redmond based SQL Guru with Belgian roots has multiple sessions on SQL 2008. Peter ...
Check out the following from Matt Warrens blog posts, if you are interested on how to implement IQueryable Provider. source: http://blogs.msdn.com/mattw... Part I - Reusable IQueryable base classesPart II - Where and reusable Expression tree visitorPart II - Local variable referencesPart IV - SelectPart V - Improved Column bindingPart VI - Nested queriesPart VII - Join and SelectMany ...
Next Tuesday, Feb. 12th at 5:30pm, I'm presenting at the Arizona .NET Users Group at the Microsoft campus in downtown Phoenix. The presentation is going to be a deep exploration of the new features of C# 3.0 - including LINQ, lambda expressions, extension methods, simple properties, partial methods, anonymous/implicit types, and object and collection initialzers. It will also cover some of the new .NET Framework 3.5 class libraries, but only insofar as they support the C# 3.0 language features (for ...
Egad! So I have used the .First() method in many of my LINQ queries to make sure that my query only returns one record. I thought this would be a great way to insure isolation of one record. Very similar to a TOP 1 statement in SQL. However, there is an issue with this concept. If your TOP 1 SQL statement doesn't find any records it returns nothing. I guess I sort of hoped that the .First() method would do something similar - say return NULL or something like that. It doesn't! Instead it throws an ...
I did some research in the OR mapping capabilities of the ADO.NET Entity Framework with Beta 3. Goal was to see how inheritance works. Here a quick walktrough. Database Started with 2 tables (wich have a 1-1 relationship). Table Employees which holds Name and JobTitle.Table SecurityInfo which holds Username (let's assume that this field is a network login) Entity ModelCreated the EntityTypes in the Entity Data Model as followed. NetworkUsers is inherited from Employee. Here Employees is mapped to ...
ProblemIf you try to query an ArrayList via LINQ you might be surprised to see that its not supported and throwing an exception. In other words the following query will not work at all. ArrayList students = GetStudents();var query = from student in students where student.Score > 80 select new { student.ID, student.Name }; CauseThe problem comes from the fact that LINQ to Objects has been designed to query generic collections that implement the System.Collections.Generic.... interface. ...
I have been working for the past few days to try and figure out how to get LINQ to SQL integrated into my normal nTier environment. I have also been trying to follow along with the general principles of Domain Driven Design but am finding that there are some deficiencies in the current LINQ to SQL implementation that force a few restrictions on how I do things. Let's first look at some of the restrictions Disconnected DataContext My understanding of the LINQ to SQL DataContext is that it prefers ...
This is also from an internal mail to SilverKey Tech Egypt office dev. team. Slightly modified this time! (Yes, I know. I should stop this habit of link collection and get back to writing - hopefully soon) Joe On .NET - Windows Workflow Foundation Tutorial Series SourceMaking (Design Patterns, Antipatterns, Refactoring) Brennan’s Blog » Blog Archive » Intellisense for jQuery in Visual Studio 2008 Happy Coding: OOP and FOOP Linq to SQL DataContext Lifetime Management - Rick Strahl's Web Log Dan Driscoll's ...
Reading the news that Ruby.NET is dead although doesn't feel the best thing to hear, is still logical, and more explicitly it's even "right". After all, it reminded me with the other story about the death of AJAX.NET Professional. I wrote a detailed take on that earlier (in my former blog) and although you might consider this spamming, I feel the same talk needs to be brought back into conversation, because I feel like I want to say the same things, so, I'm quoting it entirely here in this blog. ...
Neudesic is again presenting some great sessions about exciting current and upcoming technologies for 2008 in the Microsoft technology stack. This year, the event is being offered in three cities: Denver, Chicago, and New York. See the NuCon site for the wide variety of sessions being offered across several different tracks, including stuff like Silverlight, Microsoft IO, Team Foundation Server, LINQ, ADO.Net, Enterprise Data, and more ...
It all started with an email Mohamed Hossam (AKA, Bashmohandes) sent to SilverKey Tech. (the company I work for) local office here in Egypt, referring to the article "Foundations of Functional Programming - Part 1 - B# .NET Blog". It inspired me to send few more language links: Linklist 03022008 - Dynamic programming design patterns, Erlang/C# AMQP Client, AOP - Nauman Leghari's Blog James Kovacs' Weblog - Syntactic Sugar, Compiler Candy, and Other Sweets Charlie Calvert's Community Blog : Expression ...
C# 3.0 introduces several language extensions that build on C# 2.0 to support the creation and use of higher order, functional style class libraries. The extensions enable construction of compositional APIs that have equal expressive power of query languages in domains such as relational databases and XML. Part of the new extensions is LINQ. LINQ is a codename for a set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. It extends C# and Visual ...
What does Star Wars, "Pour Some Sugar on Me", Beer, Ginger from Gilligan's Island, Socks with Sandals, LINQ, MetaLINQ, and a lack of pants have in common? You'll have to watch Jeff Brand's interview with Aaron Erickson to find out! Back at last Fall's Twin Cities Code Camp, the resident Microsoft DE Jeff Brand did a series of recordings with some of the presenters. He's got them posted up on his web-site now for your parousal. Interesting note: you can't tell, but Aaron is actually not wearing pants. ...
While working on a NIEM parser library I found that you can import XML namespaces at the project level. Previously I posted about doing this at the top of your .VB class file: Imports <xmlns:nc="http://niem.g... That allows you to use the prefix nc: in LINQ queries to work with NIEM documents. Well today I discovered you can add those at the project level. Right click your project and go to properties. In the properties window go to references. Near the bottom you can type ...
Download Solution - OfflineHtml.zip So, one of the cool controls available to us in WinForms is System.Windows.Forms.WebBro... The WebBrowser control is essentially a managed wrapper around some COM interfaces that bind to Internet Explorer and provides us with several interesting capabilities. First of all, one can use WebBrowser to easily display a web page in a WinForms application. All you have to do is set the WebBrowser.Url property and the control takes care of getting the assets from across ...
This very simple extension method makes a string a fixed length. It appends whitespace to a string that is shorter than required or strips characters to a string to is longer than requested. See ScottGu blog post for a brush up (or intro) on extension methods. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ParaPlan.Extensions { public static class StringHelper { public static string ToFixedLength(this string s, int width) { string rv = s; if (s.Length ...
Back Links LINQ Overview, part zero LINQ Overview, part one (Extension Methods) NOTE: This article is dedicated to Keith Elder...even if he never sent me a bologna sandwich. Apparently, two months is my definition of "very soon". Let's continue. Since .NET 1.1 we've had the concept of delegates. They are the constructs that allow us to call methods on objects via reference such as: delegate int AddFunc(int x, int y); public static class MathOps { public static int Add(int x, int y) { return x + y; ...
In the earlier post, we saw the "Dynamic Data Website" shipped with ASP.NET 3.5 Extensions Preview that can be used for rapid application development of data driven websites using Visual Studio 2008. The ASP.NET 3.5 Extensions Preview can be installed from here Once you install the same, you get a few things. One, is that you get the 'Dynamic Data Website' template I talked about earlier. The other thing is that you get the "ASP.NET 3.5 Extensions Website" template that allows you to create an ASP.NET ...
Earlier I had blogged about ASP.NET 3.5 Extensions Preview and also the Dynamic Data Controls and how ASP.NET would be evolving into a comprehensive platform for rapid applicaiton development of Data Driven Websites. While the earlier preview I talked about (Dynamic Data Controls) was a part of the ASP.NET "Futures" CTP, there is now a much better build of the Dynamic Data Controls which we shipped as a part of ASP.NET 3.5 Extensions Preview. Simply putting, we would encourage you to try out the ...
Update: Added more F# samples and the foundations of functional programming In a previous post, I've begun a pretty fun adventure into F#. I'm still working on quite a few samples to post here shortly, but in the mean time, I've collected a bunch of samples that I think are pretty cool and well worth a look. I'm currently digging through Robert Pickering's book "Foundations of F#". I'm especially interested in his DSLs which I hope to cover here shortly. For those interested in the foundations of ...
I have Visual Studio 2005 environment and decided to try VS 2008. I've read some articles(e.g. here) about site-by-site installation and had an impression, that making a copy of solution is enough. NOTE: If you are using TFS, before conversion of the existing solution, obtain and install Team Explorer Client . VS 2005 is using TFS Source Control, but VS 2008 shows no Source Control plug-in installed. . After installing of VS 2008 I've copied my existing solution as MySolution2008 and opened it in ...
Here is simple LINQ example where I have used Extension methods "Where", to select the participants whose score is greater than 80. var participants = Competition.GetParticipants() .Where(participant=> participant.Score > 80) .OrderByDescending(participant => parricipant.Score) .Select(participant => new { participant.Id, Name=participant.Name }); Note: here we are sending a Lamda expression (participant=>participan... as parameter of the "Where" extension method. Ever wondered ...
The "C# 3.0 in a nutshell" book has some neat free extras that are worth mentioning for those who haven't already heard of (they have been released for long). Those are like must-have LINQ tools and helpers. The homepage of LINQKit (the major part of the extras I'm going to cover here) provides great information and short code samples about the components: LINQPad This is a snippet compiler (application to run/try small codes in separation than big VS projects, like this), that's customized for LINQ ...
Inside a C# Program Main() and Command Line Arguments (C# Programming Guide) Types (C# Programming Guide) Arrays (C# Programming Guide) Strings (C# Programming Guide) Statements, Expressions, and Operators (C# Programming Guide) (Anonymous Functions, Lambda Expression, Anonymous Methods) Objects, Classes, and Structs (C# Programming Guide) Properties (C# Programming Guide) Indexers (C# Programming Guide) Delegates (C# Programming Guide) Events (C# Programming Guide) Generics (C# Programming Guide) ...
improve my => 'code' I just started playing around with LINQ seriously, and I really love some of the features incorporated, like the Enumerable.Range() function and how it can be used for integer programming. Here's a simple function for generating lognormal distributions (could be useful for financial engineering). Hope you're enjoying the samples, Jonathan Starr public List<double> GenerateLogNormalDistributi... numberOfTimes, double mean, double standardDeviation) { Random randomGenerator ...
I have been pretty excited about LINQ, because it seems to do all of the optimization for me for free (kinda like T-SQL). Yow Han-Lee asks in his blog, Brainteaser #11, Given any two large List, what is the quickest way to find the mutual intersection of the two? Now take into consideration memory constraints? Well, the answer that only takes a minute or two for me is the following... Comments welcome! Jonathan Starr using System; using System.Collections.Generic; using System.Linq; using System.Text; ...
This week I gave another .NET 3.x session for the syntrawest ITClub developers in Kortrijk. 19 People from West Vlaanderen where interested in Workflow Foundation and liked my presentation. As promised to them : you can download the code of the demos here. BTW : the agenda for my next sessions : 26/02 : VS2008, ADO.NET in .NET 3.5,LINQ 22/04 : Patterns & Practices, Applicaton Blocks and Software Factories 27/05 : Rich Internet Applications with Silverlight Want to attend these events ? Drop me ...
Okay so we've had an onslaught of new things hit in the Microsoft stack lately. I am curious how many folks are using WCF, WPF, WF (workflow), Silverlight, LINQ, etc. And for what types of problems you are trying to solve. It would also be nice to know if you are using the P&P Guidance Packages and Ent Libs. Oh and which Visual Studio version are you mainly working with these days? If you are not using this stuff yet why? Did you pitch it to your boss and they said no for some reason? Did they ...
Last week I was present at the MCT Summit in Berlin. Had fun, saw great presentations. A big applaus was given to Marcel De Vries for his LINQ presentation. Which was deserved, this was the best LINQ presentation I had ever seen. Altough the summit was more focused on ITPro and SQL stuff I had a good time. I was introduced by MCT collegeaus to the world of virtualization and Microsoft Hyper-V. Some 400 MCT’s from the EMEA region where there. About 10 belgians quickly joined together and started thinking ...
Update: Added new Hanselminutes show on F# and other links With the new year comes new challenges. Recently I've been looking to take my background in statistics and get back into graduate school. With those days brought the days of functional programming, pattern matching and all sorts of things. So, with that, I began to look at F#. Why F#? No, it's not because it's shiny and new and everyone's talking about it. To a point, it made me more aware, but I won't just hop on the next best thing without ...
Scott Guthrie[MSFT] announced the availability of .NET fx 3.5 library source code as promised. (Setup and how to use) Quote from the announcement: Specifically, you can now browse and debug the source code for the following .NET Framework libraries: .NET Base Class Libraries (including System, System.CodeDom, System.Collections, System.ComponentModel, System.Diagnostics, System.Drawing, System.Globalization, System.IO, System.Net, System.Reflection, System.Runtime, System.Security, System.Text, System.Threading, ...
I felt the need to vent a little bit of frustration today as I spent an entire weekend trying my best to figure out how to get LINQ to SQL to support what I consider to be a fairly standard database design concept - many to many relationships. In my case I have a table of Permissions and a table of Accounts. Rather than storing a list of permissions in my Accounts table I simply wanted to store both Accounts and Permissions separately and then link them together with a linking table. I don't think ...
Scott Hanselman beat me to the punch, but come Feb 14th, our latest and greatest edition of the Professional ASP.NET book is coming out. The book has a ton of new content and was exciting to put together - but man, did it take some serious time to do (especially when all three of us have real jobs, kids, newborns, animals, etc to deal with). The book is big ... really BIG - 1728 pages, so it can serve many other useful purposes after you are done reading it! :) The book description from the WROX.com ...
For those who missed it, our DC ALT.NET group will meet on January 15th at 7PM. I'm hoping for a great turnout of passionate developers in the DC Metro area. Hope you can make it. Also, don't forget to join the list as we discuss more issues and our next meeting stuff. The meeting this month will bring ALT.NET to CMAP. Are you a developer who always keeps an eye out for a better way? Do you look outside the mainstream to adopt the best practices of any development community, including Open Source, ...