Tag | LINQ Posts

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 ...
This week is my final entry in my Little Wonders series (posts one and two are here and here). These are those little tips and tricks in .NET (and in particular C#) that may not seem like much, but can help make your code either more concise, maintainable, or performant. Thanks again for all your comments and suggestions on this series, it has been a lot of fun to write, and though I feel I could go on forever with lots more tips and tricks, this will be the last Little Wonders post for a while. ...
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 ...
Let’s develop a SharePoint WebPart for executing BAM SSIS Packages. The SharePoint site can be on remote server other than the BizTalk Database Server. This won’t be a fancy UI WebPart, just a basic dropdown to select a BAM SSIS Package and execute it. ;-) The approach I am used is of using a asp.net User Control hosted as a sharepoint webpart. There are bunch of different ways you can develop Sharepoint webpart. This is just one of them and easier one. Less error prone and easily debug able. · Create ...
Some of the new Features in EF v4 are : context.ContextOptions.Lazy... is “true” by default. What this means is that if you access a Navigation Property (which returns either a EntityCollection or a EntityReference) of an Entity and if that Navigated Entity (or Entity collection) is not found in the ObjectContext then the ObjectContext automatically loads it when the NavigationProperty is accessed. This means additional round trip to the database for each Navigated entity. If you need ...
It seems like typed datasets provide the same type of object layout as the entity framework. What's the difference and why should I use one or the other? We'll start at the fundamental difference: DataSets give you a basic in-memory database that you can query and fill from a data source such as a database. Queries against datasets are executed against in-memory data. Entity Framework gives you a translation layer that translates LINQ queries to your database's SQL dialect. Queries against the EF ...
A couple of days ago I was playing around with Silverlight 4. Amazing platform, especially since they now support multi-touch events. But before you can run, you’ve got to learn how to walk, right? So, in order to learn some of the new capabilities of the platform I decided to make an application to keep track of all my contacts. I know, there are numerous applications out there that can peform that task much better, but I didn’t want to create a usefull program, I just wanted to have a ‘real’ project ...
In this Issue: Vibor Cipan, Chris Klug, Pete Brown, Kirupa, and Xianzhong Zhu. Shoutouts (thought I gave up on them, didn't you?): Jesse Liberty has the companion video to his WP7 OData post up: New Video: Master/Detail in WinPhone 7 with oData Michael Scherotter who made the first Ball Watch SL1 app back in the day, has a Virtual Event: Creating an Entry for the BALL Watch Silverlight Contest... sounds like the thing to do if you want in on this :) Even if you don't speak Portuguese, you can check ...
When I was working on the TalentOn project (Promotion in MSDN Chinese) I was asked to implement a functionality that makes the top menu items highlighted when the currently viewing page was in that section. This might be a common scenario in the web application development I think. Simple Example When thinking about the solution of the highlighted menu items the biggest problem would be how to define the sections (menu item) and the pages it belongs to rather than making the menu highlighted. With ...
so i figured this one out, as a newcomer to the web development scene from the telecom biz, where we dealt with low level hardware API's, and a C++ fanboy, i tend to be bothered by automagical code, yes i appreciate the effort that went into it, and i certainly appreciate the luxury it provides to get more things done, but i just don't get it. so i decided to change that, and start investigating the new MVC based web apps, and at first it was like hitting a brick wall, i knew MVC from MFC days, so ...
LINQPad is a great way to learn LINQ: it comes loaded with 500 examples from the book, C# 4.0 in a Nutshell. There's no better way to experience the coolness of LINQ and functional programming. LINQPad is more than just a LINQ tool: it's an ergonomic C#/VB scratchpad that instantly executes any C#/VB expression, statement block or program with rich output formatting – the ultimate in dynamic development. Put an end to those hundreds of Visual Studio Console projects cluttering your source folder! ...
I read through Ron Jacobs post on Monitoring WCF Data Services with AppFabric http://blogs.msdn.com/b/end... What is immediately striking are 2 things – it’s so easy to get monitoring data into a viewer (AppFabric Dashboard) w/ very little work. And the 2nd thing is, why can’t this be a WCF message inspector on the dispatch side. So, I took the base class WCFUserEventProvider that’s located in the WCF/WF samples [1] ...
After my previous blog on a Generic Boolean Value Converter I thought I might as well blog up another IValueConverter implementation that I use. The Generic Boolean Value Converter effectively converters an input which only has two possible values to one of two corresponding objects. The next logical step would be to create a similar converter that can take an input which has multiple (but finite and discrete) values to one of multiple corresponding objects. To put it more simply a Generic Enum Value ...
In my previous blog I wrote an introductory post on services and how you can build services using the .NET frameworks Windows Communication Foundation (WCF) In this post I will show how to develop a real world application using WCF The problem During the last meeting we realized developers in Uganda are not so cool – they don’t use twitter so may not get the latest news and updates from the technology world. We also noticed they mostly use kabiriti phones (jokes). With their kabiriti phones they ...
short answer: Quite probably, as SQL Azure is very similar to SQL Server longer answer: Object Relational Mappers (ORMs) that work with SQL Server are likely but not guaranteed to work with SQL Azure. The differences between the RDBMS versions are small – but may cause problems, for example in tools used to create the mapping between objects and tables or in generated SQL from the ORM which expects “certain things” :-) More specifically: ADO.NET Entity Framework / LINQ to Entities can be used with ...
[Source: http://geekswithblogs.net/E... Recently I've been putting together a generic approach for paging the response from a WCF service. Paging changes the service signature, so it's not as simple as adding a behavior to an existing service in config, but the complexity of the paging is isolated in a generic base class. We're using the Entity Framework talking to SQL Server, so when we ask for a page using LINQ's .Take() method we get a nice efficient SQL query for just the rows we want, ...