Showing posts with label 70-503. Show all posts
Showing posts with label 70-503. Show all posts

Wednesday, 7 October 2009

System.Drawing for backend programmers... hmm

On my quest to become certified microsoft programmer I have arrived at chapter 6 in my self paced training kit for exam 70-536. Which is about drawing graphics. So far I have seen the logic in the topics that every Microsoft certified something should know - reading from files, using different encodings, but drawing graphices, is a bit of a strange topic to put in the basic certificate. Especially when you take it to be allowed to take 70-503 exam which will enable you to call yourself Microsoft Certified Technology Specialist (MCTS) in .NET Framework 3.5, Windows Communication Foundation, which is about communication in distributed systems.

Anyway, now I have just learned to make a jpg file with the following picture:



Which I am sure will come in handy next time I develop a WCF web service, or create a distributed application.

Did it with the following code: (more or less taken from the book)

Bitmap bm = new Bitmap(600, 600);
Graphics g = Graphics.FromImage(bm);

Brush brush = new LinearGradientBrush(new Point(1, 1),
new Point(600, 600),
Color.White, Color.Red);
Point[] points = {
new Point(77,500)
, new Point(590, 100)
, new Point(250, 590)
, new Point(300, 410)
};
g.FillPolygon(brush, points);
bm.Save("bm.jpg", ImageFormat.Jpeg);

Sunday, 27 September 2009

WCF service behavior

Unlike the contracts and the addresses a behavior does not always affect both client and server. A behavior can be local and affect only the server sides way of processes the messages.

A behavior is not exposed as part of metadata.

A behavior can either be a service behavior or an endpoint behavior:

Service Behaviors (behaviors which implement IServiceBehavior


A typical service behavior is the debug logging behavior, which is enabled by adding a serviceBehavior in the config file.

Like this:
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>

One thing that is important to remember is to associate the service with this behavoir. like this:

<services>
<service behaviorConfiguration="ServiceBehavior" name="host.HelloIndigoService">
[...]
</service>

Behaviors can of cause also be added programmatically.

Endpoint Behaviors(behaviors which implement IEndpointBehavior



A endpoint behavior is defined in the same way, but here its not associate with a service but with the actual endpoint.