.NET, Featured, MVVM, Presentations and sessions, Silverlight, Windows Phone »

[27 Feb 2012 | 0 Comments]

imageTomorrow, I’m delivering a Windows Phone 7.5 MSDN Live session, covering topics about the Windows Phone Application Lifecycle, Isolated Storage & Local Database.  If you haven’t done so already, you can register at this link.

 

The session will be recorded as well, and be made available at Channel 9 afterwards.

 

Cya there? :-)

 

UPDATE: the session slides & demo’s are now available for download from my SkyDrive as well.

.NET, Featured, MVVM, RIA, Headline, WCF RIA Services »

[16 Feb 2012 | 3 Comments]

image

Yesterday, I delivered a session at Techdays Belgium: MVVM & WCF RIA Services: an architectural story.

 

At the start of each project, you’ll have to lay out your solution architecture - and it’s very important to “get this right”. Silverlight, MVVM & WCF RIA Services work nicely together, but as with each architecture, the best solution depends on your application requirements. What are your options in this case? What are the pitfalls? How can you tie these technologies together to provide you with a solid foundation for your projects? This is an in-depth session, based on real-life experience.

 

As promised, you can download the code + slidedeck from my Skydrive

 

Enjoy! :-)

.NET, Featured, RIA, Silverlight, Headline, WCF RIA Services »

[9 Feb 2012 | 0 Comments]

One of the challenges a lot of businesses are struggling with today is the fact that the users of their software are becoming used to accessing their data from a multitude of devices: on the net, on a desktop, on a phone, on a tablet, …

 

This of course raises a lot of questions: how should you develop for this multitude of devices?  Are there best practices?  Can you reuse code, and if yes, should you?  How can you keep costs in check? Et cetera.

 

To answer some of these questions, I’ve started a new article series at SilverlightShowDeveloping for a multitude of clients: Strategies for code reuse and keeping costs in check.

 

In this series, I’ll try to answer the questions a lot of us are wondering about, and while doing so, we’ll build the same type of application as an HTML5, Silverlight (web), Silverlight (OOB), Windows Phone and Windows 8 Metro application. 

 

The first two parts are available now, quite a few more are coming up – enjoy! :)

Featured, General, RealDolmen, Headline »

[15 Dec 2011 | 1 Comments]

It’s been an interesting year, but quite a morbid one as well apparently: a lot of technologies, frameworks & principles have been declared dead, if you want to believe everything you read. Silverlight? Dead. Flash/Flex? Dead. Java? Dead by standstill and fighting. ASP .NET Webforms? Dead. .NET, even? Dead – WinRT to the rescue. And apparently Biztalk has been dead for years.

 

Well have you ever!

 

Today it came to my attention that it doesn’t stop there:

 

Conclusion? Well, apparently, the internet is full of crap. Of course, none of what I mentioned above is dead. If anything, we’ve never had a demand as high as this year for Silverlight & Flex, and mobile Apps in general (note: at the company I work for, we mainly build business app – your opinions may vary ;-)). Some of the stuff that’s been declared dead (HTML5) hasn’t even matured yet: demand is only going to go up, not down, the next few years.

 

In other words: when you’re reading yet another article on the imminent dead of a certain technology, take it with a grain of salt. If something is declared “dead”, the author probably means he or she thinks (or hopes) it will be “dead” in 3 to 5 years or so. Take a look at predictions that were made 5 years ago, and you immediately know the value (or lack of value) of these predictions.

 

Dead? Not really.  

.NET, Featured, RIA, Headline, WCF RIA Services »

[6 Dec 2011 | 0 Comments]

WCF RIA Services Contrib is an open-source CodePlex project, maintained by Colin Blair, which consists of a collection of community contributions that can be used with WCF RIA Services.  At the moment, it consists of ComboBoxExtensions, a Data Validation Framework, Entity Tools, Entity Graph, Fluent Metadata API & T4RIA – you can find more info on those here.

 

Recently, I contributed a bunch of extension methods to the Entity Tools component.  These are methods I tend to use in projects, so I figured: why not release them to the community? :)

 

An overview:

 

  • public static IEnumerable YieldChildEntities(this Entity parent, EntityChangeSet changeSet,
    bool includeDirectChildrenOfEntityBaseType = false)
  • public static IEnumerable YieldChildEntities(this Entity parent, EntityContainer container,
    bool includeDirectChildrenOfEntityBaseType = false)
  • public static void DeleteChildEntities(this Entity parent, EntityContainer container,
    bool includeDirectChildrenOfEntityBaseType = false)
  • public static void DetachChildEntities(this Entity parent, EntityContainer container,
    bool includeDirectChildrenOfEntityBaseType = false)
  • public static void RejectChangesOnChildEntities(this Entity parent, EntityContainer container,
    bool includeDirectChildrenOfEntityBaseType = false)
  • public static void RejectChangesOnChildEntities(this Entity parent, EntityChangeSet changeSet,
    bool includeDirectChildrenOfEntityBaseType = false)
  • public static void AttachRange<T>(this EntitySet<T> entitySet, IEnumerable<T> entitiesToAttach) where T : Entity
  • public static IEnumerable<T> GetEntitiesOfType<T>(this EntityChangeSet changeSet, bool includeAddedEntites = true, bool includeModifiedEntities = true, bool includeDeletedEntities = false) where T : Entity
  • public static bool HasValidationErrors(this System.ServiceModel.DomainServices.Client.SubmitOperation submitOperation)
  • public static bool HasValidationErrors<T>(this System.ServiceModel.DomainServices.Client.SubmitOperation submitOperation) where T:Entity
  • public static IEnumerable<ValidationResult> GetAllValidationErrors(this System.ServiceModel.DomainServices.Client.SubmitOperation submitOperation)
  • public static IEnumerable<ValidationResult> GetAllValidationErrors<T>(this System.ServiceModel.DomainServices.Client.SubmitOperation submitOperation) where T:Entity

 

