Archives
-
WCF RIA Services – Dynamically create a criteria on the client-side
Note: This post is based on the WCF RIA Services VS 2008 PDC Beta and VS 2010 Beta 2 preview, changes can be done before the framework hits RTM.
-
WCF RIA Services DomainService life-cycle and adding Transactions
Note: This blog post will use the WCF RIA Services PDC Beta and VS2010 Preview, changes to the framework can me made before it hits RTM.
-
Solution to minimize the loading of too much data to a DataGrid– WCF RIA Services and Silverlight
Note: The WCF RIA Services examples in this post is based on the WCF RIA Services PDC Beta for VS 2008 and VS 2010 Beta 2 Preview.
-
Silverlight exception handling using WCF RIA Services and WCF Services
Note: Some examples in this post uses the WCF RIA Services PDC Beta, so changes can be done until it hit RTM.
-
WCF RIA Service – How to configure the WCF Service maximum items returned by the Query
Note: This is post is based on the WCF RIA Services Beta for VS 2008 and the Preview bits for VS 2010 and changes can be done before WCF RIA Services hits RTM.
-
WCF RIA Services Exception Handling
Note: The examples in this blog post are based on the WCF RIA Services PDC beta, and changes to the framework can be done until it hits RTM.
-
RIA – Should a service return the IQueryable<T>?
Note: The examples in this blog post uses WCF RIA Services PDC Beta, and changes can be made in the future to the framework.
-
WCF RIA Services – StructureMap – DomainServiceFactory
Note: The example in this blog post uses the WCF RIA Services PDC Beta, so things can be changed to the final version.
-
Silverlight 4 - MVVM with Commanding and WCF RIA Services
Note: The code example in this post uses Silverlight 4 PDC Beta and WCR RIA Services PDC Beta, so some changes can be made before RTM.
-
WCF RIA Services Unity DomainServiceFactory
Note: This post is based on WCR RIA Services PDC beta and changes can be made in a future release.
-
WCF RIA Services and a guide to use DTO/”Presentation Model”
NOTE: Examples in this blog post is based on the VS 2010 Beta 2, WCF RIA Services PDC Beta, some changes to the WCF RIA Services can happen until RTM.
-
WCF RIA Services Binding Deep dive
Note: This is based on WCF RIA Services beta, and some stuffs can change in a future release.
-
Refresh the cached EntitySet after a SubmitChanges – WCF RIA Services
Note: This post is based on the WCF RIA Services PDC Beta.
-
Using the WebBrowser control and debug a Silverlight Out-of-browser (OOB) application in VS 2010
Yesterday I played with the WebBrowser control shipped with Silverlight 4. I was trying to create a little RSS Reader for Silverlight 4, only to try out some of the new features. The WebBrowser control have two methods to display a web page, the Navigate and the NavigateToString. The Navigate takes an URI, the NavigateToString takes a string with for example HTML to be diplsyed inside of the WebBrowser window. In my case I didn’t want to use the Navigate, instead the NavigateToString so I could just grab some RSS feeds and get the body of a post and pass it to the WebBrowser control. First of all I notice that the WebBrowser control will only work in a Out-of-browser application, if we try to use it in a browser we will se the following:
-
Silverlight 4 and Asynchronous Validation with INotifyDataErrorInfo
During this week I helped a company with the design of a RIA with Silverlight. In the existing Web and Window Forms application they have a form where the users can enter an account id (or was it a customer id ;)). When they leave the TextBox they did a check if the account id already exists or not. They use their own way of showing the validation message. Now in the new application they want to use the red boxes showed up in Silverlight when a validation fails. In Silverlight 3 the validation only showed up if the bounded property of a TextBox thrown an exception in the set method. It’s not easy to manually trigger the nice red validation message box for a specific control outside the set method of a bounded property. Every call to the service layer from the Client should be asynchronous and in that way the callback can’t trigger the validation error box. With Silverlight 4 it’s now possible to notify when a validation fails when an async. method is completed. This is thanks to the INotifyDataErrorInfo interface. This interface can be used to notify the UI when an validation fails, and that can be done outside the set method of a property, for example in a async. callback method. The INotifyDataErrorInfo has the following members:
-
WCF RIA Services – What you need to know when creating DTO/Presentation Model
Note: This is based on the WCF RIA Services Beta, so the code in this post can change in a future release of the framework.
When defining DTO or a “Presentation Model” (Not the Presentation Model pattern by Martin Fowler, a model suited for presentation purpose, not all entities are) there are things you may want to now. The following is an simple DTO: -
WCF RIA Services and DTO with association
This post will be short, I notice that some people are asking about how to send an object graph which will include an association to other objects. First of all, be careful with the distribution of an object graph, wrong design can affect performance in a way that to much data is passed over the wire.
Here is an simple Order class, this class has OrderRows: -
Silverlight 4 Commanding enables ViewModels
One feature out of many really great feature shipped with Silverlight 4 Beta, is Commanding. With Commanding we can use the MVVM (Model View View Model) Pattern. Commanding is something that WPF has and preview Silverlight doesn’t. Commanding can only be used on ButtonBase controls and Hyperlink control at the moment, and will only be executed by the Click event. In this post I’m going to show how you can use the new Commanding feature and create use the MVVM pattern in Silverlight 4. Here is my simple UI:
-
Is WCF RIA Services ready for the Enterprise?
Today Microsoft released the WCF RIA Services Beta, it’s now on top of WCF and by default uses binary data end points and data contract serialization. By using binary data end points we will get better performance and make the data sent over the wire smaller (The other preview versions uses pure JSON). WCF RIA Services is a great framework for Rapid Application Development (RAD) of 2-tier applications. Based on the new changes to the WCF RIA Services it’s defiantly ready for the Intranet and small applications, but how about the Enterprise. First of all if you uses the Entity Framework or Linq to SQL Domain Services, it’s not ready for the Enterprise and will never be, IMO, because when we use it it distribute DAL types to the client. They are useful for small data driven applications. BUT! WCF RIA Services with the DTO (Data Transfer Object) support will make it closer to be ready for the Enterprise, but is that enough?
-
How to create a Module based Silverlight application (Part 1)
When building RIA (Rich Internet Application) with Silverlight, it’s important to make sure the Silverlight application is loaded as fast as possible. Users don’t like to see a splash screen for several seconds or minutes, they want an application to start directly. One way to make a Silverlight app load fast, is by minimizing the XAP file, this can be done by not adding to much images, videos or other files to the Silverlight application project. If we have a large application, we can also split the application into small “modules”, for example assemblies or .XAP files. We can then load them on demand when they are needed. The base application can be kept small and be the core engine for the other modules. In this first part of my blog post I will add some examples how we can split our Silverlight applications into modules, and load them on demand asynchronous. The next part will be about how to use MEF (Managed Extensibility Framework) to create module bases Silverlight application.
-
Fluent-API to add ActionFilters to Controllers – ASP.NET MVC Part 3
The latest source code for my Fluent-API to add Action Filters to Controllers is no available here. If you haven’t read about my test project, you can find the other posts here:
-
.NET 4.0 is so Lazy
With .NET 4.0 there is a new class added to the System namespace called Lazy<T>. This class is what the name says, lazy. Here is an example where Lazy is used:
-
Fluent-API to add ActionFilters to Controllers – ASP.NET MVC Part 2
I’m working with my Fluent-API for adding Action Filters to Controllers and Action Methods. In my previous post, I created a new instance of each Action Filter and add it to an Action Method or Controller. Based on how the Action Filters are often implemented they don’t or shouldn’t keep any state, so in that case I don’t need to create a new instance of the same Action Filter with the same configuration for each Action Method I want to add it to. I also want to have an option to have a better overview of which Action Filter is added to which Controllers and Action Methods. I have added to methods, AddFilterToControllers and AddFilterToActions:
-
Fluent-API to add ActionFilters to Controller in ASP.NET MVC
Note: The name of the classes and the methods are just temporary and may change, I’m so bad when it comes to naming classes and methods. The source code is simple and haven’t done so much refactoring etc. Just wanted to see if I could get it to work, so please have that in mind.
-
Visual Studio 2010 Launch Countdown Sidebar Widget
<style type="text/css">
-
Introduction to Templates in ASP.NET MVC 2 Screen cast
I have recorded some screen casts during the last week for Microsoft, one is was published today on Channel 9 (The Screen cast is in Swedish, I will eventually try to record screen casts also in English, but when that happens, I don’t now). You can found the screen cast here:
http://channel9.msdn.com/posts/MSDNSweden/Introduktion-till-Template-i-ASPNET-MVC-2/ -
Distributing domain entities over the wire
When we design our domain entities we don’t have a presentation layer or database in mind. The domain entities are core business objects located on the server or client side based of what kind of application we are building. Domain entities aren’t designed for distribution. When we realize that we need a distribution, we shouldn’t distribute the entities, instead collect the data we need to distribute and create a data transfer object (DTO) instead. Have the network in mind, a domain entity aren’t designed with a network in mind and of that reason not suitable for distribution. When we create our domain entities, they aren’t designed for presentation purpose, they are designed to fulfill business needs. You should be careful when you start thinking about returning a domain entity to the View when using a patterns like MVC, instead use DTO or a ViewModel, because once again the domain entities aren’t designed with presentation in mind, and aren’t often suitable for presentation purpose. It’s often better to map them to a DTO or ViewModel, objects that are suitable for presentation purpose or passed over the wire.
-
VS 2010 Beta 2 and .Net 4.0 is now available for downloading from MSDN Sub.
Oh, I'm late.. but better late then never.. you can now download VS 2010 nad .Net 4.0 Beta 2, if you are a MSDN Subscriber.. You can read more about VS 2010 Beta 2 on Scott Guthrie's blog.
-
ASP.NET 4.0 Web Form routing
One of hundreds things I like about ASP.NET MVC, is the routing, a way to use clear and friendly URLs like: www.server.com/Customer/List, instead of something like www.server.com/Customers.aspx.
-
Some features I love in VS 2010
This post will not be so long, I want to write a little about some Visual Studio 2010 features I love. First of all the changes made to C# is great, the default value on parameters rocks! When I implement Frameworks, I often ended up with something like this:
-
Create an automatic scrollable image slider in Silverlight
I guess someone will send me an comment and say something like: “Why not simply use XXXX, why write your own control” ;) I know there are a lot of controls out there that will do stuff for me, but I want to know how they are created, and try to create my own solution to learn more etc.
-
ASP.NET AJAX 4.0 Preview 5 – Working with Converters and the new CDN
In this blog post I’m going to show you how you can use the new Converter feature during data binding, to make this post more special I have used the new Microsoft AJAX CDN (Content Delivery Network), so I don’t need to have the AJAX 4.0 script on my server. The example code I use in this post, will use the ASP.NET AJAX DataView and also Microsoft ADO.NET Data Services to retrieve data from the server. My fantasy isn’t so special good, but I decided to make a little “rental” application, where I will use ASP.NET AJAX to simply show a list of cars and the current rental status. The status of a rental car will be sent to the client as a string and can be of the following values, Approved, Not Approved and Pending. The little app I’m building for this post, will show the rental status as different colors for the user.
-
Use a ResourceDictionay and an external resources located in an assembly
I have notice that some developers are asking questions about how to use a ResourceDictionary and reference it to a resource located in a separate assembly. Here is a simple step by step guide to make it possible, I assume you already have a Silverlight project created:
-
Silverlight and scaling
I have tried so many different ways to scale a Silverlight app while resizing the browser. When I almost got everything to work, the Grid control start to behave really strange, start to clip my app. Why should it be so hard to get scaling to work, why not just add a property to the Silverlight host, scaling=”enable”, and it will automatically scale our Silverlight app. After some time I got everything to work perfectly and thought maybe some other people would be interested in how to create a Silverlight app that can scale, so here is my solution. This post will ONLY focus on scaling the whole Silverlight host content with the ScalingTransform feature, to make the app fit into any kind of resolution. The code is tested on Silverlight 3.0.
-
Keep the first “empty” Item in a listbox when using ASP.NET AJAX 4.0 Preview 5 and Observer
I got a question as a comment on my previous post about the new features and changes to ASP.NET AJAX 4.0 Preview 5. I hope I understood the question right ;) It was about using a listbox and add an empty item at the top of the list, and keep it there when adding new items to an array that is bounded to the list, and by using the Observer feature. Maybe some more have or will have the same question, so I decided to write a blog post about it.
-
ASP.NET AJAX 4.0 Preview 5 available
Microsoft have recently released the Preview 5 of ASP.NET AJAX 4.0 on CodePlex.
-
.NET RIA Services Exception handling
Note: This post is based on the July preview of the .NET RIA Services, so changes may happen in a future release of the framework
-
Different ways to keep state when building RIA with Silverlight
When building RIA with Silverlight, we will have some state issues we need to take care of. A Silverlight app by default is running in a browser, the browser have 3 bad buttons, Refresh, back and forward. If a user will press the Refresh button, the whole Silverlight app will be restarted. Same if they navigate from a Silverlight app with the back and forward buttons. If we build a RIA, our app will mostly hold the state for us on the client-side to reduce the number of round trip to the server etc. Lets assume a user will work with customer data. A user want to update the customer and information related to the customer. After 10 minutes of changes, the user suddenly by mistake refresh the page and all the data will be lost. So what we need to do when building RIA, is to remember the Refresh, back and forward buttons. This blog post will cover some of the Silverlight 3.0 features we can use to hold state and handle the Refresh, back and forward issues. This is something that I will also take up in my new updated Silverlight 3.0 course at Cornerstone (Where I work as an instructor, mentor, coach and consultant).
-
How SubmitChanges works in .NET RIA Servies
Now I’m back from my 4 week long vacation. I have spend a lot of time with my new apartment, took about 2 month to get most of it ready, I still have a lot of things to do, but all the painting and stuff are done :) I got a question on my e-mail regarding .NET RIA Services and the Business Application project’s UserRegistartionService. It was about the AddUser method in the Service and when and where it’s called. I thought it would be great to write a post about it.
-
Moved to a new apartment
I haven't blog for a while, the reason to this is that I moved to a new apartment three month ago, and have spend a lot of time with some decoration and finding new furniture etc. I have also been really busy with work until my vacation. I still have one week left out of four.
-
Will .NET RIA Services be the Silver Bullet!
I have spend some time on the Silverligth.net forum and in the .NET RIA Services thread.. and just created a replay on a post about RIA Architecture and design.. I have some concerns regarding to how developers are using .NET RIA Services etc.. maybe it’s not a big deal.. but I will try to share my concerns and made a copy of my replay and created it as a blog post. I look forward to your comments. To get basic understanding about about my view of a RIA Architecture and also .NET RIA Servers, I prefer you read my two other blog post before you read this blog post.
-
RIA Architecture with Silverlight in mind
Rich Internet Application (RIA) is an interesting topic. More and more business apps are moving into to the cloud, and more and more will have better User Experience (Ux). According to Gartner Research, nearly 60 percent of all new application development will include RIA technology by 2010. Today we can use different technologies to build a RIA, for example, AJAX, Flash and Silverlight etc. When it comes to AJAX we will soon reach the top of what we can do with it, because of the limitation of HTML, Client-side scripts and the browsers etc. That makes Silverlight and Flash more interesting regarding to me. But what is RIA? RIA It’s an internet applications that looks and feels like desktop applications, it also provide most of the maintainability and deployment benefits of Web applications. A RIA client can have state, so to increase User Experience, the user can work with data for a while until it will be passed down to the server for processing. Because the client side of a RIA can have state and work with data for a while, it’s extra important to have concurrency in mind. Some other users can have changed the data during the time we have worked with our copy. When developing RIA Clients we need to have several things in mind, for example a RIA is often running within an execution container in the Browser, so people can hit the refresh button or use the back and forward buttons, which can be reload the whole app and the current state can be gone. When we creates a large RIA, we can’t let users wait for hours until the application is loaded and started, so we need to load views etc on demand, and split them into small “modules”. Developing a RIA is not like developing a stateless ASP.NET app.
-
A different view of the .Net RIA Services
Some of you have probably heard about the Microsoft .Net RIA Services, if not you can find some info here. In this post I will show you a different view of the .Net RIA Services, how it can be used to create a RESTfull Service, or at least try ;)
-
Silverlight 3,0 Split styles and templates into different files and merge resources
Silverlight 3.0 now support a way to merge resources. So now we can split resources into different files. The following is a example of a simple resource file (ResourceA.xaml):
-
I’m going to talk about Silverlight 3.0 and .Net RIA Services
For my Swedish readers. If you are interested to see some of the new features in Silverlight 3.0 and also the .Net RIA Services and out-of-‘browser feature, I’m going to talk about it on Developer Summit in Stockholm 15-16 April. I’m responsible for the Web track and there are be sessions about ASP.Net 4.0 AJAX, Dynamic Data, Building Web sites with Entity Framework etc. You can find more about the web sessions here: http://www.cornerstone.se/sv/ExpertZone/developersummit/2009/Startsida/Webb/
-
Some features I would like to see in the ASP.Net “vNext”
I would also like to see a template for the MVP pattern.
-
How to create a simple ObjectDataSource Control for Silverlight 3.0 and use Element Binding.
While I was sitting here a Saturday morning and was thinking about what to do, I decided to simply create a light weight ObjectDataSource for fun, only to have a blog post to write ;)
-
HTML is so 1990
Yesterday I was on a meeting with some people from Microsoft and other companies working with social media and communication etc. We talked about the future of the web. I have developed web applications since 1995 or something like that and I’m so tired of is HTML, CSS and client-side script. During the last years people have done incredible web application with technology like AJAX to increase user experience. But HTML, Client-side script and the Browser we are using have limitations, it takes time to build application with rich and good user experience, some stuff are impossible to do because of a limitation both in the HTML, CSS, Client-side script and browser to create Rich Internet Applications. We need a new solutions, a new better way to build applications, and we have two “tools” we can use today to create richer web/internet applications, Flash and Silverlight.
-
on Twitter
For some month ago I just created a Twitter account, and suddenly some poeple found me.. I didn't told anyone that I was on Twitter because I didn't know if I'm going to use it. But now when I got some fre followers I suddenly had to write something ;)
-
Change IE8 to IE7 compatible mode with meta tags
I got some questions regarding how to make sure IE8 will run in IE7 mode by default when visiting a site without changing the IE8 options.
-
How the Presentation Model could look like when using Silverlight 2.0 (Part 6)
This post is not really a follow-up, it’s more like an announcements and for my Swedish readers.
-
MasterPage and Silverlight
I have seen several post about how to implement MasterPage in Silverlight 2.0, most of the posts are about using “fixed” UserControls and dynamically change the content of a control in code-behind. Here is another solution where a Template will be used instead.
-
How the Presentation Model could look like when using Silverlight 2.0 (Part 5)
Maybe the title of my blog post are not the best one now when I write about my little Presentation Model framework for Silverlight.
-
How the Presentation Model could look like when using Silverlight 2.0 (Part 4)
I have created a small framework only for fun and to have a programming task ;) The framework I have created (not yet 100% completed) is similar to Prism, Caliburn and Silverlight.FX. So this is not a framework that should replace those other framework, it still only a hobby project to see if I managed to create a similar one. I will still write about it in this Part 4 of my Presentation Model series. The goal with the framework is to leave the code-behind alone and focus on a separate class and declare everything in the XAML. The following is an example of a class (a Presentation Model):
-
How the Presentation Model could look like when using Silverlight 2.0 (Part 3)
In my previous Part 1 and Part 2 I wrote how a Presentation Model could be implemented and how to handle Async .calls. In this post I will show you how we can avoid adding code to the Code-behind. In Part 2, I had the following code in the code-behind:
-
How the Presentation Model could look like when using Silverlight 2.0 (Part 2)
In my previous post I wrote about how the Presentation Model could be implemented within Silverlight 2.0, in this post I will show how we can use Async. calls to Web Services.
-
How the Presentation Model could look like when using Silverlight 2.0
In this post I will give you an example how the Presentation Model pattern could be implemented when using Silverlight 2.0. I will not dig deep into the Presentation Model, so if you don’t hear of it or want to read more about it, you can visit this page.
-
User Input Validation in Silverlight 2.0
There are different ways of getting data from a Silverlight application, in this blog post I will focus on using WCF. When we use WCF we define DataContract which will be used between the client and the server. It’s relative easy to create a DataContract, here is an example of a contract:
-
Improvements in the .Net Community
It’s amazing how fast the .Net Community have improved it self the last year. More and more developers and architects start to see how important it is to deliver high quality. More and more are interested in design patterns and principles like S.O.L.I.D. They are also interested in how to keep the code they write clean. I have done some work to validate companies design and architecture decisions, and I have notice that more and more companies want this kind of “validation” from someone outside the company, because they start to see that if they use the wrong design or architecture, they are going to pay a lot of more money than if they had the right architecture from the beginning. The cost about getting a validation is so cheap regarding to how much money they need to spend on rewriting or maintaining, or handling problems when they use the wrong architecture. I will say that companies are smarter now than before ;)