Epic Blog of Awesome

code.tech.sci.math.art.write

HTML 5 & Silverlight 5 – Eternal Coding – Site Home – MSDN Blogs

The goal of this paper is to present an objective comparison between Silverlight 5 and HTML 5 (with: JavaScript / ECMAScript 5 + CSS3 + any required additional frameworks and APIs). We will only focus on some features: covering these technologies entirely would require a whole book.
The main idea is to provide a guide to help you choose a technology as part of a planned project.
All decisions elements could not be presented here of course. You should take this document as a help to decide rather than as an absolute truth.

via HTML 5 & Silverlight 5 – Eternal Coding – Site Home – MSDN Blogs.

Install ASP.NET 4.0 / Silverlight 4 w/ SQL Merge Replication

There were some challenges in this 4-hour install that I wanted to get down while it was still fresh in my mind.

Database for the application is SQL 2008 R2 is distributed among three servers, one in the States, one in Asia and one in Europe. Merge Replication is used to synchronize the databases.

There were two DB schema changes required for the application upgrade. Merge replication handles some schema changes automatically without disruption to publisher or subscriber servers. One of my schema changes was a length change to a varchar column and I was able to do that on the publisher without a problem. Merge replication handled pushing the change to my subscribers.

The other schema change, however, was adding an identity property to a column, which requires dropping and re-adding the table. This can’t be done while the table is an active article in the replication setup. These are the steps I took to make that change:

  1. Remove the table from the publication articles.
  2. Create a new subscription snapshot
  3. Drop tables on subscriber databases
  4. Make schema changes on the table on the publisher database
  5. Add table back into the publisher articles
  6. Create a new subscription snapshot
  7. Use the replication monitor to ensure synchronization is successful.

The web application was compiled in Visual Studio and Published to a local directory. Remoted to each web server and deleted application all application except for Web.config. Mapped to local box, pulled in the published files.

The web site wouldn’t load. It was giving me 401 errors, which of course actually had nothing to do authentication problems. The web app did come up  on the two other web servers, so after some comparing and troubleshooting I fixed the IIS configuration on the server. It turned out that the application pool was possessed. Seriously, this was strange. As long as the web application was assigned to this application pool, I’d get 401s. When I changed the application pool to a different one of the same type (ASP.NET 4.0 Classic Mode), the app worked fine. Change it back, 401s. Change it back, works.

There were a couple of other details. Forgot to add a couple new rows of data to a configuration table. But no other big problems.

Duplex Service in Silverlight

Silverlight offers us many choices to work with services to get data into our applications. Supported technologies include WCF, ASMX, REST, WCF RIA Services etc. Through the use of any of these, it’s quite easy to get data from the server to the client application and vice versa. They all have one thing in common: before the data is sent, the client has to perform a request to the server to do so. The communication is known to be client-initiated. But what if the server wants to initiate communication by sending some data to the client, without there being a request first? In this case, we need to use duplex communication, so that both sides of the communication channel can start sending data.

via The duplex story: looking at duplex communication in Silverlight (Part 1).

Extension methods in Silverlight and C#

Extension methods are great way to add and use custom functionality on your objects.

So what is an Extension method?

In a short and simple describing: instead of creating a method that takes an instance of your object, applies your changes and then returns you the instance of that control, you can create an Extension method for that specific object to do the same thing but in a way of built-in within your object.

via Extension methods in Silverlight and C#.

C#er : IMage: Abstracting WCF Service Calls in Silverlight 3

While working with WCF in Silverlight is a blessing, it is also a challenge because of the way Silverlight manages service references. There are often extra steps required to ensure a service is Silverlight compatible, then additional considerations relative to making the service consumable on the Silverlight side and ensuring security concerns are met, etc. The purpose of this post is to provide a relatively simple and lightweight framework for abstracting the services in your applications to provide a more solid foundation for using them.

via C#er : IMage: Abstracting WCF Service Calls in Silverlight 3.

c# – Dynamic endpoints in ServiceReferences.ClientConfig – Stack Overflow

When building an app, it is often deployed in different environments (test, dev, prod), and therefore the endpoint addresses are changing. As the ServiceReferences.ClientConfig is built as a part of Silverlight’s .xap file, its hard to change the endpoints after building the solution, as often is done with web.config.

I’ve searched quite a bit for it, but I cant figure out what is best practice here, so my question is:

What is best practice when it comes to dynamic wcf endpoint address configuration in silverlight?

via c# – Dynamic endpoints in ServiceReferences.ClientConfig – Stack Overflow.