At the moment, the only way to access these is by downloading the source code, but in the (near) future, they will be included in the NuGet package for Entity Tools, so you might want to keep an eye on that. 

 

Enjoy! :)

.NET, Featured, Silverlight, Headline, WCF RIA Services »

[21 Nov 2011 | 0 Comments]

design-museum-extra-normal-clock-2009Sooner or later, you’ll run into this, if you haven’t already: the dreaded timeout error (or NotFound error), especially with long running operations or queries. The problem? Not all timeouts are the same (to quote a famous writer: all timeouts are created equal, but some timeouts are more equal than others). An error like that can come from your binding (which has a SendTimeout property), but it can also come from your data layer: there are timeouts that can be set on your SQL commands, and on your SQL connections.

 

Let’s look into the binding timeout first. We’re using WCF RIA Services, so you’ll need to gain access to the binding on your endpoint. This can easily be achieved through the OnCreated method of your DomainContext, as such:

 

public  partial class MyDomainContext
{
    partial void OnCreated()
    {
        PropertyInfo channelFactoryProperty = this.DomainClient.GetType()
                                                  .GetProperty("ChannelFactory");
        if (channelFactoryProperty == null)
        {
            throw new InvalidOperationException(
              "There is no 'ChannelFactory' property on the DomainClient.");
        }

        ChannelFactory factory = (ChannelFactory)channelFactoryProperty
                                 .GetValue(this.DomainClient, null);

        factory.Endpoint.Binding.SendTimeout = new TimeSpan(0, 10, 0); 
    }
}

 

With this code in place (you put this where the generated DomainContext code resides – make sure you use the correct namespace, this must reside in the same namespace as your DomainContext), the SendTimeout on your binding is now set to 10 minutes: this makes sure the request can now last 10 minutes. You might notice there are other timeouts you can set here as well: CloseTimeout, OpenTimeout and ReceiveTimeout, but: SendTimeout is the one that defines the interval for the operation to complete before a timeout error is thrown.

 

Next on the list: the command timeout. If you’re accessing a database in your domain operation, this can timeout as well: the command timeout is what defines the maximum amount of time that’s given to the command to execute the provided SQL code (default: 60 seconds). For long running queries on your database, you will need to change this. We’re using WCF RIA Services, and let’s assume we’re also using the Entity Framework: on your DomainService, there’s an overrideable method, CreateObjectContext. This is where you can define the command timeout, as such:

 

protected override MyEntities CreateObjectContext()
{
    var objectContext = base.CreateObjectContext();
    objectContext.CommandTimeout = 1200;
    return objectContext;
}

 

And on the the last one: connection timeout. This is the time you allow to open a connection to your database. Typically, this should be small: if it takes more than, say, a minute to open your connection, you know something is seriously wrong. But if you want to change this (the default is 15 seconds), you can do it via the connection string:

 

Data Source=(local);Initial Catalog=AdventureWorks;
Integrated Security=SSPI;Connection Timeout=30

 

If you keep these 3 timeout values in mind, timeouts for (long running) operations should be a thing of the past.

 

Oh, one more thing: if you’re working with authentication, and your require authenticated access to your services, the authentication ticket could time out as well (you can define this value yourself), resulting in an Access Denied error. To avoid this, using sliding expiration (true by default) will already help a lot (and is a good practice for most applications). Next to that, make sure you correctly catch & handle errors of this type, by asking the user to log in again when his authentication ticket has expired. This is how this could look in your web.config file:

 

<authentication mode="Forms">
  <forms slidingExpiration="true" timeout="180"/>
</authentication>



Happy coding! :-)

General, Silverlight »

[8 Nov 2011 | 0 Comments]

As some of you might know, this blog isn’t the only place where I publish content: I regularly write articles that get published on other sites (and which I obviously can’t just duplicate on this blog, although I try to think about posting the links in an update), and some content is published as books or e-books as well.

 

As it was becoming increasingly difficult to keep an overview of what got posted where, I decided to add 2 pages to this blog: one outlining the content that’s published as a book or e-book, another one with a listing of articles, podcasts, … on other sites

 

I added these as an easy reference for myself (from time to time, I need to get organized ;-)), but as they might prove useful for you as well: a quick blog post. 

 

Enjoy! :-)