Tag | LINQ Posts

So I had a great time at this past weekend's Central Maryland Code Camp (CMAP). I was honored that the organizers chose two of my talks for their schedule (Intro to Threading and A Beginner's Guide to LINQ). I have to admit that I didn't manage my time very well with the Intro to Threading talk; and, as a result, I didn't really get to my favorite code samples. But I feel like I came back strong with my LINQ talk and managed the clock pretty well. We'll see when the evals come in. My session materials, ...
The C# Programming Language, Fourth Edition by Anders Hejlsberg, Mads Torgersen, Scott Wiltamuth, and Peter Golde Publisher: Addison Wesley (Special Annotated Edition for C# 4.0) I can honestly say I have had a copy of this book for each edition it was published. I love this book and have always loved it. Ever since Microsoft stopped publishing the White Reference Guides we used to all have back in the day, Addison Wesley has became my reference book dealer. These White cover books with the most ...
My coworker John Sonmez had a great blog post recently illustrating how to refactor a switch statement. In short, he outlined how to take a switch statement covering all known values of a C# Enumeration and convert it into a Dictionary “map” object allowing you to quickly determine what action to take given any valid enumeration value. I really like this approach as I think it leads to more readable code. The one thing that’s always bothered me about enumerations though is that they can change with ...
I didn’t go to the Microsoft’s PDC Professional Developer’s Conference (PDC) this year because it was, as far as I could tell, a made-for-streaming video event. As such, I watched the keynote about 24 hours after it took place and used my Media Center PC to watch it on my plasma television. And I have to say, the keynote was worthy of the medium. Not only did the Silverlight Smooth Streaming technology deliver a fine HD image, but the content of the keynote itself, merited a big screen, and necessitated ...
If you are like me, you may have been surprised when you read the MSDN documentation for System.Activities.Statement... A Parallel activity operates by simultaneously scheduling each Activity in its Branches collection at the start. It completes when all of its Branches complete or when its CompletionCondition property evaluates to true. While all the Activity objects run asynchronously, they do not execute on separate threads, so each successive activity only executes when the previously ...
I had the opportunity to return to the Patterns and Practices Summit this year for the second time. The first time was in 2008, and they managed to plus that experience this year. All of the technology was on track, and par, for what Microsoft has been pushing toward us - 2010 being a huge year for major releases as well as out of band stuff. The presenters did an awesome job presenting and here are/were my favorites for this year. Monday (Workshops) Azure (@ScottDensmore, Eugenio Pace (think Pa-ch`ay) ...
At a high level, this is how I understand the different MVC tiers: Model: Data libraries such as entities, Linq to SQL classes, or any other data library. View: The .aspx/.ascx pages. The classic ASP style code goes here. I have heard this layer referred to as a ‘report’ where you have as little logic as possible, and only that related to the display of the page. Controller: If you are coming from ‘standard’ ASP.Net and are new to MVC, You could say the controller is what replaces the code behind. ...
After I posted my last blog post, Ralph Squillace responded with a link that everyone that is doing OData/WP7 development should be aware of. 2 days before I posted my Data/WP7 post, Microsoft's Mike Flasco posted this regarding the changes that are coming in the RTM version of the Windows Phone 7 library. The current WP7 phone platform is missing some core types, types that data service client LINQ provider requires to function properly. The CTP that is currently available (and which my example ...
I received (by chance, mostly) a Netduino last tuesday. Netduino is an open-source hardware project based on Arduino and the .Net Micro Framework. And it’s extremely cool. I’m a C# developer and I was always interested in electronics. This is an excellent tool to start to understand that incredible world. I was about to buy an Arduino when the Netduino fell on my lap, so I was really happy about it. Netduino has various disadvantages over Arduino (for starters, it’s more expensive, not all the shields ...
There was a bonus second Virtual Brown Bag meeting this week - The boys from Texas had a lunch meeting at the Houston TechFest, and shared it via LiveMeeting. This week's topics: Tools for "a more readable web": InstaPaper and "Readability" Favorite things learned at VBB meetings George Mauer discussed some advanced LINQ methods: SelectMany and Aggregate Links and video recordings: Thursday's meeting: https://sites.google.com/si... Saturday's meeting: https://sites.google.com/si... ...
Our West Palm Beach .Net User Group will be honored to have Scott Klein, Microsoft MVP and Author of Pro. SQL Azure (APRESS) as our October speaker. Scott will be talking and answering all our questions about Azure. Time has never been better for our Fladotnet West Palm Beach .Net User Group. We are fortunate to have a free meeting location offered to us by CompTec and to enjoy the backing and sponsorship of many top notch companies. This support is enabling us to uphold our founders’ vision: Create ...
Extension methods were introduced with the .NET 3.5 framework as a mechanism to add methods to extend existing types without modifying the original assembly. This is how the Linq methods were implemented to enable some very powerfull predicate function based operations to be performed over all existing collection types. Searching for web controls on a page is one of those tasks that seems to come up for all kinds of reason while programming using web forms. I was reminded of this problem recently: ...
Yesterday, I released LINQ to Twitter Beta v2.0.14. This includes entities, bug fixes, and the new Raw Queries feature. Please visit the LINQ to Twitter page for more info: http://linqtotwitter.codeplex.com/ Joe
Today, I added a new extensibility feature to LINQ to Twitter, called Raw Queries. The Twitter API has historically changed suddenly and without warning, leaving 3rd party libraries, such as LINQ to Twitter deficient in full support. On occasion, LINQ to Twitter encounters bugs that leave users without a means for accomplishing specific tasks. Therefore, we need work arounds to allow users to quickly adapt to changes and new features. Raw queries include two points of extensibility: the ability to ...
This article will demonstrate how to add, edit, delete, group, sort, filtering data using ComponentWays Silverlight xamlDataGrid and RIA Services (DomainDataSource). Content Starting a New Project Exposing Data from Entity Framework Consuming Data in the Client with DomainDataSource and xamlDataGrid CRUD: Add, Edit, View, Delete data Validating Data Persisting Data and Error Handling Grouping Data Sorting Data Filtering Data Summary Starting a New Project Create a new Silverlight Application (C# ...
One of the things I really wanted to do lately was to get SQL Azure, OData, and Windows Phone 7 working together; in essence, expose SQL Azure data using the OData protocol and consume that data on a Windows Mobile Phone 7 device. This blog will explain how to do just that. This example is also in our SQL Azure book in a bit more detail, but with the push for WP7 I thought I'd give a sneak-peak here. You will first need to download and install a couple of things, the first of which is the OData client ...
The BizTalk Server team announced today that BizTalk Server 2010 has RTMd. That's a relief, as my reputation was on the line regarding RTM before the end of the month. Just this Tuesday I confidently told a prospective customer to expect an imminent announcement. I've been playing with BTS 2010 for a little while now. It has been my constant companion while writing several chapters for the forthcoming BizTalk Server 2010 Unleashed. It looks great. As well as bringing BTS up to date with Visual Studio ...
Model Functionality · Support for Enums for property types from lookup tables · Allow default date = DateTime.Now - The only way to set a default date in the entity data model is to put a hard date in there, a string. If you have a known default date (e.g. 1900-01-01) this is fine. But often we want NOW to be the default and there's no way to indicate that in the model. · Support for System.IO.Stream instead of Byte[] for varbinary type of fields · Support GUID as Entity Key -http://leedumond.com/blog/... ...
Integrate RIA and Data Services why do we need 2 high level service abstractions? DataSources · Aggregate and expose entities from multiple sources including other RIA / Data Services OData · Navigation Properties on Derived Types · Any / All LINQ Operators · OData Binary Serialization Format - Provide support for a binary wire format (to supplement JSON/ATOM). · Containment / Hierarchical Models - If I have a schema that has Orders and OrderDetails, I dont want /OrderDetails to be direclty accessible. ...
This is good to know, strange solution but it works: http://social.msdn.microsof... I created an Interface that my Linq to SQL classes implement so that I can create a generic function that will work across a few tables. When I used the double equals (==) instead of the .Equals() in my LINQ query I got the runtime exception: The mapping of interface member [...] is not supported. Changing my query up to use the .Equals() it runs ...
Recently we had a project where we needed to render certain questions on the screen dynamically based on answers to previous questions on previous screens. For questions that need to dynamically be visible/invisible on the same screen, this can simply be controlled with jQuery. However, in this case, based on the user’s input on previous screens we know there are certain questions that will not be applicable before the current screen even loads. In this case, we could use jQuery to set those questions ...
Technorati Tags: Linq,Enumerable.Range,Inter... Basic,VB MSDN Reference: Enumerable.Range Method I deal with a lot of RANGES at work for a multitude of reasons. When auditing data and databases, it’s often necessary to check the boundaries of values or to set them. I’ve recently become very fond of Enumerable.Range because it offers a lot of convenience when dealing with certain types of ranges and can allow a fair amount of complexity. For instance: If I need to represent ...
While working to get the AutoCompleteExtender control up and running in a custom DNN module, I ran across a forum post that said doing so "just works", which if you have previous ASP.NET AJAX experience and know what is and isn't in DNN is probably very true. Trying to get it to run for the first time though, there's a few items to be aware of. Getting Started First recommendation, go download Fiddler (http://www.fiddler2.com/fi... like now... no seriously go download it. If you are running ...
C #4.0 has been here for a while and it has got many interesting features. 1. dynamic keyword: It represents an object that will be resolved at run time. For example, assume that you have 2 different classes that have the same signature. Then you can have a method like this. private void TestMethod(object myObject) { string name = myObject.Name; string address = myObjec.Address; } Now you can pass any object that has the same interface to the TestMethod(). This is some thing which is not possible ...
With Pete's guidance, it will feel like you have that super-smart coworker in your cubicle at all times. A new Silverlight 4 book is coming out on September 7th and I had a chance to review it before it hits shelves. After reading the book and some chapters multiple times, I can tell you that this is the best book for a developer wanting to learn Silverlight 4. If you are wondering if you should buy the book or not then let me answer that right now. YES. I would definitely recommend this book to ...
In part 1 of Crack .Net Applications I demonstrated how easy it was to reverse engineer an an unprotected .Net application. In this post my aim is to highlight a few techniques that one can employ to protect ones code from this type of hacking. So, my take on software protection is that one can never be 100% protected – given infinite time you can guarantee someone with enough intelligence will be able to bypass all security measures that you ever implement – that being said, we don’t have infinite ...
I’m gearing up to take the 70-516 exam, which focuses on ADO.NET, EF, LINQ, and XML as it relates to .NET 4.0 and VS.NET 2010. My exam is scheduled for Friday, although I had thought about moving it. Busy work/family life has meant my best intentions of studying haven’t happened. When I looked at the availability for when I could move my exam though, the earliest was in early October (we only have two Prometric test centers here in Winnipeg…before a month ago or so we only had one). So I’m gonna ...
this year I had the pleasure of cramming the following information into my lobes: Book: Schuams Graph Theory - http://www.amazon.com/Schau... - a subset of combinatorics. From my perspective, just use linear algebra - you can bash anything into vectors. some interesting stuff on platonic solids and the 3 color world map. SD - shortest distance SP - shortest path bipartite graph - 2 disjoint sets ...
This is the first in a several part posting about T4-Toolbox. More to follow You landed here because you're interested in code generation, working faster, generating uniform code, forestalling corpal tunnel syndrome, etc. But perhaps, you need convincing it's worth the effort What's the difference between this class: public partial class Evaluation : KeyedObject { public virtual string Description { get; set; } public virtual Guid EvaluationTypeId { get; set; } public virtual decimal Bias { get; ...
I found it very odd that this was not available when doing some search engine queries. My requirement was to take in an AD user name and query SharePoint 2010 to determine the SharePoint groups in which the account belongs. The code was to run from within a RIA Authentication Service, which is code run on a server and is not likely on the SharePoint server. This code will also work with SharePoint 2007 (WSS 3.0 and MOSS 2007). You will need to add a Web Reference to http(s)://<spservername&... ...
Since I published the state of my project goals, I got a few questions about my repository implementation, so here goes… The ‘classic’ repository interface looks like this: public interface IRepository<T> { T GetById(int id); IEnumerable<T> GetAll(); T SaveOrUpdate(T entity); void Delete(T entity); //... } This interface has some issues to me. First of all, it’s data-centric. I know that’s the whole point of a repository, but bear with me. Second, it exposes far too many methods. One ...
Technorati Tags: .NET,C#,Jon Skeet I'm really looking forward to the second edition of Jon Skeet's C# in Depth book, which should be printed in September. I took advantage of this "SkeetTweet" from yesterday: 45% off C# in Depth 2nd edition (http://manning.com/skeet2) - use coupon msa1145 at checkout. Valid until August 17th. …to pre-order the printed book, plus "Manning Early Access Program" access to PDFs of chapters from the work-in-progress, plus a PDF copy of the complete first edition, all ...
In this Issue: Max Paulousky, Jeff Fansler, Xianzhong Zhu(-2-), Anton Polimenov, Braulio Díez Botella, Alex Yakhnin, Willem Meints, Shawn Hargreaves, John Papa, and Roger Peters. Shoutout: I found this via Mike Taulty, and it's pretty darn cool: zoom.it from LiveLabs, and I did one of my blog From SilverlightCream.com: Visual Studio Solution Pivot Viewer. Add-on for VS2010 to Visualize Code Structure Max Paulousky has a post up about a VS2010 add-in that uses just too much of the goodness we all ...
I’ve had to create a couple of Extensions for the ObservableCollection, (well – I didn’t have to), erm, and so here they are! All are ‘AddRange’ just with different args for different usages.. namespace Extensions { using System; using System.Collections.Generic; using System.Collections.ObjectMo... using System.Linq; /// <summary>Extension methods for the <see cref="ObservableCollection{... class.</summary> public static class ObservableCollectionExtensions { /// <summary>Adds ...
One of my colleagues pointed me at Howard Baines as a recent example of a web consultancy already using Visual Studio 2010 and Entity Framework 4.0 to build web applications. I managed to grab a little time with co-founder Clive Howard (on twitter) to talk through some of the decisions, especially as I was intrigued to learn that they started out on Open Source Software including Ruby on Rails before switching to the .NET Framework. We discuss: Why switch to the .NET Framework? Entity Framework 4.0 ...
Microsoft Silverlight 4 Step by Step (click book logo to be taken to the Catalog Page) By: Laurence Moroney Publisher: Microsoft Press Pub. Date: June 30, 2010 Print ISBN-13: 978-0-7356-3887-7 Pages in Print Edition: 336 I decided to do my first review with the new Silverlight 4 Step by Step book from Microsoft Press. I have read the entire book and completed all of the exercises. I have found several errors in the book’s code, but they were not hard to figure out. Instead of writing a formal book ...
I have spent some time, around all 6 of the SharePoint 2010 data access technologies 1. Using SharePoint standard web services 2. SharePoint Client Object Model 3. Silverlight SharePoint Client Object Model 4. Data Services Client Model 5. OWSRV.DLL 6. SharePoint Object Model Silverlight is a client application so the data access technologies applicable are: 1. SharePoint web Services 2. Silverlight Client Object Model 3. Data Services Client Model 4. OWSSRV.DLL These 4 have many features in common ...
Some of you may have come across this helpful blog post recently, discussing when the garbage collector (a/k/a the GC) runs on Windows Phone 7 devices. Anyone who has programmed in XNA for the Xbox 360 before knows the GC well. For those of you new to XNA, there are several tricks and tips for slaying the evil GC monster that eats frames. This applies to Silverlight apps too, though since Silverlight does quite a lot for you automatically, there’s only so much control you have. First, you must leave ...
Can Event-Based Components (EBC) be used to design libraries? Sure they can. FallenGameR asked a question along this line in response to my previous article. Let me demonstrate this with a simple library scenario: A function ToDictionary() is to be developed which converts a string like “port=8080;user=bart;passwo... into a Dictionary<string, string>. The usage should be like this: var td = new StringToDictionaryConverter(); var dict = td.Convert(“port=8080;user=... or var dict = new Dictionary<string, ...
Shay Friedman, author of IronRuby Unleashed (check out my review) kindly agreed to do a guest post on my blog. He explores how IronRuby can be very useful to a .NET developer, even if that developer is a die hard C# or Visual Basic developer who has no plans (Surely not! ) to use IronRuby in finished products. The power of an Interactive Console should not be underestimated – it can give you tremendous productivity gains, which is why I also recommend http://linqpad.net/ to offer similar behaviour ...
Time for me to evaluate the progress on the original goals of our project. In januari, I started on a new project and set myself/the project a few goals. These goals were explicitly written down in a previous post. We've now finished phase 1 of the project, and I took the time to see what's left of my new year's resolutions.What's the point?I believe that you can only improve and learn new things when you deliberately set yourself explicit goals. Publishing these goals for all to see has been a major ...
Back in January, Jeremy Miller posted a nice article on HtmlTags: Shrink your Views with FubuMVC Html Conventions. We were immediately in love with the idea and have spent several months adapting the conventions to work with our ASP.Net MVC applications. I was having a conversation with Ryan recently, reflecting on how far we’ve come and how we had no vision of that when we first read that article. I want to share some of that, so I will be working on a series of blog posts to show “What we are doing ...
I installed VS 2005 on my machine.. and later I installed a few Extentions for .Net framework 3.5 (LINQ, AJAX etc). Later I come up with a requirement to convert a website into WebApplicationn I did it earlier so I was sure It will be done by installing Web Application Project Addin by Microsoft. Unfortunately it did not work and I cound not found the reason. I tried many ways but no success infact I get VS 2005 updated by installing it again. I found the below resolution from http://blogs.msdn.com/b/ast... ...
Next week Thursday I will be speaking at MvcConf. This is a virtual, free conference that has attracted some very heavy hitters MVC hitters to come and chat about their voodoo. This should be interest sting. http://mvcconf.com/ Below is the abstract and TOC for my presentation. If you think I missed something or am watering down the presentation please feel free to contact me to give me your suggestions. Abstract In this session we will take a look at a handful of common ways that MVC applications ...
An article was published at JupiterJS.com (titled “JavaScript vs Silverlight”) arguing that JavaScript is better than Silverlight. Unfortunately, there is no way to post comments on that page (weird, really) so I decided I would post my answer here. Read the rest of this entry » ...
[Source: http://geekswithblogs.net/E... Normal 0 false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; mso-pagination:widow-orphan; font-size:11.0pt; mso-bidi-font-size:10.0pt; ...
This week, Scott Guthrie, Corporate Vice President at Microsoft’s Developer Division, announced, via blog post, the early Beta release of a new tool called WebMatrix. WebMatrix is a free developer tool that enables Web development geared toward what might I might call Markup-and-Script developers (more on that in a minute). And although WebMatrix draws upon technologies already, or soon to be, present in the fuller ASP.NET Web development platform and the Visual Studio integrated development environment ...
Following a Data Transfer Pattern, you are often faced with having to convert a list of Entities to a list of Data Transfer Objects (DTO). A common strategy is to provide a GetDto() method in the base class for the Entities. This leads to a conversion process similar to: foreach (var entity in ListOfEntities) { ListOfDTOs.Add(entity.GetDt... } While this works it is a little clutzy and cumbersome, especially considering the alternative. This can be converted to a LINQ expression as var ListOfDTOs ...
I have recently started playing around with linq syntax. It can produce some very beautiful syntax. Of course, it can probably also produce equally ugly ones. I recently played around and built this one lines for retrieving the values for all of the readable properties in a object. var values = (from prop in value.GetType().GetProperti... where prop.CanRead select new { Name = prop.Name, Value = prop.GetValue(value, null) }); This allows us a single statement to retrieve name / value list for all ...
I have moved this project from CodePlex to GitHub at https://github.com/danemorg... I have a posted a project on Codeplex at http://efrepository.codeple... It is a T4 template to give you a data layer that follows Repository and Unit of Work patterns that is also ready for Dependency Injection (DI). DI frameworks allow you to build code that is more testable and allows for a greater separation of concerns (SoC). This is not the only use for them, but it is a big one and what they are ...