Tag | LINQ Posts

The .NET Framework version 4 includes enhancements for ASP.NET 4 in targeted areas. Visual Studio 2010 and Microsoft Visual Web Developer Express also include enhancements and new features for improved Web development. This document provides an overview of many of the new features that are included in the upcoming release. This topic contains the following sections: ASP.NET Core Services ASP.NET Web Forms ASP.NET MVC Dynamic Data ASP.NET Chart Control Visual Web Developer Enhancements Web Application ...
Today I gave a presentation at Montreal's "Ecole de Technologies Supérieure" and I said I would put my presentation and the material itself online in here.... The audience was exclusively composed of teachers from colleges around Montreal. There's the link to download the content : http://cid-bdf9cf467011e705... I hope all attendees learned more on LinQ than they knew before ...
I had a really fun evening doing “my final” EF 4.0 session last night (26th May 2010) at GL.NET based out of Gloucester (although secretly I made it into a IronRuby and Windows Azure session). They are a great crowd and Jimmy makes for a fantastic host + it is a very nice venue (Symantec offices in Gloucester, lots of parking, good room etc) + free pizza + free SWAG + trip to pub afterwards (the topics were very varied!). What more could you ask for? The next session is June 16th and will be on multi-tenanted ...
You can reach this page anytime at http://tools.michaelcrump.net Thanks to everyone that has contributed so far, we are getting several thousands hits from all sorts of developers a day. Recent Contributors include: Deependra Solanky, Grant, Klaus, James, BlueCollarCritic and Bob Koehn Tweet this list! Add a link to my site! Add me to twitter! This is a list of the tools/utilities that I use to do my job/hobby. I wanted this page to load fast and contain information that only you care about. If I ...
Our April meeting was presented by Wilson Kutegeka on the topic of Building the Data Access a layer. In his presentation he showed a tool which he has developed to generate the entities, stores procedures that would be used to reduce having to retype the same boilerplate code for each entity. He uses visual basic samples to demonstrate access to the data from the database and inherits his classes from an abstract class which contains common properties including connection strings, save and delete ...
Its been long due I was planning to write an article on creating some useful ASP.NET MVC application. I have code named it "DailyJournal". Its a simple application which allows creation of multiple activities and assign tasks to these activities. Its' kind of "Yet another Task/Todo application". The credentials which you can use with the attached demo application is shown below. Collapse Copy Code User Name : admin Password : admin123 Framework/Libraries Used ASP.NET MVC jQuery + jQuery UI (for ajax ...
Continuing part 2 of my Stepping outside the Visual Studio IDE, is the open-source Mono Project. Mono is a software platform designed to allow developers to easily create cross platform applications. Sponsored by Novell (http://www.novell.com/), Mono is an open source implementation of Microsoft's .NET Framework based on the ECMA standards for C# and the Common Language Runtime. A growing family of solutions and an active and enthusiastic contributing community is helping position Mono to become ...

The above error occurred when I executed a linq query using the following expression:

(s) => s.Book.Slug.Equals(bookslug) && ids.Contains(s.Id);

ids in this case is of type IEnumerable<Guid>. As indicated by the error message the fix is to change ids to ICollection<Guid>, then the query executes successfully.

This method will not protect your assemblies from a experienced hacker. It will however work with your everyday .net or silverlight projects. Everyday we see new keygens, cracks, serials being released that contain ways around copy protection from small companies. This is a simple process that will make a lot of hackers quit because so many others use nothing. If you were a thief would you pick the house that has security signs and an alarm or one that has nothing? To so begin: Obfuscation is the ...
Imperative Programming :: Imperative programming is a programming paradigm that describes computation in terms of statements that change a program state. In much the same way as the imperative mood in natural languages expresses commands to take action, imperative programs define sequences of commands for the computer to perform. The focus is on what steps the computer should take rather than what the computer will do (ex. C, C++, Java). Declarative Programming :: Declarative programming is a programming ...
The other day I created a simple NastyWord service exposed via OData. It was read-only and used an in-memory backing store for the words. Today I’ll modify it to use a file instead of a list and I’ll accept new nasty words by implementing IUpdatable directly. The first thing to do is enable the service to accept new entries. This is done at configuration time by adding the “WriteAppend” access rule: 1: public class NastyWords : DataService<NastyWordsDa... 2: { 3: // This method is called ...
One of my colleagues came-up with a unique situation where it was required to create log files based on the input file which is uploaded. For example if A.xml is uploaded, the corresponding log file should be A_log.txt. I am a strong believer that Logging / EH / caching are cross-cutting architecture aspects and should be least invasive to the business-logic written in enterprise application. I have been using Enterprise Library for logging / EH (i use to work with Avanade, so i have affection towards ...
My two latest books are out! Professional ASP.NET 4 in C# and VB Professional C# 4 and .NET 4 From the back covers: Take your web development to the next level using ASP.NET 4 ASP.NET is about making you as productive as possible when building fast and secure web applications. Each release of ASP.NET gets better and removes a lot of the tedious code that you previously needed to put in place, making common ASP.NET tasks easier. With this book, an unparalleled team of authors walks you through the ...
An upgraded article and solution had been posted here. I migrated the project to ASP.NET MVC 4 with some features added. - Upgraded to ASP.NET MVC 4, Visual Studio 2012. - Moved the solution to a separated project. - Moved the procedure originally executed in base controller's ExecuteCore to a separated class. Now can use the this solution without needing inherit from the localization base controller. - Implemented the localization resource provders so that can use any data source (database, XML ...
In my previous example we talked about how to fetch data from database and how to populate the form with data using L2S. In this example I’m going to extend a little bit of what I have demonstrated in my previous example. Basically I’m going to show you the basic way on how to edit and delete data from the form and update the database using L2S technology. Since this is a continuation of my previous example so I would suggest you to refer that first before you go any further. STEP 1: Setting up the ...
First up. Its actually really easy. I’m not very religious about my DB tech, I don’t really care, I just want something that works. So I’m happy to consider all options if they provide an advantage, and recently I was considering jumping from NHibernate to EF 4.0. However before ditching NHibernate and jumping to EF 4.0 I thought I should try the head version of NHibernates trunk and the Head version of FluentNHibernate. I currently have a “Repository / Unit of Work” Framework built up around these ...
Now I’m not an expert in either of these techs. I have a nice framework for unit of work / repository built with NHibernate. Works pretty well. I use FluentNhibernate to do the mappings. Works well. Takes very little code to get going with a DB back OO model. So why swap? Linq. In Entity Framework you get much better linq support. Visibility. I have no idea what's really happening with NHibernate….its a cloud of mystery most of the time. You have to read all the blogs, mailing lists, etc to know ...
The previous posts on Entity framework are available here : Entity Framework version 1- Brief Synopsis and Tips – Part 1 Entity Framework v1 … Brief Synopsis and Tips – Part 2 General Tips on Entity Framework v1 & Linq to Entities: ToTraceString() If you need to know the underlying SQL that the EF generates for a Linq To Entities query, then use the ToTraceString() method of the ObjectQuery class. (or use LINQPAD) Note that you need to cast the LINQToEntities query to ObjectQuery before calling ...
I've been thinking a lot about extension methods lately, and I must admit I both love them and hate them. They are a lot like sugar, they taste so nice and sweet, but they'll rot your teeth if you eat them too much. I can't deny that they are useful and handy. After all, one of the major components of the Shared Component library where I work is a set of useful extension methods to help simplify common repetitive tasks. But, I also can't deny that they tend to be overused and abused to willy-nilly ...
In real life and OO programming we’re often faced with using adapters, DVI to VGA, 1/4” to 1/8” audio connections, 110V to 220V, wrapping an incompatible interface with a new one, and so on. Where the adapter pattern is generally considered for interfaces and classes a similar technique can be applied to method signatures. To be fair, this adaptation is generally used to reduce the number of parameters but I’m sure there are other clever possibilities to be had. As Jan questioned in the last post, ...
The purpose of my blog is to explain things for a Silverlight developer. One of the best things about Lambda's is that you not only use them in Silverlight but any project targeting .net 3.5 I’ve seen several blog post that use lambda expressions always assuming the audience is familiar with them. The purpose of this post is to make them simple and easily understood. Let’s begin with a definition. A lambda expression is an anonymous function that can contain expressions and statements, and can be ...
I joined a fairly large project recently and it has a particularity… Once finished, everything has to be sent to the client under VS2005 using VB.Net and can target either framework 2.0 or 3.0… A long time ago, the decision to use VS2008 and to target framework 3.0 was taken but people knew they would need to establish a few rules to ensure that each dev would use VS2008 as if it was VS2005… Why is that so? Well simply because the compiler in VS2005 is different from the compiler inside VS2008… I ...
So I was reading Peter Kellner's blog entry on Resharper 5.0 and its LINQ refactoring and thought that was very cool. But that raised a point I had always been curious about in my head -- which is a better choice: manual foreach loops or LINQ? The answer is not really clear-cut. There are two sides to any code cost arguments: performance and maintainability. The first of these is obvious and quantifiable. Given any two pieces of code that perform the same function, you can run them side-by-side and ...
It’s funny that two posts so close together speak about flexibility with the LINQ to Twitter provider. There are certain things you know from experience on when to make software more flexible and when to save time. This is another one of those times when I got lucky and made the right choice up front. I’m talking about the ability to switch URLs. It only makes sense that Twitter should begin versioning their API as it matures. In fact, most of the entire API has moved to the v1 URL at “https://api.twitter.com/1/”, ...
Technorati Tags: Ram,Parallel Computing in .Net 4.0 Parallel computing is the simultaneous use of multiple compute resources to solve a computational problem: To be run using multiple CPUs A problem is broken into discrete parts that can be solved concurrently Each part is further broken down to a series of instructions Instructions from each part execute simultaneously on different CPUs Parallel Extensions in .NET 4.0 provides a set of libraries and tools to achieve the above mentioned objectives. ...
I’m proud to announce that two Microsoft employees, Sarika Calla and Kevin Halverson, who works on the Visual Studio Product Team will be visiting various User Groups and Companies in Arkansas and Texas! Bios: Sarika Calla – Speaking about a Woman’s perspective at Microsoft, this natively born Indian holds a Masters in Computer Science from Georgia Tech and has been with Microsoft for the past 8 years. Sarika is now a Team Lead on the IDE Team. (pic is Redmond sacalla mthumb.jpg) Kevin Halverson ...
In my last post, I talked quite a bit about iterators and how they can be really powerful tools for filtering a collection of items down to a subset of items. This had both pros and cons over returning a full collection, which, in summary, were: Pros: If traversal is only partial, does not have to visit rest of collection. If evaluation method is costly, only incurs that cost on elements visited. Adds little to no garbage collection pressure. Cons: Very slight performance impact if you know caller ...
Microsoft just released an example named Microsoft Townhall which was built and deployed on Azure. It uses ASP.NET MVC as its webiste framework and the SQL Azure plus LinqToSQL as its the database and the ORM framework. You can download the source code at the MSDN Code Gallery. Basides the Azure it might be more useful to us to learn how they utilized ASP.NET MVC. Just a very quickly review I found it utilized the Enterprise Library Unity as the main IoC container for controllers, services and repositories ...
Today I noticed some topics from questions in the beta exam 70-518 which stumped me. I am just mentioning the topics below for future understanding and reference. This exam made me feel as if I was attempting questions about .NET 4.0 Framework. 1. Content-based vs. context-based filtered routing – Deciding the nearest Geographical Database. 2. Choosing an appropriate strategy for communicating with COM components, mainframe services 3. Microsoft Sync Framework 4. PLINQ 5. Difference between Dispatcher.BeginInvoke ...
Some of you reading this will be wondering, "what is an iterator" and think I'm locked in the world of C++. Nope, I'm talking C# iterators. No, not enumerators, iterators. So, for those of you who do not know what iterators are in C#, I will explain it in summary, and for those of you who know what iterators are but are curious of the performance impacts, I will explore that as well. Iterators have been around for a bit now, and there are still a bunch of people who don't know what they are or what ...
Recently I came across LINQPAD at http://www.linqpad.net/ a free utility by Joseph Alabahari. This is an excellent tool for developing and testing LINQ queries before you incorporate them into your C# programs. If you get stuck as I did at one point recently there is the MSDN Linq forum at http://forums.microsoft.com... where you can ask for help ...
In this Issue: ITLackey, SilverLaw, Max Paulousky, Alex Yakhnin, Paul Sheriff, Douglas, Jeremy Likness, Tomasz Janczuk, Anoop Madhusudanan, Adam Kinney, and Ashish Shetty. Shoutout: If you haven't already seen it, CrocusGirl did a great job of summarizing Day 2 of DevConnections with her Silverlight 4 Launch Notes From SilverlightCream.com: RIA Services - IIS6 Virtual Directory Deployment ITLackey has a post up building on his previous post on Windows Authentication with RIA Services and discusses ...

Here's the material for my introduction on LinQ to Objects at Ottawa's code camp... 

Happy downloading!

http://cid-bdf9cf467011e705.skydrive.live.com/self.aspx/.Public/Blog%20sample%20downloads/Ottawa%20Code%20Camp/Ottawa%20Code%20Camp.zip

 

 

LINQ to Twitter’s goal is to support the entire Twitter API. So, if you see a new feature pop-up, it will be in-queue for inclusion. The same holds for the new X-Feature… response headers for User/Search requests. However, you don’t have to wait for a special property on the TwitterContext to access these headers, you can just use them via the TwitterContext.ResponseHeaders collection. The following code demonstrates how to access the new X-Feature… headers with LINQ to Twitter: var user = (from ...
If for some reason you need to specify a specific connection string for a DataContext, you can of course pass the connection string when you initialise you DataContext object. A common scenario could be a dev/test/stage/live connection string, but in my case its for either a live or archive database. I however want the connection string to be handled by the DataContext, there are probably lots of different reasons someone would want to do this…but here are mine. I want the same connection string ...
Using Entity Framework with ASMX Web Services and WCF Web Service: If you use ASMX WebService to expose Entity objects from Entity Framework... then the ASMX Webservice does not include object graphs, one work around is to use Facade pattern or to use WCF Service. The other important aspect of using ASMX Web Services along with Entity Framework is that the ASMX Client is not aware of the existence of EF v1 since the client solely deals with C# objects (not EntityObjects or ObjectContext). Since the ...
Below are the notes I made in the REST Architecture Session I helped kick off with Andrew. RSS, ATOM, and such needed for better discovery. i.e. there still is a need for some type of discovery. Difficult is modeling behaviors in a RESTful way. ?? Invoking some type of state against an object. For instance in the case of a POST vs. a GET. The GET is easy, comes back as is, but what about a POST, which often changes some state or something. Challenge is doing multiple workflows with stateful workflows. ...
One of my colleague and friend, Robin is playing and struggling with the ASP.NET MVC 2 on a project these days while I’m struggling with a annoying client. Since it’s his first time to use ASP.NET MVC he was meetings with a lot of problem and I was very happy to share my experience to him. Yesterday he asked me when he attempted to insert a <br /> element into his page he found that the page was rendered like this which is bad. He found his <br /> was shown as a part of the string rather ...
One of the things that might be surprising in the LINQ Distinct standard query operator is that it doesn’t automatically work properly on custom classes. There are reasons for this, which I’ll explain shortly. The example I’ll use in this post focuses on pulling a unique list of names to load into a drop-down list. I’ll explain the sample application, show you typical first shot at Distinct, explain why it won’t work as you expect, and then demonstrate a solution to make Distinct work with any custom ...
A Gentle .NET touch to Unix Touch The Unix world has an elegant utility called 'touch' which would modify the timestamp of the file whose path is being passed an argument to it. Unfortunately, we don't have a quick and direct such tool in Windows domain. However, just a few lines of code in C# can fill this gap to embrace and rejuvenate any file in the file system, subject to access ACL restrictions with the current timestamp. using System; using System.Collections.Generic; using System.Linq; using ...
I’m loving my expert F# book – today I thought I would give a post on using mutable records as covered in Chapter 4 of Expert F#. So as they explain the simplest mutable data structures in F# are mutable records. The whole concept of things by default being immutable is a new one for me from my C# background. Anyhow… lets look at some C# code first. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MutableRecords { public class DiscreteEventCounter { ...
Recently, I started working on a new ASP.NET MVC 2 project and I wanted to reuse the data access (LINQ to SQL) and business logic methods (WCF RIA Services) that had been developed for a previous project that used Silverlight for the front-end. I figured that I would be able to instantiate the various DomainService classes from within my controller’s action methods, because after all, the code for those services didn’t look very complicated. WRONG! I didn’t realize at first that some of the functionality ...
Fellow Blog Readers: I figured I use my first blog post on GeeksWithBlogs to introduce myself. I recently relocated from Long Island, NY to South Florida where I joined a local company as Software Engineer specializing in technologies such as C#, ASP.Net 3.5, WCF, Silverlight, SQL Server 2008 and LINQ, to name a few. I am an MCP and MCTS ASP.Net 3.5, looking to get my .Net 4.0 certification soon. Having been in industry for a few years so far, I figured I would share with you my take on the importance ...
.Last time I showed you how to get started building extensions for Expression Blend. Lets build a useful extension this time and go a bit deeper into Blend. Source of project => here Compiled dll => here (extract into /extensions folder of Expression Blend) The Extension When working on large Xaml files in Blend it’s often hard to find a specific control in the "Objects and Timeline Pane”. An extension that searches the active document and presents all elements that satisfy the query would ...
Eager loading with EF To Do Eager loading use Projections (for e.g. : 1: var custWithAddresses = from c in context.Contacts 2: where c.LastName == "Gupta" 3: select new {c, c.Addresses} or use Include Query Builder Methods (Include(“Addresses”)) 1: from c in context.Contacts.Include("A... 2: select c; If there is multi-level hierarchical Data then to eager load all the relationships use Include Query Builder methods like customers.Include("Order.Or... to include Order and OrderDetail ...
I stole that from the back of a T-shirt I saw at the Orlando Code Camp 2010. This was my first code camp and my first time volunteering for an event like this as well. It was an awesome day. I cannot begin to count the “aaahh”, “I did-not-know I could do that”, in the crowds and for myself. I think it was a great day of learning for everyone at all levels. All of the presenters were different and provided great insights into the topics they were presenting. Here’s a list of the ones that I attended. ...
In this post, we are going to look into implementing lists into our twitter application and also about enhancing the data grid to display the status messages in a pleasing way with the profile images. Twitter lists are really cool feature that they recently added, I love them and I’ve quite a few lists setup one for DOTNET gurus, SQL Server gurus and one for a few celebrities. You can follow them here. Now let us move onto our tutorial. 1) Lists can be subscribed to in two ways, one can be user’s ...
In this post, we will look at implementing the following in our twitter client - displaying the profile picture in the home page after logging in. So to accomplish this, we will need to do the following steps. 1) First of all, let us create another field in our Global variable static class to hold the profile image url. So just create a static string field in that. public static string profileImage { get; set; } 2) In the Login.xaml.cs file, before the line where we redirect to the Home page if the ...
FredNUG is pleased to announce that we have an excellent speaker lined up for April. On April 20th, we’ll start with pizza and social networking at 6:30 PM. Then, starting at 7 PM, Dane Morgridge will present “Getting Started with Entity Framework 4” The scheduled agenda is: 6:30 PM - 7:00 PM - Pizza/Social Networking/Announcements 7:00 PM - 8:30 PM - Main Topic: Getting Started with Entity Framework 4 with Dane Morgridge Main Topic Description: Getting Started with Entity Framework 4 With .Net 3.5 ...
Time for another guest post (check out others in the series), this time bringing together the world of mocking with the world of Entity Framework. A big thanks to Moses for agreeing to do this. Unit Testing Entity Framework Dependent Code using TypeMock Isolator by Muhammad Mosa Introduction Unit testing data access code in my opinion is a challenging thing. Let us consider unit tests and integration tests. In integration tests you are allowed to have environmental dependencies such as a physical ...