|
|
|
|
The IDesign
serviceware downloads is a set of original techniques, tools, utilities
and even breakthroughs developed by the IDesign architects. The
utilities are largely productivity-enhancing tools, or they compensate
for some oversight in the design of .NET or WCF.
The demos are also used during our Master Classes
to demystify technical points, as lab exercises or to answer questions.
The classes' attendees find the demos useful not only in class but
after it. The demos serve as a starting point for new projects, and as a
rich reference and samples source.
There are two categories of
downloads: classic .NET and WCF. The
downloads are the result of ten years of applying .NET and educating the
industry about it, covering C#, essential .NET concepts, .NET
application frameworks, system issues and Enterprise Services. The WCF
downloads provide some essentials WCF demos as well as a rich reference
for contract design, instance management, operations and calls, faults,
transactions, concurrency, queuing, security
and the Windows Azure AppFabric service bus.
For easy browsing, here is the serviceware index:
WCF Downloads:
.NET Downloads:
Make sure to also download
the IDesign settings for Visual Studio 2008/2010.
Subscribe to the IDesign Downloads feed
|
|
WCF Downloads
|
|
|
Title |
Category |
Description |
Last Updated |
|
Thread Affinity Attribute
|
Concurrency Management |
The
solution demonstrates IDesign ThreadAffinityBehaviorAttribute - a
custom service behavior attribute that makes all service instances
(regardless of the service instance mode or concurrency mode) execute on
the same thread. The attribute uses IDesign custom .NET 2.0
synchronization context that always marshals the calls to the same
thread. This is instrumental in advanced cases such as thread local
storage and COM interop as well as advanced synchronization needs such
as when creating a window (or a popup window) to be updated by the
service.
|
21/10/2007 |
|
Callbacks thread Affinity Attribute
|
Concurrency Management |
The
solution demonstrates IDesign CallbackThreadAffinityBehavior - a custom
endpoint behavior attribute that makes all callback instances
(regardless of the worker threads used for the callbacks) execute on the
same thread. The attribute uses IDesign custom .NET 2.0 synchronization
context that always marshals the calls to the same thread. This is
instrumental is advanced cases such as thread local storage and COM
interop as well as advanced synchronization needs. |
24/02/2007 |
|
Form Host
|
Concurrency Management |
Instead
of having a service update a form, how about making the form itself the
service? The solution demonstrates IDesign FormHost - an abstract class that simply by deriving from it makes your Windows Forms form a WCF singleton. |
28/02/2007 |
|
Safe Asynchronous Calls
|
Concurrency Management |
by
default, the completion callback of an asynchronous WCF call comes in
on a thread from the thread pool. If the callback needs to execute on a
particular thread (such as updating the UI with Windows Forms), you must
marshal the call. The solution is IDesign's AsyncClientBase proxy base
class, that will automatically marshal the call to the client
synchronization context (if present). |
15/07/2007 |
|
Asynchronous calls
|
Concurrency Management |
WCF
offers a the client a facility for dispatching calls to the service
asynchronously. This is strictly a client-side feature, and the service
itself is completely unaware that it is being called asynchronously. The
client obviously needs a way to be notified when the calls complete and
be able to harvest returned values or catch exceptions. All that is doe
using a simple directive to SvcUtil: the /asyc switch that generates an
asynchronous proxy. The download contains a sample asynchronous and
synchronous proxy and a matching client, that uses a complete method to
be notified when the call returns. |
30/07/2007 |
|
Callbacks and Reentrancy
|
Concurrency Management |
By
default WCF will not let a service callback within a service operation
to its clients. The reason is that by default the service uses
single-threaded access – only one client is allowed to call it at a
time. If the service were to allow to call back to its client it could
result with a deadlock if the client will call to the service as a
result of the callback to the client. To allow callbacks, you need to
configure the service for reentrancy – that is, release the lock before
the callback, as show in the demo. |
07/09/2006 |
|
Multiple UI Threads
|
Concurrency Management |
You
can quite easily have your service update some UI on the host side. All
you have to do is open the host on the UI thread after establishing the
Windows Forms synchronization context. In fact, nothing prevent you
from having multiple UI threads, each with its own set of Forms and
services, as shown in the download. |
07/09/2006 |
|
Timer Service and UI callbacks
|
Concurrency Management |
The
download contains an interesting concept – a service that acts like a
timer, calling back to its clients on requested intervals. The service
actually uses the .NET timer and delegates, and is a nice demo of how to
bridge the two technologies - the timer delegates and the WCF
callbacks. In addition, it demonstrates WCF ability to marshal the
callbacks correctly to the UI thread the client it running on. |
07/09/2006 |
|
Manual UI Updates
|
Concurrency Management |
When
a service needs to update UI, if the service is not using the UI
synchronization context, the service must manually marshal the call
(which comes in on a worker thread) to the UI thread. The easiest way of
doing that is using an anonymous method and a synchronization context,
as shown in the download. |
09/01/2007 |
|
Calls Priority Attribute
|
Concurrency Management |
By
default, WCF calls execute in the order received by the service. This
solution contains CallsPriorityBehavior attribute - a custom attribute
that relies on a custom synchronization context, which marshals the
calls to a pool of threads. The calls are sorted based on priority, then
executed. The client provides the priority to the proxy constructor. |
21/10/2007 |
|
Thread Pool Attribute
|
Concurrency Management |
By
default, WCF calls execute on threads from the I/O completion ports
thread pool. For some high-end scenarios, you may want to allocate a
dedicated pool of threads to all calls of your service. This solution
contains the ThreadPoolBehavior attribute which lets you specify the
size of that pool. A pool size of one will generate thread affinity. The
technique used here is a custom synchronization context that marshals
all incoming calls to the dedicated pool of threads. |
21/10/2007 |
|
Asynchronous and Synchronous calls
|
Concurrency Management |
You
can rework the SvcUtil or VS generated proxy so that the same proxy
will offer both synchronous and asynchronous calls. To download
demonstrates the required code changes, as well as where to place the
fault contracts. |
07/09/2006 |
|
UI Client and Worker Thread Callbacks
|
Concurrency Management |
By
default callbacks enter the client on worker threads. If the client is a
Windows Forms object, you must marshal the calls to the UI thread. By
default this is exactly what WCF will do if the client is a Windows
Forms form. But if the client uses a worker thread to dispatch the
calls, there will be no marshaling. The client may do so to avoid a
deadlock if the service tries to call back during a service call. The
download shows such a client that uses its own synchronization context
to post messages back to its own UI thread to process the callbacks and
avoid a deadlock. |
07/09/2006 |
|
Safe Controls
|
Concurrency Management |
Calls
enter the service on worker threads. If the service needs to update
Windows Forms forms and controls, it must marshal the update to the UI
thread(s). Instead of using the synchronization context directly which
serializes all calls to the service, you can use IDesign set of
thread-safe Windows Forms controls - any service can access them as if
running on the UI thread. This enables the same service to update
multiple forms on multiple threads, and only marshal when necessary. |
07/09/2006 |
|
Windows Forms and Callbacks
|
Concurrency Management |
When
callbacks enter the client, they do so on a worker thread. If the
callback object is a Windows Forms object, that worker thread cannot
access the form directly, and instead, the call must be marshaled to the
UI thread. Fortunately, WCF can do that automatically for you. Simply
call the proxy on the UI thread, and the callback will be marshaled to
the UI thread in turn. The download demonstrates this behavior. |
07/09/2006 |
|
Reentrancy
|
Concurrency Management |
While
the main motivation for reentrancy configuration is callbacks, it has
its use in with cyclic calling: Service A calling B calling C calling
back into A. Without reentrancy this would mean a deadlock, as shown in
the download. |
07/09/2006 |
|
Thread Affinity
|
Concurrency Management |
By
default, WCF will establish an affinity between the service host and
the synchronization context it was created on. Since by default there is
no synchronization context, client calls are services on arbitrary
worker threads. The download contains IDesign custom .NET 2.0
synchronization context that always marshals the calls to the same
thread. By installing the custom synchronization context and then
opening the host, all client calls are always routed to the same thread,
thus establishing thread affinity between all instances and all
endpoints of the service. |
07/09/2006 |
|
Service Contract Inheritance with proxy chaining
|
Contracts |
Even
after reworking the imported definitions of a contract hierarchy, you
still have a single proxy class. You can however have the client use a
hierarchy of proxies that provided an is-a relationship between the
proxies, yielding a much smoother programming model. The solution
demonstrates this technique we call proxy-chaining. |
07/09/2006 |
|
Metadata Helper
|
Contracts |
The
MetadataHelper class provided for a runtime way of parsing and querying
the contracts of a running service. It allows the client to find out
programmatically if the service supports a specified contract, it
obtains all contracts of a running service, or the operations of a
specified contract. These powerful and useful features are often
required during setup or in administration applications and tools. |
07/09/2006 |
|
Service Contract Inheritance
|
Contracts |
On
the service side, WCF lets you define and use a contract hierarchy
simply by applying the ServiceContract attribute at every level of the
interface hierarchy, deriving and implementing it. The service can even
expose a single endpoint for all contracts. However, the imported
metadata definitions on the client side do not maintain the interface
hierarchy. The solution shows the simple steps required to rework the
client side definitions to reflect correctly the contract hierarchy and
maintain an is-a relationship between the imported contracts.
|
07/09/2006 |
|
Contract Overloading
|
Contracts |
While
C# and VB will let you overload interface methods, by default, WCF will
not let you overload contract operations. However, using simple
aliasing you could provide both the service and the client the
overloaded programming model, as shown in the download. |
07/09/2006 |
|
Class Hierarchy
|
Data Contracts |
When
serializing a data contract type into or from a service operation, the
compiler will gladly let you pass in a sub class of the data type.
However, this will by default fail the call because WCF will not know
how to serialize or deserialize the sub class. For that, you have to
apply the KnownTypeAttribute at the proxy or contract level, as show in
The download. You will also need to apply the attribute on the service
side if the service needs to return matching sub classes.
|
07/09/2006 |
|
Custom Collection
|
Data Contracts |
WCF
will let the service define a contract that returns a custom
collection. While you cannot share the definition of the custom
collection across the service boundary, you can apply the
CollectionDataContract attribute to have it exposed to the client as a
custom generic list, as shown in The download. |
07/09/2006 |
|
Versioning
|
Data Contracts |
WCF
lets the client and the service version independently their definitions
of the same data contract. If the client sends a type with a missing
member the service expects, the missing member on the service side will
be initialized to its default value. If the data type contains a member
the service is unaware of, it will be silently ignored. In addition, WCF
allows both sides to explicitly require a particular data member or
else fail the call. The download contains three solutions demonstrating
these behaviors. |
07/09/2006 |
|
Data Extensions and Round Trip
|
Data Contracts |
While
the default behavior of a data contract type is to simply ignore
extraneous unexpected members, you can instruct it to still store and
pass it along to and from the service by implementing
IExtensibleDataObject. This enables a round-trip scenario, where a new
client is calling an old service with the new data contract, and the
service can even pass the data contract unaffected to another service or
client, as shown in the download. |
07/09/2006 |
|
Known Types in Config
|
Data Contracts |
While
you typically apply the KnownType attribute at design time to allow sub
classes of your data contract, this is of no use when the client passes
in a new sub type later on. You can compensate for that by including
the known type information in the config file, as shown in the download.
|
07/09/2006 |
|
Order and Equivalence
|
Data Contracts |
When
generating an equivalent data contract to an already existing one, it
is insufficient to alias the type and the members. You also need to
ensure that the order of serialization is maintained – first by class
hierarchy then alphabetically. In case of a discrepancy, you can
compensate by setting the Order property of the DataMember attribute as
shown in the download. |
07/09/2006 |
|
Data Tables
|
Data Contracts |
The
download demonstrates WCF ability to use ADO.NET data tables as-is in
operation parameters. You can even use type-safe data tables, and the
imported proxy file contains an imported data table definition. You can
remove that definition if the client has a local definition already of
the table. |
07/09/2006 |
|
Data Tables as arrays
|
Data Contracts |
While
WCF lets you freely pass ADO.NET data tables to and from a service, it
is a questionable practice at best if the service needs to work with
non-.NET clients. It is better in such cases to rerun the items in a
neutral array. The solution demonstrates the use of the IDesign helper
class DataTableHelper which converts the table to an array. |
07/09/2006 |
|
Enums
|
Data Contracts |
The
EnumMemberAttribute allows data contract developers to alias the values
of an enum and even to omit them from the data contract, as shown in
the download. |
07/09/2006 |
|
Ad-hoc Discovery
|
Discovery |
The
solution demonstrates several important points often used in
conjunction with discovery. The service uses the standard MEX and
discovery endpoints, as well as relying on the host to implement the
discovery and metadata exchange endpoints. This means you have to
explicitly add the default endpoints. The service also picks up an
available TCP port on the fly, dynamically. The client uses two
techniques to invoke the service. The first is regular discovery of the
address while having a priori knowledge of the binding. The second is
with the IDesign DiscoveryFactory, which first discovers the service
metadata address, then obtains the metadata, and uses the address and
the binding in the metadata to create the proxy.
|
22/01/2010 |
|
Dynamic Addresses
|
Discovery |
If
the service knows the clients will use discovery, then there is no need
to deploy the service pre-configured ports or pipes. The host can
simply pick up any available port or pipe on the fly, at runtime. This
is exactly what you can do with the IDesign helper class DiscoveryHelper
and its properties AvailableTcpBaseAddress and AvailableIcpBaseAddress.
provide those to the host as base addresses and enable discovery. |
22/01/2010 |
|
Announcements
|
Discovery |
The
demos shows how to configure all hosts in the process to automatically
announce their state (Hello/Bye). The client uses the IDesign
AnnouncementSink to receive the announcements. While AnnouncementSink hosts internally an instance of AnnouncementService, it improves on its deficiencies. First, AnnouncementSink offers two event delegates for notifications. Unlike the raw AnnouncementService, AnnouncementSink fires these delegates concurrently. In addition, AnnouncementSink
disables the synchronization context affinity of AnnouncementService,
so that it can accept the announcements on any incoming thread, making
it truly concurrent. AnnouncementSink filters the contract types and only fires its events when compatible en |
22/01/2010 |
|
Publish-Subscribe Framework
|
Discovery |
A
small framework for implementing a discovery-driven publish-subscribe
pattern for events firming and subscriptions. Unlike common techniques
for supporting the publish-subscribe design pattern, a discovery-based
solution is the only publish-subscribe case which requires no explicit
steps by the subscribers or administrator. When utilizing discovery,
there is no need to explicitly subscribe either in code or in config. In
turn, this significantly simplifies the deployment of the system and it
enables great volatility in the presence of both publishers and
subscribers. You can easily add or remove subscribers and publishers
without any additional administration steps or programming. The
subscribers can provide a discovery endpoint so that t |
22/01/2010 |
|
Scopes
|
Discovery |
A simple demonstrations of using scopes to filter on the discovered service endpoints. |
22/01/2010 |
|
ServiceModelEx
|
Essentials |
A
class library containing all the IDesign helper classes, utilities and
tools. The library also contains a comprehensive catalog of
ServiceModelEx, containing short documentation of each type, its
category and reference to related classes or types. |
24/01/2009 |
|
NetNamedPipeContextBinding
|
Essentials |
While
.NET 3.5 provides the NetTcpContextBinding, NetBasicHttpContextBinding
and WSHttpContextBinding, it does not provide a matching support for
IPC. IDesign rectifies this oversight by providing
NetNamedPipeContextBinding. The demo shows both the steps required to
implement such a custom binding, the supporting configuration-enabling
types and also how to register it so that you could use it like the
built-in binding in a config file. |
24/01/2009 |
|
Metadata Explorer
|
Essentials |
The
Metadata Explorer is a helper utility that visualizes the available
service endpoints of a running service. This is done using metadata
exchange - roughly the WCF equivalent of .NET reflection. Metadata
contains not just contracts and operations but also information about
security, transactions, reliability and faults. WCF makes it easy to
programmatically query and discover the metadata of a service. The tool
uses WCF's MetadataExchangeClient and MetadataImporter, and WsdlImporter
to obtain and parse the metadata into endpoints. The Metadata Explorer
tool simply visualizes the information returned and is very useful in
seeing what a service has to offer without resorting to development
tools. The tools also utilizes discovery, allowing |
09/01/2010 |
|
Trace Interceptor
|
Essentials |
This
demo shows how to use the IDesign Generic Interceptor framework to
implement a simple trace of pre and post calls including parameters. The
Generic Interceptor framework is nothing short of extensions for the
WCF extensions. |
24/01/2009 |
|
Message headers as custom context
|
Essentials |
A
WCF client can add into the message headers any custom information, and
the service can in turn read those headers. Message headers are a
general techniques for passing out-of-band parameters to the call, in
effect giving the service a custom context, not unlike the other WCF
contexts, such as transaction or security. Using the headers on both
sides requires intricate interaction with the message, the operation
context and the proxy. To automate, IDesign provides the GenericContext helper class which streamlines reading and writing into the headers any custom context, and HeaderClientBase, which derives IDesign's InterceptorClientBase and automates passing the parameters from the client. The demo shows how to provide for a simp |
30/10/2008 |
|
Service Host Factory
|
Essentials |
Using
IIS or the WAS does not mean you cannot use a custom host. All you need
is to provide a custom service host factory that derives from
ServiceHostFactory, instantiate your custom host, provide the custom
host initialization and return the host reference, as shown in this
solution. |
15/07/2007 |
|
Context bindings as custom context
|
Essentials |
With
.NET 3.5, WCF provides three context bindings (BasicHttpContextBinding,
NetTcpContextBinding, WSHttpContextBinding). These support a context
protocol for passing custom parameters from the client to the service in
the form of a dictionary of strings keys and values. This is a general
technique for passing out-of-band parameters to the call, in effect
giving the service a custom context, not unlike the other WCF contexts,
such as transaction or security. Using the context binding on both sides
requires intricate interaction with the operation context and the
proxy. To automate, IDesign provides the ContextManager helper class
which streamlines reading and writing into the context binding and
ContextClientBase, which derives ClientBas |
30/10/2008 |
|
Service Snippet
|
Essentials |
The
zip file contains a Visual Studio 2005 custom snippet that automates
generating a simple WCF contract and the matching implementing service.
The service uses the best practices for transaction context, transaction
voting, and instance management. |
07/09/2006 |
|
Aborting the Host
|
Essentials |
When
calling ServiceHost.Close(), calls in progress are allowed to complete
gracefully, and only future calls are denied. ServiceHost.Abort() on the
other hand is an ungraceful exit, and it aborts calls in progress,
resulting with an error on the client side. This simple demo lets you
experiment with the differences between Close() and Abort(). |
07/09/2006 |
|
In-Proc Hosting
|
Essentials |
WCF
lets the service execute in the client’s process. This hosting mode is
called In-Proc hosting. You should use named pipe binding, and you can
even have a single config file for both the client and the host. This
simple demo demonstrates in-proc hosting. |
07/09/2006 |
|
Multiple Endpoints
|
Essentials |
A
service is not limited to a single endpoint. As The download
demonstrates, the service can have any number of embonpoints with any
combination of addresses, bindings, and contracts. Similarity, the
client can decide to consume a particular endpoint or all of them. The
demo shows the required configuration on both the service and the client
side. |
07/09/2006 |
|
Programmatic Configuration
|
Essentials |
Both
the service and the client can use either a configuration file to list
the endpoints and the related binding or behavior configuration or they
can use programmatic calls to achieve the same effect. The solution
contains a simple client and service that configure themselves
programmatically. It is the same demo of the multiple endpoints only
programmatically. |
24/02/2007 |
|
WAS Hosting
|
Essentials |
With
IIS7 on Windows Vista and Windows Server 2008, you can use the Windows
Activation Service (WAS) to host your WCF services. While very similar
to IIS6 and IIS5 hosting (virtual directories, svc files, etc), with the
WAS you are not limited to HTTP and can use TCP, named pipes (IPC) and
MSMQ. There is a one-time setup step (done in the included cmd file) to
allow these interactions, where you assign a port number for your web
site and allow the protocols for your application (the WCF service). The
rest is regular WCF as shown in the demo.
|
21/10/2007 |
|
App Domain Host
|
Essentials |
By
default, the service host class creates the service instance in the
same app domain as its caller. This solution contains the IDesign custom
service host AppDomainHost that injects the service instance in a new
app domain, thus better catering for fault and security isolation. |
21/10/2007 |
|
In-Proc Factory
|
Essentials |
The
solution contains an IDesign helper class called InProcFactory - a WCF
factory designed to streamline and automate hosting services in the same
process as the client. There is no need for any config file or
programmatic calls to create the host or configure the binding. All the
in-proc factory requires is the type of the service and the type of the
requested contract. It is as close as you can get in WCF to the Win32
API of LoadLibrary() and it is the easiest way to shim up a class as a
service instead of using the class as a traditional CLR class. |
24/02/2007 |
|
ErrorHandlerBehavior Attribute
|
Faults |
The
solution demonstrates IDesign fault handling framework. The class
ErrorHandlerHelper automates implementing IErrorHandler: it promotes
all exceptions to matching fault exceptions if found in fault contract,
and it logs the exception to a dedicated logbook service. The log entry
contains a detailed stack and context dump. The solution also contains
the logbook viewer application. The attribute
ErrorHandlerBehaviorAttribute wraps the use of ErrorHandlerHelper and
automatically installs the error handler by attaching it to all
dispatchers.
|
24/02/2007 |
|
CallbackErrorHandler Attribute
|
Faults |
The
solution demonstrates IDesign fault handling framework, this time on
the client side. The CallbackErrorHandlerAttribute is applied on the
callback client-side class. It installs an error handler on all callback
dispatchers. The error handler promotes all exceptions to matching
fault exceptions if found in the fault contract of the callback
contract, and it logs the exception to a dedicated logbook service. The
log entry contains a detailed stack and context dump. The solution also
contains the logbook viewer application. |
24/02/2007 |
|
Debug-Time Exception Extraction
|
Faults |
While
the combination of IncludeExceptionDetailInFaults and the propagation
of ExceptionDetail to the client lets the client (for debugging
purposes) examine the original exception thrown by the service,
programming against FaultException is cumbersome, and,
it does not fault the channel, unlike the real exception. The client can
compensate by extracting the original exception, and even recursively
build the inner exception tree. To streamline, the client can use the
IDesign DebugHelper class to automate these steps, and even encapsulate
its use in the proxy, including faulting the channel, as shown in the
solution. |
25/02/2007 |
|
Debugging and Unknown Faults
|
Faults |
WCF
lets the service be configured to return all unknown exceptions as
faults, even if there are not listed in the fault contracts. This aspect
of the service behavior is especially useful during debugging. The
download shows how to turn on this feature only for debug builds using
the IncludeExceptionDetailInFaults property of the service behavior. |
24/02/2007 |
|
Fault Contract
|
Faults |
By
default all service side exceptions are indistinguishable from
communication exceptions. WCF lets developer use the FaultContract
attribute to explicitly return a known fault from the service. Such
faults would also not fault the channel and allow subsequent calls, as
shown in the download. |
07/09/2006 |
|
IErrorHandler
|
Faults |
If
you want to change the default error handling and propagation on the
service, you can add a custom service behavior that also supports the
IErrorHandler interface, and add that behavior to every dispatcher. The
solution shows a service that implements the custom behavior and
IErrorHandler directly, and the affect it has on the client side
reported exceptions. |
07/09/2006 |
|
Deactivation
|
Instance Management |
Normally,
WCF deactivates a session-full service when the sessions ends. However,
instead of waiting for the client to close the proxy or a timeout, you
can use the context deactivation feature of the OperationBehavior
attribute to deactivate the service, before, after or before and after
the call, as shown in the download.
|
07/09/2006 |
|
Demarcating Operations
|
Instance Management |
Normally,
WCF deactivates a session-full service when the session ends. However,
if the session has a particular lock-step state machine, you can
configure operations on the contract to terminate the session, or to not
be the first operation in the session, as shown in The download. |
07/09/2006 |
|
Instancing Modes
|
Instance Management |
WCF
supports three classics instance management modes: per-call assigned a
new instance per request, per-session assigns a private instance for the
client for the duration of the session, and a singleton instance serves
all clients regardless of sessions and connections. You control these
modes using the InstanceContextMode property of the ServiceBehavior
attribute and the contract itself. The download contains three solutions
letting you examine the differences between the three modes. |
07/09/2006 |
|
Throttling in Config
|
Instance Management |
Using
a config file, you can throttle various communication thresholds of
your service such as the number of concurrent calls or instances, as
shown in the download. |
07/09/2006 |
|
Programmatic Throttling
|
Instance Management |
Throttling
is a host behavior. Before opening the host, you can programmatically
throttle various communication thresholds of your service such as the
number of concurrent calls or instances, as shown in the download. |
07/09/2006 |
|
Durable service using SQL persistence provider
|
Instance Management |
For
durable services that use the DurableService attribute to have WCF
serialize and desterilize their state between calls, you need to
configure the host with the details of a persistence provider in the
config file. You can use the WCF-provided SQL persistence factory of
SqlPersistenceProviderFactory. The client still needs to manage the
instance ID on its side, and that is done using the dedicated IDesign
helper classed for context binding and instance ID. You will also see
when to set the CompletesInstance property of the DurableOperation
attribute to remove the instance state from the store, and how the
client picks up a new instance ID on subsequent calls. |
30/10/2008 |
|
Durable service using custom persistence provider
|
Instance Management |
For
durable services that use the DurableService attribute to have WCF
serialize and desterilize their state between calls, you need to
configure the host with the details of a persistence provider in the
config file. You need to derive from PersistenceProviderFactory and
override a simple set of methods. The demo contains IDesign's
FilePersistenceProviderFactory and FilePersistenceProvider, which as
their name imply, persist the state of the service into a file. you will
also see how to provide custom parameters in the config file (such as a
file name) in the constructor of the persistence provider factory. The
client still needs to manage the instance ID on its side, and that is
done using the dedicated IDesign helper classed for context |
30/10/2008 |
|
Publish-Subscribe Framework
|
Operations |
Using
raw duplex for events couples the publishers to the subscribers. They
each have to know where the other is, both have to be running to publish
or receive events, subscribers cannot subscribe to a type of event, and
publishers cannot broadcast an event to subscribers they do not know
about. The publish-subscribe design pattern decouples the publishers
from the subscribers by introducing a dedicated subscription service and
a dedicated publishing service in between. You can also have transient
subscribes which are live subscribers using callbacks and persistent
subscribers which are services to invoke like any other service, and can
even be not-running. The download contains IDesign framework for
implementing in only a few lines of code |
10/09/2006 |
|
Publish-Subscribe Example
|
Operations |
The
download contains another example for using the IDesign framework for
implementing a publish/subscribe service. The example is a traffic
lights management application. |
10/09/2006 |
|
Connect-Disconnect
|
Operations |
When
dealing with a duplex contract, every operation carries with it the
callback reference. In most applications the client also would like to
explicitly start or stop receiving callbacks. You can do that by adding a
Connect/Disconnect methods to the contract, as shown in The download.
|
07/09/2006 |
|
Dual HTTP Callback Address in config
|
Operations |
When
using the WSHttpDualBidning for callbacks, WCF will use by default port
80 for the callbacks. This will likely conflict during development time
with local installation of IIS, and is of little use in Intranet
deployment. However, as The download shows, you can configure the client
callback base address in the client-side config file to have a
different port. |
07/09/2006 |
|
Events
|
Operations |
The
classic use for callbacks in WCF is for events. The service can
maintain a list of callbacks, and notify them when some event takes
place on the service side. The service contract can define subscribe and
unsubscribe operations, and take a masked enum to allow the clients to
chose which event to subscribe or unsubscribe to. In fact, you can even
use delegates on the service side to manage the subscribers. This use in
an interesting bridging concept: the service uses conventional
delegates to manage and publish events, when the events are delivered
using WCF duplex callbacks. |
07/09/2006 |
|
One-Way Calls
|
Operations |
All
WCF bindings support one-way calls – the ability to fire and forget a
method. Simply set the IsOneWay property of the OperationContract
attribute to true. However, as The download demonstrates, one-way calls
do not equate asynchronous calls, or even concurrent calls - because the
calls are queued up on the service side, the client may still block, as
a product of concurrency mode, the instance mode, the binding and the
reliable session. |
07/09/2006 |
|
Streaming
|
Operations |
By
default the message has to be received in it’s entirely by the service
or the client before being processed. Instead of buffering the message,
you can return a stream, and have WCF on the receiving end start
processing the message while it is being streamed. The classic example
for streaming is large media files. The download is a simple music
download service and a player client using streaming. In addition, you
may have to configure the maximum allowed message size, as shown in the
download. |
19/06/2007 |
|
Programmatic Dual HTTP Callback Address
|
Operations |
When
using the WSHttpDualBidning for callbacks, WCF will use by default port
80 for the callbacks. This will likely conflict during development time
with local installation of IIS, and is of little use in Intranet
deployment. Instead of using a config file to hard-code the callback
port, you can use the IDesign's WsDualProxyHelper class to select any
available port at run time, as shown in the download. |
07/09/2006 |
|
Dual HTTP Callback Address using an attribute
|
Operations |
When
using the WSHttpDualBidning for callbacks, WCF will use by default port
80 for the callbacks. This will likely conflict during development time
with local installation of IIS, and is of little use in Intranet
deployment. Instead of using a config file to hard-code the callback
port or making programmatic calls at run time, you can use the IDesign's
ClientBaseAddressBehaviorAttribute to configure the port, either
hard-code it or select an available port at run time. The attribute
implements the IContractBehavior interface, as shown in the download. |
07/09/2006 |
|
Type-Safe Duplex Callbacks
|
Operations |
The
WCF provide duplex proxy DuplexClientBase is object-based and is thus
not type safe. In addition, the context class InstanceContext is also
object based. The compiler does not verify the relationship between
these objects, and there is no verification of the relationship between
the callback contract type and the service contract. However, you can
fix most of these using generics. The solution contains IDesign
InstanceContext and DuplexClientBase which provide the added degree of type safety, as well as a matching duplex factory called DuplexChannelFactory. |
07/09/2006 |
|
Queued Singleton
|
Queuing |
This
solution demonstrates how a singleton can accept queued calls, and how
the singleton shares its state across clients and queued calls. You will
see how to configure a transactional queued service.
|
25/07/2007 |
|
Queued Calls
|
Queuing |
Using
the NetMsmqBinding WCF lets the client post messages to an MSMQ queue
instead of a service. When the service host is connected, WCF will
dispatch to it the queued calls. The download contains a simple queued
service and client. |
07/09/2006 |
|
Online/Offline Service
|
Queuing |
An
occasionally connected service can issue direct synchronous calls when
connected and queued called over MSQM when disconnected. The download
contains a service that exposes both a queued and regular endpoint. The
client uses the network events to monitor the network status, and uses
the queued endpoint automatically when disconnected (such as when the
network is disabled). |
07/09/2006 |
|
Queued Per Call Service
|
Queuing |
Which
a queued per call service, every client calls gets a separate MSMQ
message. If the client is also transactional, all those messages get
posted to the queued as one batch, as shown in the download. The
messages will be played independently, each to a new service instance. |
07/09/2006 |
|
Queued Per Session Service
|
Queuing |
Which
a queued and session full service, all the client calls get packaged in
a single MSMQ message. If the client is also transactional, that
message is posted only on successful completing the client transaction.
As shown in The download, when the single message is dequeued all the
calls are played to the same instance in the order the client issued
them, then the service instance is disposed. |
07/09/2006 |
|
Queued Publish-Subscribe
|
Queuing |
This
download uses the IDesign framework for implementing a
publish-subscribe service in conjunction with queued calls. The
publisher can fire the event synchronously or queued. The persistent
subscriber can be regular or queued. You can experiment with both a
queued publisher and a queued subscriber. |
25/07/2007 |
|
Response Service
|
Queuing |
A
queued service may need to report results or errors to its caller.
However, queued called are one-way calls, and callbacks are not
possible. However, the service can report back to a client-side queued
service called a response service. There are some details to work out:
correlating methods, passing the response service address, and so on.
The solution contains IDesign helper framework for supporting response
service. The extraneous information (the ResponseContext data contract
class) is stored in a custom message header, and the helper class
ResponseScope automates creating a response service proxy on the service
side and headers management. You will also see how to wrap the proxy in
a response-service aware proxy, how to correlate me |
31/01/2007 |
|
Queued HTTP Bridge
|
Queuing |
The
MSMQ binding only works in the Intranet. However, The client may want
to queue up calls to services over WS bindings, and WS-binding enabled
service may want to queue up calls before executing them. The solution
is to use an intermediary bridging queued client and queued service. The
client uses queued calls locally and the client-side queued bridge
service uses WS binding to call service-side bridge across the Internet.
The service-side bridge uses queued calls against a local service. The
solution demonstrates the required configurations and contract
adjustments required. |
31/01/2007 |
|
Poison Message
|
Queuing |
When
a message continuously fails, it is deemed as a poison message. WCF
lets you configure in the binding how many attempts to try before
considering the message as poisonous. This demo shows a service that
always throws an exception thus always failing. The service uses an
error handling extension to log the errors using the logbook, error
extension and viewer provided by IDesign. The repeated attempts are
logged, and then the last exception (MsmqPoisonMessageException)
indicating a poison message. |
31/01/2007 |
|
Response Service - form as response service
|
Queuing |
The
demo shows how you can use a form as a queued response service. It uses
IDesign's framework for a queued response service, with FormHost for turning the form into a service, a queued service in this case. |
24/01/2009 |
|
Identity Stack Tracing
|
Security |
This
demo shows how to use the IDesign Generic Interceptor framework to
propagate the entire stack of callers (their identities, authentication
level, operations, etc) in every call. This offers a secure alternative
to impersonation, allowing every stop along the call chain to find out
the identity of the callers (and the original caller). You still need to
protect and sign the stack of callers yourself. the demo uses both
IDesign support for managing message headers and the Generic Interceptor
framework. The Generic Interceptor framework is nothing short of
extensions for the WCF extensions. |
24/01/2009 |
|
Declarative Security - Business to Business
|
Security |
Security
is the most intricate WCF aspect, and there is no built-in declarative
model. To avoid, simplify and streamline security, IDesign developed a
declarative attribute based security model. The
SecurityBehaviorAttribute service attribute is used like any other
service attribute to configure the security scenario. The attribute
offers a few simple properties that default to reasonable setting, and
there is a matching client side helper class and proxy. The solution
demonstrates using SecurityBehaviorAttribute to configure business to
business security (such as between two trading partners) using
certificates on both sides for mutual authentication. |
15/07/2007 |
|
Declarative Security - Anonymous Access
|
Security |
Security
is the most intricate WCF aspect, and there is no built-in declarative
model. To avoid, simplify and streamline security, IDesign developed a
declarative attribute based security model. The
SecurityBehaviorAttribute service attribute is used like any other
service attribute to configure the security scenario. The attribute
offers a few simple properties that default to reasonable setting, and
there is a matching client side helper class and proxy. The solution
demonstrates using SecurityBehaviorAttribute to configure anonymous yet
secure and private access to the service. |
15/07/2007 |
|
Declarative Security - None
|
Security |
Security
is the most intricate WCF aspect, and there is no built-in declarative
model. To avoid, simplify and streamline security, IDesign developed a
declarative attribute based security model. The
SecurityBehaviorAttribute service attribute is used like any other
service attribute to configure the security scenario. The attribute
offers a few simple properties that default to reasonable setting, and
there is a matching client side helper class and proxy. The solution
demonstrates using SecurityBehaviorAttribute to completely turn off
security. |
15/07/2007 |
|
Declarative Security - Security Audit
|
Security |
The
IDesign ServiceSecurity also offers the SecurityAuditEnabled property
which lets the service declare its need for a security audit. This
properly complements the config setting, and will not override the value
in the config file. By setting it to true, WCF will log all security
events for the service.
|
15/07/2007 |
|
Declarative Security - Alternative Windows Credentials
|
Security |
Security
is the most intricate WCF aspect, and there is no built-in declarative
model. To avoid, simplify and streamline security, IDesign developed a
declarative attribute based security model. The
SecurityBehaviorAttribute service attribute is used like any other
service attribute to configure the security scenario. The attribute
offers a few simple properties that default to reasonable setting. The
solution demonstrates using SecurityBehaviorAttribute to configure
alternative Windows credentials in the Intranet. |
15/07/2007 |
|
Declarative Security - Using ASP.NET Providers in the Intranet
|
Security |
Security
is the most intricate WCF aspect, and there is no built-in declarative
model. To avoid, simplify and streamline security, IDesign developed a
declarative attribute based security model. The
SecurityBehaviorAttribute service attribute is used like any other
service attribute to configure the security scenario. The attribute
offers a few simple properties that default to reasonable setting. The
solution demonstrates using SecurityBehaviorAttribute to configure
security to use the ASP.NET providers over TCP in the Intranet to pass
custom credentials. |
15/07/2007 |
|
Declarative Security - Windows Credentials over the Internet
|
Security |
Security
is the most intricate WCF aspect, and there is no built-in declarative
model. To avoid, simplify and streamline security, IDesign developed a
declarative attribute based security model. The
SecurityBehaviorAttribute service attribute is used like any other
service attribute to configure the security scenario. The attribute
offers a few simple properties that default to reasonable setting, and
there is a matching client side helper class and proxy. The solution
demonstrates using SecurityBehaviorAttribute to configure the service
and the client to use Windows accounts and yet communicate securely over
the Internet using the WSHttpBidning. |
15/07/2007 |
|
Declarative Security - ASP.NET Providers over the Internet
|
Security |
Security
is the most intricate WCF aspect, and there is no built-in declarative
model. To avoid, simplify and streamline security, IDesign developed a
declarative attribute based security model. The
SecurityBehaviorAttribute service attribute is used like any other
service attribute to configure the security scenario. The attribute
offers a few simple properties that default to reasonable setting, and
there is a matching client side helper class and proxy. The solution
demonstrates using SecurityBehaviorAttribute to configure using ASP.NET
providers for custom credentials when the service is exposed to the
Internet. |
15/07/2007 |
|
Alternative Windows Credentials
|
Security |
By
default WCF will use the security token on the calling client for
authenticating it. However, you can easily supply alternative
credentials (usually via some log-on dialog) as shown in the download. |
15/07/2007 |
|
Windows Role-Based Security
|
Security |
By
default WCF will use Windows groups to authorize the caller. You can
use the PrincipalPermission attribute to demand that the caller is a
member of such a role, as shown in the download. The caller can use its
own interactive security token or custom credentials. |
07/09/2006 |
|
Windows Identity Management
|
Security |
When
using Windows accounts, the client can restrict to what degree the
service can impersonate it. The service can decide to use its own
identity or try to impersonate the client. The download contains a
client that provides UI for custom credentials and also allowed
impersonation level. The service will try to impersonate the client
using the OperationBehavior attribute and a custom hosting behavior the
impersonates all callers automatically. In addition, the service
displays a detailed report in its constructor and in the operation. The
report contains the incoming client identity, the process identity, and
the principal identity. |
07/09/2006 |
|
Username Message Security and Windows credentials
|
Security |
WCF
lets the client provide simple username and password credentials to the
service. The credentials can in turn be mapped to Windows accounts on
the service side, as shown in The download. In addition, The download
shows how to configure both on the client and service side the
certificate used to encrypt the credentials and the message body itself,
and how to configure message transfer security for username credentials
type. |
07/09/2006 |
|
Custom Credentials using ASP.NET Providers
|
Security |
WCF
lets the client provide custom credentials and have the service
authenticate the client by looking up the credentials in the ASP.NET
membership data base in SQL Server. Once authenticated, the service can
use role-based security to authorize the user against the custom roles
in the data base. The download shows how to configure both on the client
and service side the certificate used to encrypt the credentials and
the message body itself, and how to configure message transfer security
for ASP.NET providers on the service and the client, how to configure
for ASP.NET providers membership and roles, how and when to supply the
application name, and additional settings required for the providers.
The service also displays identity report. |
07/09/2006 |
|
Credentials Manager for WCF
|
Security |
Both
Internet and Intranet applications often require a custom store for
user accounts and roles. ASP.NET 2.0 provides an out-of-the-box provider
model as well as a SQL Sever database just for that propose.
Unfortunate, the only way to administer the credentials databases is via
Visual Studio 2005, and only for local web applications. This solution
is a full-blown custom security management application that
administrators can use. The application presents a rich user experience,
and can administer the store remotely. The application wraps the
ASP.NET 2.0 providers with a WCF service that can be self-hosted or
hosted in IIS, and even adds missing features. The download contains the
Credential Manager client, the CredentialsService and host. |
07/09/2006 |
|
Business to Business
|
Security |
Two
interoperating business partners may often opt for a private, secure
communication using each other certificate for mutual authenticate. The
download shows the required configuration on the service and client
side, a batch file for generating and installing the certificates, how
to deal with test certificates, and how to configure for message
transfer security using certificate. |
07/09/2006 |
|
Anonymous
|
Security |
A
WCF service may opt for not authenticating its clients and allowing
anonymous access, and yet it should do so without compromising the
message privacy and integrity. The download shows the required
configuration setting for allowing anonymous access and still using the
service certificate for security the message. |
07/09/2006 |
|
Specifying application name in config for ASP.NET providers
|
Security |
This
demo is just like the Custom Credentials using ASP.NET Providers demo
except it shows how to specify the application name for the Membership
and Roles provider using a config file. |
07/09/2006 |
|
Business to Business with ASP.NET roles
|
Security |
While
using a certificate to authenticate the client, you can still rely on
ASP.NET security. The download demonstrates the required steps to
configure the host and to add the certificate to the ASP.NET role
provider. |
07/09/2006 |
|
Demanding Protection Level
|
Security |
When
using the Intranet bindings, WCF allows the contract developer to
demand a protection level when dealing with sensitive contracts or
operations. The download demonstrates this technique by setting the
ProtectionLevel property of the ServiceContract attribute. |
07/09/2006 |
|
Security Audit
|
Security |
WCF
supports security audits - it can dump to the event log security
related events in your services such as authentication and authorization
attempts, their time and location, and the client’s identity. This
solution demonstrates the required config settings to use the
ServiceAuthorizationBehavior. |
07/09/2006 |
|
Code-Access Security - Partial Trusted Clients
|
Security |
By
default, WCF offers very limited support for partially trusted clients,
and most scenarios require full trust. To restore support for
partially trusted WCF clients, IDesign provides PartialTrustClientBase,
used very much like the regular proxy base class, without compromising
on the WCF programming model or on code-access security.
PartialTrustClientBase supports partial trust callers. It analyzes
the context of the call and demands the appropriate permissions. This
is a collection of some 16 demos showing various cases of partial
trusted clients trying to rely on various aspects of WCF. |
30/10/2008 |
|
Code-Access Security - Partial Trusted Hosts
|
Security |
By
default, WCF offers very limited support for partially trusted hosts,
and most scenarios require full trust. To restore support for partially
trusted WCF clients, IDesign provides AppDomainHost, used very much
like the regular host, without compromising on the WCF programming model
or on code-access security. AppDomainHost supports hosting a service
in a partial trust environment. It analyzes the context of the hosting
and demands the appropriate permissions. The service itself is hosted
in a separate app domain, and you can provide the exact permissions for
the service app domain to execute in partial trust sandbox. This is a
collection of some 14 demos showing various cases of partial trusted
hosts trying to rely on various aspec |
30/10/2008 |
|
Code-Access Security - Partial Trusted Service via AppDomainHost
|
Security |
Even
though the hosting code may have full trust, you may want to host the
service itself in partial trust, to reduce the surface area for attack
and to run the service in a virtual secure sandbox. You can use
IDesign's AppDomainHost to specify exactly the permissions to grant the
service, and AppDomainHost will place the service in a separate app
domain with those permissions You can specify the permissions
individually, or using a permission set file, or use a standard
permissions set. You can even host the same service multiple times, each
with a different permissions set, as shown in the demo. |
30/10/2008 |
|
End to End Authentication - Oneway Relay Binding
|
Service Bus |
When
securing a service bus call with the NetOnewayRelayBinding (and the
NetEventRelayBinding), as with the other bindings, you can use transport
or message security. Unlike the TCP or the WS relay bindings, using
message is sufficiently different, because the is no certificate
negotiation. You will find here several ways of configuring end-to-end
security with the oneway relay binding: transport security, anonymous
message security, and message security with username credentials as
Windows credentials or as ASP.NET providers. you will also see the
IDesign helper classes that streamline the client and the host side.
|
22/01/2010 |
|
End to End Authentication - TCP Relay Binding
|
Service Bus |
A
collection of demos showing many ways of configuring transfer security
with the NetTcpRelayBinding: transport (the default), anonymous message
security, message security with user name credentials as Windows
credentials, message security with user name credentials as ASP.NET
providers credentials, message security with certificate credentials,
and mixed transfer security, both with interactive and alternative
Windows credentials. In addition, there are several demos showing the
IDesign helper classes and base classes that automate configuring
message security both for the client and for the host. |
22/01/2010 |
|
Declarative Security
|
Service Bus |
Similar
to the attribute-based declarative security for regular WCF, IDesign
provides support with the SecurityBehaviorAttribute for the service bus.
The attributes defaults to anonymous message security, but can be
configured for having credentials as well. No other transfer security
configuration is needed. |
22/01/2010 |
|
End to End Authentication - WS Relay Binding
|
Service Bus |
The
WS relay binding (WS2007HttpRelayBinding) only supports Transport and
Mixed (TransportWithMessageCredentials). It does not support Message
security. This is a collection of demos showing several ways of
configuring transport security, mixed transfer security, both with
interactive and alternative Windows credentials. In addition, there are
several demos showing the IDesign helper classes and base classes that
automate configuring security both for the client and for the host. |
23/01/2010 |
|
Events Relay Binding
|
Service Bus |
A simple demo showing the collaborative abilities of the NetEventRelayBinding, enabling a distributed chat application. |
22/01/2010 |
|
Simple Publish-Subscribe
|
Service Bus |
When
using the NetEventRelayBinding, you treat the service bus as an events
hub, rather than a mere relay service. This demo shows how to use the
service bus to support a simple publish-subscribe pattern. It is simple,
because the subscribers have no way of subscribing to discrete events. |
22/01/2010 |
|
Publish-Subscribe
|
Service Bus |
When
using the NetEventRelayBinding, you treat the service bus as an events
hub, rather than a mere relay service. However, out of the box, there is
no support for subscribing for discrete events, and the subscribers
receive (and pay!) for all the events, even those they do not care
about. This demo shows the IDesign helpers classes that enable a
sophisticated publish-subscribe patter with support for discrete events.
There is a dedicated host type and a proxy class, complete with message
security. |
22/01/2010 |
|
Publish-Subscribe and User Interface Updates
|
Service Bus |
This
demo shows how to use the service bus to distribute events (with the
NetEventRelayBinding) and have the events update some user interfaces.
It uses the IDesign FormHost as well as extensions for security. |
22/01/2010 |
|
The Service Bus Explorer
|
Service Bus |
An
important tools that takes off the blinders when using the service bus.
The tool visualize your service bus assets, both services, subscribers
and buffers. The tool accepts the service namespace to explore, and
after logging in to the feed will visualize for you the running
services. All the explorer does is parsing the ATOM feed and placing the
items in the tree to the left. You can explorer multiple service
namespaces, and see in the right pane your Windows Azure AppFabric
platform service bus administration pages. |
22/01/2010 |
|
The Oneway Relay Binding
|
Service Bus |
A
simple demo showing that the NetOnewayRelayBinding works well in an
unknowns service state, that is, the service may or may not be running,
and that there is never a transport session with the service instance
(unless a singleton), every call always gets a new instance. |
22/01/2010 |
|
Buffers with raw messages
|
Service Bus |
The
default programming model of the service bus buffers is to interact
directly with raw WCF messages. This demo shows how to send and retrieve
such messages, and a crude parsing of the content. |
22/01/2010 |
|
Buffered Services, with structured, type safe object programming
|
Service Bus |
The
default programming model of the service bus buffers is to interact
directly with raw WCF messages. The result is a cumbersome, tedious,
non-structured, non object-oriented and not type safe programming model.
The demo shows the IDesign framework for a structured, type-safe
programming model over the service bus buffers. A dedicated host and
proxy classes allow you the same programming model as with regular WCF,
while the calls actually go to and from the service bus buffers. The
framework uses some advanced WCF techniques, such as converting raw WCF
messages into calls on a WCF channel. |
22/01/2010 |
|
Buffered Response Service
|
Service Bus |
Similar
to queued calls over MSMQ, by default, there is no way to get results
or errors out of a call to a buffer. The demo shows the IDesign helper
classes that solve that by providing a response buffer for the service
to respond to. The IDesign framework automates passing the response
buffer and the individual calls IDs in the message headers, as well as
creating host, proxy, and a proxy to the response service. It yields the
same programming model exactly as with the MSMQ response service. |
22/01/2010 |
|
Service Bus Authentication
|
Service Bus |
The
.NET Service Bus service utilizes the Access Control Service (ACS) of
the Windows Azure AppFabric platform to authenticate its callers. The
client and the service need to present a security claim issued by the
ACS. The service host must always authenticate, and so does the client
(by default). However, the host may exempt the client from
authenticating. This is a collection of several demos showing service
bus authentication: how to provide the ACS shared secrete
programmatically, how to provide the shared secrete in a config file,
how to configure the host and the client to exempt the client from
authentication (both in the behaviors and in the binding). The demos
also contains the IDesign helper classes and extensions that greatly sim |
22/01/2010 |
|
Duplex Callbacks
|
Service Bus |
The
NetTcpRelayBinding supports duplex callbacks through the service bus.
Setting up the duplex calls, accessing the callback reference and all
the other details of the duplex callbacks are identical to the regular
TCP binding. Presently, NetTcpRelayBinding is the only relay binding
which supports duplex callbacks. |
22/01/2010 |
|
Hybrid Calls
|
Service Bus |
When
configured with TcpRelayConnectionMode.Hybrid, the service first
connects to the relay service and then the client connects. However, at
this point, the relay service will promote the connection to a direct
connection between the client and the service, by telling the client how
to reach the service directly, allowing the client to continue calling
the service directly. The hybrid mode should be the preferred connection
mode of NetTcpRelayBinding. However, it has one drawback: it requires
the binding to use Message security which requires additional
configuration and setup. The demo shows the IDesign extensions that
automate and streamline hybrid configuration. |
22/01/2010 |
|
WS Relay Binding
|
Service Bus |
The
Ws2007HttpRelayBinding defaults to Transport security. The demo shows
the IDesign extensions that streamline using the Ws2007HttpRelayBinding
by automating the security configuration. |
23/01/2010 |
|
Transactional Behavior
|
Transactions |
The
IDesign TransactionalBehavior attribute lets you maintain the regular
non-transactional programming model of statefull services with normal
member variables, and yet have the service automatically roll back any
change to those members if the transaction aborts. This has the same
effect as if all members were volatile resource managers. The attributes
utilizes the durable services support in WCF to store the instance
state into the IDesign transactional dictionary, used as as a
persistence provider. |
24/01/2009 |
|
TransactionalBehavior - InProcFactory
|
Transactions |
This
demo shows how to combine the IDesign TransactionalBehavior attribute
with the in-proc factory, so that you could mimic the conventional
programming model of C#, without any of the ownership overhead of WCF
(managing hosts, proxies and config files) and still benefit from
transactions. |
24/01/2009 |
|
TransactionalBehavior - InProcFactory Wrapper
|
Transactions |
This
demo shows how to combine the IDesign TransactionalBehavior attribute
with the in-proc factory, and how to encapsulate the very use of the
factory with the IDesign WcfWrapper class, that complete hides the very
use of WCF. As a result, you program just as with normal C#, without
interacting with any hosts, proxies and config files and still benefit
from WCF. |
24/01/2009 |
|
Transaction Flow
|
Transactions |
In
WCF transaction flow between the client and the service is a product of
the TransactionFlow value in the binding, the TransactionFlowOption in
the contract operation. In addition the service will use the client
transaction only if it configured for requiring a transaction scope and
if the client has a transaction to flow. The download contains a simple
banking application showing how to configure the system so that the
client can interact with two different account services and yet scope
both in a single transaction.
|
07/09/2006 |
|
Concurrent Transactions
|
Transactions |
WCF
allows you to combine the work of multiple threads in a single
transaction. You need to provide each worker thread with a clone of the
original transactions, and signal to the original client thread when the
worker threads have completed their work. The download shows a simple
banking application where the client uses multiple threads to interact
with the account services, demonstrating this complex topic and a few
related issues such as passing the transaction between threads and
synchronizing completion. |
07/09/2006 |
|
Volatile Resource Managers
|
Transactions |
A
transactional service can interact not just with databases but also
with volatile resource managers. The download makes use of IDesign’s
implementation of the transactional collections (now part of MSDN). The
service and client configuration is exactly the same as with the
database-centric solution. |
07/09/2006 |
|
Duplex Transactions
|
Transactions |
In
general, transactions and duplex callbacks do not mix well. Callbacks
are usually one-way operations which cannot flow transactions, and
transactional services are often single-threaded, which precludes
flowing the service transaction to the client during a service call.
However, the service can be configured for reentrancy and to disable
releasing the instance once the transaction completes. Doing so will
enable the service to flow its transaction to the callbacks. The service
can also store the callback references for later use, in which case, as
shown by The download, a service-side transaction can flow to the
client. You will need to configure the callback client for transaction
just as with a service. |
07/09/2006 |
|
Transactional singleton
|
Transactions |
By
default a transactional singleton behaves like a per-call service. You
can however disable releasing the instance once the transaction
completes and maintain the semantic of the singleton. You will also need
to have at least one transactional method as shown in the download. |
07/09/2006 |
|
Requiring Transaction Flow
|
Transactions |
When
using the Client/Service transaction mode, the service is configured to
allow transaction flow, and yet WCF will not enforce the use of a
transaction-aware binding at all, or the use of a transaction-aware
binding with TransactionFlow enabled. To tighten this loose screw use
the IDesign BindingRequirementAttribute to enforce the use of a
transaction-ware binding with TransactionFlow set to true. The
BindingRequirementAttribute is a nice example for a general-purpose
technique you can use to enforce any binding requirement. For example,
BindingRequirementAttribute has another property called WCFOnly which
enforces the use of WCF-to-WCF bindings only, and a property for
requiring reliability. You can also use the BindingRequirementAttrib |
24/02/2007 |
|
.NET Downloads
|
|
|
Title |
Category |
Description |
Last Updated |
|
Deterministic finalization template
|
.NET Essentials |
There
is a lot of details involved in implementing a bullet-proof Dispose()
and Finalize(), especially when inheritance is involved. The file is a
generic template that handles class hierarchy, threading, multiple calls
to dispose and finalization.
|
25/10/2005 |
|
Dynamic Factory
|
.NET Essentials |
This
sample demonstrate using interfaces to define a contract between client
code and components that will be dynamically loaded as providers after
the client has been built and shipped. It uses a generic type factory
method to dynamically load provider assemblies and invoke their
functionality based on a provider interface contract. It also
demonstrates the use of Visual Studio 2005 Settings to enter runtime
information into the config file and access it through the strongly
typed settings class. The zip file contains a readme.doc with more
information on the structure and use of the sample. |
20/11/2005 |
|
Assembly Aliasing
|
.NET Essentials |
.NET
2.0 allows you to resolve conflicts with type name collisions by
aliasing one of the references. Using the extern alias directive, you
can instruct Visual Studio 2005 to root the reference in the alias, not
the global namespace. The application demonstrates this technique. |
25/10/2005 |
|
EXE Reference
|
.NET Essentials |
Visual
Studio 2005 allows you to add a reference to an EXE application
assembly, not just to DLL (class libraries). The zipped application
demonstrates this technique. |
25/10/2005 |
|
Friend Assembly
|
.NET Essentials |
In
some cases (such as unit testing or assembly decoupling), one assembly
may need to access the internal types of another assembly. .NET 2.0
supports this using the InternalsVisibleTo attribute. The zipped
application not only demonstrates this technique, it also contains a
helper utility that you can use to browse to a client assembly, and copy
to the ClipBoard the fully configured InternalsVisibleTo attribute. |
25/10/2005 |
|
Visualizers
|
Application Frameworks |
Visualizers
are an impressive feature of Visual Studio 2005 allowing you to provide
custom debug-time visualization of data types. The zip file contains
three such visualizers – bitmap visualizer, RGB color visualizer and
sound visualizer (nicknamed Au
|
22/10/2005 |
|
Safe Controls
|
Application Frameworks |
Windows
Forms requires that only the thread that created the window or control
can access it. This imposes a cumbersome error prone programming model.
The zip file contains a few common controls that derive from the
built-in controls and can be accessed from any thread, as if no threads
were involved. These control are likely to be updated by worker threads
when multithreading is involved. The list includes a safe button, a safe
label, a safe list box, a safe progress bar, a safe status bar and a
safe text box. |
25/10/2005 |
|
SQL Express Scripter
|
Application Frameworks |
This
tool allows you to run an arbitrary SQL script against a SQL 2005
Express database. To use it, you provide the path to the SQL Express
database (the .mdf file) and a SQL script. You can either load an
existing script from file, or you can type one into the textbox in the
form. The script needs to have each Data Definition Language (DDL)
statement terminated by a GO statement and a line feed. When you press
the Execute button, a connection will be opened to the database file and
the script executed against it.
|
22/10/2005 |
|
WinFormsEx
|
Application Frameworks |
A
collection of IDesign’s helper classes and utilities for Windows Forms,
including: BackgroundWorker for .NET 1.1, custom security controls
wrapping ASP.NET 2.0 security providers and matching custom principals
for any custom credential store, safe controls that can be called by any
thread, a singleton Windows Forms application, network connection
utility for disconnected applications, EventsHelper for safe synchronous
and asynchronous event firing, visual events base classes, splash
screen and imported functions from Win32 API, useful when interoperating
with legacy applications. |
25/10/2005 |
|
BackgroundWorker Demo
|
Application Frameworks |
Windows
Forms applications often require some sort of asynchronous invocation
option. Windows Forms poses a set of complicated design and
implementation issues when it comes to asynchronous invocation due to
the underlying Windows messages processing. .NET 2.0 provides the
BackgroundWorker component to facilitate easy asynchronous invocation
with Windows Forms. The demo shows how to use the component correctly
and when and where to set and access its methods and properties. |
25/10/2005 |
|
BackgroundWorker for .NET 1.1
|
Application Frameworks |
Even
after .NET 2.0 ships, Windows Forms 1.1 developers are forced to use a
cumbersome programming model when it comes to asynchronous execution of
background work. The download contains IDesign's implementation of the
.NET 2.0 BackgroundWorker control, done as a .NET 1.1 component, so that
.NET 1.1 developers can use it, and ease the transition to Windows
Forms 2.0. |
25/10/2005 |
|
Isolated Storage Settings Helper
|
Application Frameworks |
Smart
client applications often need to store application settings in a
partial trust environment. For strongly typed settings building
applications with Visual Studio 2005, user settings can be written in
partial trust once .NET 2.0 releases. In addition, sometimes you may
need to store ad-hoc settings in separate files and you may not want to
use user settings for those settings. Isolated storage provides a good
place to put custom settings that can be written to in partial trust.
This helper class allows you to read and write custom settings |
25/10/2005 |
|
Online/Off line Smart Client
|
Application Frameworks |
.NET
2.0 makes it possible to monitor network events, in particular, the
NetworkChange.NetworkAvailabilityChanged event, which lets you know when
the network connectivity status has changed. This is instrumental is
writing smart client applications that communicate with the server over
the network, and can switch to a disconnected mode and back to on-line
mode. The demo application monitors this event and changes its status
and UI accordingly. All that is missing is the ability to query for the
status of the network on start up time, and the demo application
demonstrates how to do that as well. |
25/10/2005 |
|
Windows Forms error provider control
|
Application Frameworks |
The
error provider is a little-known Windows Forms control, which lets
developers provide visual feedback to the user about errors or
inconsistencies in the form. |
25/10/2005 |
|
GDI+
|
Application Frameworks |
Demonstrates
using GDI+ for simple graphical rendering in Windows Forms. The
application contains a TrafficLight GDI+ control that you can control
manually or using a timer. . |
25/10/2005 |
|
Windows Forms opacity
|
Application Frameworks |
Advanced (and yet easy) blending and fading using Windows forms Opacity property. |
25/10/2005 |
|
Windows Forms Custom Browser
|
Application Frameworks |
The
demo shows how to build in only a few lines a custom web browser using
the .NET 2.0 WebBrowser control, and the related ClickOnce
configurations. |
25/10/2005 |
|
Web services and type-safe ADO.NET 2.0 data sets
|
Application Frameworks |
Web
services are tightly integrated with ADO.NET 2.0 type-safe tables and
data sets. The tables are serializable, not just type safe. It is
possible to load and store an entire type-safe datasets using web
services. This demo provides all that, including XML conversion of the
dataset, and a Windows Forms test client that presents the remote
dataset, allowing the user to update and store it using the web service.
|
25/10/2005 |
|
Windows Forms Splash Screen
|
Application Frameworks |
The
SplashScreen is a helper class that displays a splash screen (such as
the one used by Outlook or Visual Studio) during application startup. |
25/10/2005 |
|
Composite Extensions For Windows Forms
|
Application Frameworks |
Composite
Extensions for Windows Forms allows you to use the patterns and
capabilities of Composite Application Guidance for WPF (aka Prism) in a
Windows Forms application as well. Specifically, you can use the modular
loading and loosely coupled pub-sub events model of Prism using some
extensions written by IDesign architect Brian Noyes that build on top of
the CAL libraries that come with Prism. You can also use dynamic
injection of views into a region in a similar form to the way Prism does
it using the IoC container, demonstrated in the sample application
included in this code. |
14/10/2008 |
|
BindingList<T>
|
Application Frameworks |
The
class BindingList<T> can be used like a normal linked list, with
one important additional feature – you can receive events when the state
of the list changes. This is instrumental in replacing timers or
polling techniques used to monitor the linked list (and update user
interface for example). The demo contains a simple Windows Forms client
that uses BindingList to keep a list box up to date with the content of
the list. |
25/10/2005 |
|
Asynchronous Load
|
Application Frameworks |
.NET
2.0 introduces a new asynchronous method invocation pattern, which
makes sure the callbacks to the client are always made on the correct
thread (as if BackgroundWorker was used). Several controls and classes
support this pattern. The demo applications used the PictureBox ability
to download an image asynchronously using this pattern, and it also
demonstrates related PictureBox techniques such as cancellation,
progress reports, and async temporary image to be used while
downloading. |
25/10/2005 |
|
Windows Forms Singleton
|
Application Frameworks |
By
default, every time a Windows Forms application starts, .NET launches a
new process. This utility contains an alternative Application object
which enables a singleton application - if an instance is already
running, it ignores the request to create a new instance. It also uses a
.NET 2.0 named pipe channel to restore the existing window. |
06/11/2006 |
|
Windows Forms and Windows messages
|
Application Frameworks |
The
demo shows how to send messages from a Windows Forms application to
another Window, and how to intercept Windows messages in a Windows Forms
app. These techniques are especially useful when interacting with
legacy Windows applications. |
25/10/2005 |
|
ASP.NET 2.0 server side Back control
|
Application Frameworks |
Common
techniques for implementing a Back link on a web page involve using the
browser-side script. There are a number of disadvantages to this
solution: the application has no control over where the user is going to
be redirected. Often you want to keep the user inside the application,
and you do not want them to wonder off to other pages, and it only works
if the browser supports client-side script. The biggest disadvantage is
that it is not consistent with the ASP.NET programming model of
server-side controls. There is also no easy way to enable or disable the
back link based on server-side event processing. The download contains a
server-side user control, which provides the Back functionality. Simply
add it to your toolbox, and drop it on your forms. |
25/10/2005 |
|
ADO.NET 2.0 data binding
|
Application Frameworks |
Demonstrates
Windows Forms automatic binding to ADO.NET 2.0 data binding source via a
data set, as well as using the type safe data adaptor for updates,
inserts and deletions. |
25/10/2005 |
|
Linking files in VS 2005
|
Application Frameworks |
Demonstrating
VS 2005 ability to share files across assemblies by linking them. This
allows for solution-wide info file, containing version number and other
solution level attributes such as strong name, without the need to
duplicate files. |
12/01/2006 |
|
Improved Property Snippet
|
Application Frameworks |
This
simple code snippet simplifies property declaration complying with the
IDesign coding standard. Specifically, member variables on a class
should be private, with a wrapping public property. The name of the
member variable should be the name of the property, prefixed with m_. |
24/10/2005 |
|
Windows Forms Control Decorator
|
Application Frameworks |
This
sample includes a Visual Studio 2005 Add-in project that creates an
Add-in that makes designing Windows Forms much easier. When you design a
form, you drag and drop controls on the form from the Toolbox, and then
you have to go select each one and set its properties. You end up
setting the (Name) and Text properties for almost every control on the
form, but doing so requires a lot of mousing around to select the
controls, then the appropriate property in the Properties window, and
then you repeat over and over for each control. With this add-in, you
just bring up the Control Decorator, and you can rapidly set the (Name)
and Text properties for each control on the form through rapid keystroke
entry. The readme file in the project direct |
11/11/2005 |
|
Interface-based web services
|
Application Frameworks |
.NET
2.0 adds support for interface-based web services. Separation of
interface from implementation is crucial for component-oriented
development. Doing so allows the web service consumer to program against
an abstract service definition (the interface), and switch service
provides (interface implementers) without affecting its code. However,
also need to tweak VS 2005 to expose and consume those interfaces for
you using partial classes and shim classes. The sample is a web service
that is interface, not method based, as well as a test client. |
25/10/2005 |
|
My for C# 2.0
|
C# |
The My class in VB often simplifies and streamlines many operations,
from Network programming to clipboard, to audio access, and so on. What
takes sometimes a programming fit in C# can be done in one line using
the My class in VB. If VB has Me and My, then C# should have this and
That. The That class is the C# equivalent of the VB My class. It is a
static class that uses the VB implementation as much as possible, and it
requires adding a referencing to Microsoft.VisualBasic. The That class
is instrumental when working in heterogeneous environments and when
dealing with in porting of VB to C# or visa-versa. |
25/10/2005 |
|
Interface-based events
|
C# |
.NET
Events are method based. If you want to subscribe whole interface, you
have to subscribe multiple times, once per method, and you are coupled
to the publishing class' event member variables. The zip file shows how
to subscribe interfaces instead of individual methods, and how
well-encapsulated the publishing class becomes as a result. It also
approximates the Indigo callback programming model. |
25/10/2005 |
|
Generic Array
|
C# |
The
Array class offers numerous generic static methods that automate and
streamline many common operations on arrays. The methods are especially
handy when combined with anonymous methods, as shown by the demo. |
13/01/2006 |
|
EventsHelper
|
C# |
When
publishing events in C#, you need to test that the delegate has
targets. You also must handle exceptions the subscribers throw,
otherwise, the publishing sequence is aborted. You can iterate over the
delegate’s internal invocation list and handle individual exceptions
that way. The zip file contains a generic helper class called
EventsHelper that does just that. EventsHelper can publish to any
delegate, accepting any collection of parameters. EventsHelper can also
publish asynchronously and concurrently to the subscribers using the
thread pool, turning any subscriber’s target method into a
fire-and-forget method. EventsHelper also marshals the callbacks
correctly to a Windows Forms client, and bets of all, it can be type
safe as well. |
25/10/2005 |
|
List<T> generic methods
|
C# |
The
List<T> class offers numerous generic methods that automate and
streamline many common operations on list (similar to the static methods
of the Array type). The methods are especially handy when combined with
anonymous methods, as shown by the demo. |
22/10/2005 |
|
Recursive iterators
|
C# |
The
C# 2.0 Iterators feature shines especially when it comes to
implementing an iterator over a recursive data structure such as a
binary tree. The demo shows a simply binary tree that supports
IEnumerable using recursive iteration. |
25/10/2005 |
|
Iterators
|
C# |
C#
2.0 makes it trivial to implement and support the iterator design
patter using the yield return statement. The demo application shows how
to use this feature to support iteration over a generic linked list. It
shows how to correctly implement IEnumerable<T> by delegating from
the non-generic base interface to the generic interface, and it also
shows what will be involved in implementing the same iterator manually.
|
13/01/2006 |
|
Generics Performance
|
C# |
This
demo is a micro-benchmark application, which executes a stack in a
tight loop. The application lets you experiment with value and reference
types on an Object-based stack and a generic stack, as well as changing
the number of loop iterations to see the effect generics have on
performance. |
25/10/2005 |
|
Generic Linked List
|
C# |
This
solution demonstrates C# 2.0 generic constraints by implementing a
generic linked list with search functionality. It also demonstrates the
use of IComparable on primitive types. |
25/10/2005 |
|
Generic Reflection
|
C# |
This
console application demonstrates reflection of a generic type. The
application reflects the name of the bounded type and its bounded
generic type parameters, as well as reflecting the unbounded types with
the generic type parameters. |
25/10/2005 |
|
Collection helper class
|
C# |
In C# 2.0, the Array class and List
come with built-in generic methods to easily manipulate and streamline
the underlying data structure, there is no such support available for
any other collection, such as Dictionary or LinkedList.
In C# 3.0, the LINQ infrastructure adds that and much more for virtually any collection.
The demo contains a utility static class called Collection, that similar to Similar to Array and List,
uses the same generic delegates to offer a comprehensive set of helper
methods, and not only that, Collection adds many of the LINQ features to
mere C# 2.0 applications. |
13/09/2007 |
|
Utilities and helper classes
|
Enterprise Services |
A
set of helper utilities including a base class for a service, a base
class for a data access component, a transaction context object,
transient subscription manager, event class filter, and unified security
principal. |
25/10/2005 |
|
Loosely-coupled events: persistent subscriber
|
Enterprise Services |
.NET
Enterprise Services provide a mechanism for loosely coupled event
subscription and publishing. This mechanism relies on COM+ events, not
on delegates, and it improves on many of the delegate model shortcoming.
This sample demonstrates persistent subscribers. |
25/10/2005 |
|
ES Component Remover
|
Enterprise Services |
This
tool allows you to easily set up a custom build event to shut down
Enterprise Services server applications and remove all their components
as part of a development build process in Visual Studio. Using this tool
as a pre-build event for an Enterprise Services class library project,
in combination with additional post-build events to re-register the
assembly and components will help you have a smooth, repeatable build
process for developing Enterprise Services applications. |
22/10/2005 |
|
Loosely-coupled events: transient subscriber
|
Enterprise Services |
.NET
Enterprise Services provide a mechanism for loosely coupled event
subscription and publishing. This mechanism relies on COM+ events, not
on delegates, and it improves on many of the delegate model shortcoming.
This sample provides transient subscriber support, something that does
not exists in .NET out of the box. Any class (not just a
ServicedComponent-derived class) can be a transient subscriber. In
addition, the demo uses generics to enforce type safety with the
subscribers. |
25/10/2005 |
|
Object pooling
|
Enterprise Services |
Demonstrates using Enterprise Services object pooling, the required steps and methods of ServicedComponent you need to override. |
25/10/2005 |
|
Queued components
|
Enterprise Services |
Demonstrates using Enterprise Services queued components, for asynchronous, disconnected calls. |
25/10/2005 |
|
Transactional component
|
Enterprise Services |
Demonstrates developing a transactional serviced component that uses ADO.NET. |
25/10/2005 |
|
Transactional web services
|
Enterprise Services |
Web
services are tightly integrated with Enterprise Services. Web methods
can be the root of a new transaction, even if the web service is not a
serviced component. The app demonstrates a transactional web service. |
25/10/2005 |
|
Transactions and Windows Forms
|
Enterprise Services |
Demonstrates using transactional serviced component by a Windows Forms client. |
25/10/2005 |
|
Transactional context utility
|
Enterprise Services |
Allows
a non-serviced component to act as if it is in a transactional context,
by introducing a middleman that creates components for it. Without it,
the semantic of the transactions created will be wrong, and often
deadlocks will happen. This is one of the ways you can approximate
TransactionScope in .NET 1.1. |
14/11/2005 |
|
Serviced Component Installer
|
Enterprise Services |
The
installer is a utility that automates a clean installation of your
serviced components. You will need to add it to a setup and deployment
project so that you can create an MSI to deploy all your serviced
component class libraries to a server and get them registered in the GAC
and pre-registered with COM+ in one easy step. The enclosed zip
contains the installer class that you add to each ES class library
project and a short set of instructions stepping you through the
creation and configuration of the Setup and Deployment project to create
the MSI. |
13/01/2006 |
|
The Enterprise Services Logbook
|
Enterprise Services |
The
Enterprise Services logbook is a comprehensive logbook for serviced
components. It logs almost every aspect of the invocation, such as
location, types, methods, serving as your Enterprise application flight
recorder. The logbook logs into SQL Server, and it supports both in-line
logging and queued logging (first to MSMQ then to SQL server). You can
also use it to manually add entries to the logbook. The logbook can be
set up to be in a separate transaction and in a separate process.
|
13/01/2006 |
|
SOAP Headers and Security and ASP.NET 2.0 Security
|
Security |
You
can store custom credentials in the ASP.NET 2.0 database, and then use
SOAP headers authenticate calls to your web service. The demo shows how
to use SOAP headers for authentication, and it contains a test client as
well. |
25/10/2005 |
|
SOAP Headers Statefull Security and ASP.NET 2.0 Security
|
Security |
When
using SOAP headers for authentication, you pay the overhead for
authentication in each call. This demo shows how to use cookie to record
the fact the caller is already authenticated, and it contains a test
client as well, and doing all that while using the built-in security
store of ASP.NET 2.0. |
25/10/2005 |
|
Unified Windows Forms and ASP.NET Security - ASP.NET providers
|
Security |
This
demo application shows how Windows Forms application can take advantage
of the ASP.NET 2.0 credential management store and provider model. It
contains the AspNetLoginControl – a custom Windows Forms control that
authenticates users directly against the ASP.NET 2.0 configured
credentials store in SQL Server 2000. It also installs custom security
principal that authorizes users against the roles in the database, and
enforces authorization. The application provides the login dialog and
other controls such as a log in status bar. The application also
contains a custom code-access security permission set that should be
granted to the application under partial trust. |
25/10/2005 |
|
Unified Windows Forms and ASP.NET Security - Over Web Services
|
Security |
This
demo application shows how Windows Forms application can take advantage
of the ASP.NET 2.0 credential management store and provider model. It
contains the WSLoginControl – a custom Windows Forms control that
authenticates users using a web service that wraps the ASP.NET 2.0
credentials store in SQL Server 2000. Doing so caters for partial trust
deployment, because the web service does not flow the server-side
security demand to the client. The web service can be used by any number
of applications, and the applications can in turn consume any web
service that supports the same interface for credentials management. The
log-in control also installs custom security principal that authorizes
users against the roles in the database. The application provides the
login dialog and other controls such as a log in status bar. The Visual
Studio 2005 also contains the required security permissions when
deploying the client app using ClickOnce. |
25/10/2005 |
|
Unified security model
|
Security |
A
custom .NET security principal that retrieves the role-based security
information from the COM+ catalog. This allows even non-serviced .NET
components to take advantage of the COM+ explorer to configure roles.
The custom principal can use COM+, .NET or both for roles information
(look both in the COM+ catalog and in the Windows groups for a match).
Using the unified security principal requires only adding a single line
of code to your application Main(). The zip file contains the custom
principal, a client project and an MS
|
13/01/2006 |
|
Log-in Web Service and ASP.NET 2.0 security
|
Security |
Using
the ASP.NET 2.0 security credentials store, you can authenticate the
credentials of callers to your web service using a dedicated log-in
method, and even provide a log-out method. The zip file contains a base
class you can derive from, which defines these methods, installed a
principal, and records the fact the caller is authenticated. You can
even use the standard PrincipalPermission attribute to insist on
authentication for sensitive methods. The zip contains a test client as
well. |
25/10/2005 |
|
Web Service and Impersonation
|
Security |
If
the callers to your web service have Windows accounts, you may want to
impersonate them. This demo shows the required steps: it logs on the
caller, impersonates it, and attaches a custom principal for the HTTP
context and the thread with the new identity. Once the call returns, the
identity is reverted. The zip contains a test client as well. |
13/01/2006 |
|
Credential Manager
|
Security |
Both
Internet and Intranet applications often require a custom store for
user accounts and roles. ASP.NET 2.0 provides an out-of-the-box provider
model as well as a SQL Sever database just for that propose.
Unfortunate, the only way to administer the credentials databases is via
Visual Studio 2005, and only for local web applications. This download
is a full-blown custom security management application that
administrators can use. The application presents a rich user experience,
and can administer the store remotely. The application wraps the
ASP.NET 2.0 providers with a web service and even adds missing features.
The zip file contains the Credential Manager smart client, the
CredentialsService web service, and a help file. |
23/10/2005 |
|
Role-based security
|
Security |
The app demonstrates basic .NET role-based security, and the required app domain initialization steps. |
25/10/2005 |
|
App domains
|
System Programming |
Demonstrates creating new app domains, and injecting objects in it.
|
25/02/2007 |
|
Custom context attribute
|
System Programming |
A
sample custom context attribute that lets you extend a .NET context.
This sample adds a color attribute to a .NET context. The zip file
contains a comprehensive demo client with graphic illustrations of the
actual activation context. |
25/10/2005 |
|
Generic Custom Serialization
|
System Programming |
This
demo uses GenericSerializationInfo – a wrapper class around
SerializationInfo, because SerializationInfo was designed without
generics in mind. GenericSerializationInfo provides for easy, elegant
and type-safe custom serialization, even when not serializing a generic
type. |
25/10/2005 |
|
Base class serialization
|
System Programming |
.NET
automatic serialization assumes every level at a class hierarchy is
serializable, and .NET throws an exception if not. This behavior makes
it difficult to subclass a serializable class from a non-serializable
base class. The utility provides automatic serialization of the base
class (or classes) via custom serialization, using reflection. |
25/10/2005 |
|
File IO
|
System Programming |
This
is a full-blown back up utility, which uses .NET system IO to copy and
backup files. You can select normal or incremental backup. It also
serves as a demo application for file properties manipulation in .NET.
The application updates the Windows Forms controls correctly on multiple
threads using IDesign's dedicated controls. |
25/10/2005 |
|
Automatic threads synchronization
|
System Programming |
The
easiest way to synchronize access to your object by multiple threads is
to put it in a protected run-time environment, called context. Calls
into a context are intercepted, and services are added as pre and post
call processing. One of such a service is multithreading
synchronization, using a special context attribute. The Synchronization
attribute defines a synchronization domain - a collection of objects
that can only be accessed by one thread at a time, all with zero effort
on the part of the developer. The zip file contains a demo client that
creates threads that access a synchronized object. |
25/10/2005 |
|
Killing a thread
|
System Programming |
The
.NET Thread class has no built-in support for graceful thread shut
down. If you call Thread.Abort(), the thread is aborted, without a
chance for cleanup (such as closing and releasing resources), and
Abort() is not guaranteed to succeed. The zip file contains the
WorkerThread class template that demonstrates a structured and correct
way to kill a thread. |
25/10/2005 |
|
Synchronized methods
|
System Programming |
Developers
often resort to locking the object at the scope of methods. This demo
app demonstrates how to use the MethodImpl attribute to have the
compiler generate the synchronization code automatically. |
25/10/2005 |
|
Implementing ISynchronizeInvoke
|
System Programming |
When
client on thread T1 calls a method on an object, that method is
executed on the clients thread, T1. However, what should be done in
cases where the object must always run on the same thread, say T2? Such
situations are common where thread affinity is required. For example,
.NET Windows Forms windows and controls must always process messages on
the same thread that created them. To address such situations, .NET
provides the ISynchronizeInvoke interface. The zip file contains a
helper class called Synchronizer. Synchronizer is a generic
implementation of ISynchronizeInvoke. You can use Synchronizer as-is by
either deriving from it or contain it as a member object, and delegate
your implementation of ISynchronizeInvoke to it. |
25/10/2005 |
|
Thread pool
|
System Programming |
The
thread pool allows developers to queue requests for execution for the
pooled threads, and it is often an easy alternative for managing your
own threads. The app demonstrates using the thread pool. |
25/10/2005 |
|
Timers
|
System Programming |
Developers
often create thread or use message loops to periodically call back into
their application. .NET provides 3 timer mechanisms just for this
purpose. The zip file shows the correct way of using these timers, and
contrasts them, all while correctly marshaling calls between threads. |
25/10/2005 |
|
Thread local storage
|
System Programming |
.NET
provides thread-specific heap, where application can store thread
specific data. The data is in the form of either named value and value
pairs, of simply data slot objects. Thread local storage comes in handy
when developing frameworks and large applications. The zip file contains
a demo client that uses thread local storage both as named slots and
slot objects, as well as showing the proper way of doing a clean up. |
25/10/2005 |
|
Worker thread wrapper class
|
System Programming |
WorkerThread
is a wrapper class around the underlying managed thread. It provides
easy to use overloaded constructors, Kill() and Start() methods, and a
better programming model than the basic Thread class. It exposes only
the good methods of the thread class and disallows the bad. It also
allows you to wait on the thread handle for termination, something the
basic thread type does not. Once expanded, you will have a Visual Studio
solution for the WorkerThread class and a test client, as well as
XML-based documentation. |
25/10/2005 |
|
Remote events
|
System Programming |
When
using remote events, the roles are reversed: the server becomes the
client, and the client the server. There are a few configuration changes
(such as type filtering) required to enable remote events, as well as
user interface updates, demonstrated by this app. |
25/10/2005 |
|
Rendezvous Demo
|
System Programming |
The
WaitHandle class provides in .NET 2.0 a set of SignalAndWait() methods
that allow you in one atomic operation to signal one event while waiting
on another. This is important when synchronizing execution of multiple
threads wanting them to execute in unison. The zip file contains the
Rendezvous class – a compound lock that allows you to do just that, and a
demo application that uses it. |
25/10/2005 |
|
Serialization
|
System Programming |
.NET
provides support for automatic object serialization, both for object
persistence and for remoting and marshaling. Objects can be serialize to
either binary or SOAP format. The zip file contains a serialization
example - the same client code is used to serialize an object into
selected format, using IFormatter. The demo also shows how to use .NET
stream-based serialization. |
24/10/2008 |
|
Automatic logging and tracing using custom context attribute
|
System Programming |
One
of the most beneficial steps you can take to achieve a robust
application and faster time to market is adding a logging capability to
your application. The logbook is a simple custom component service that
allows you to automatically log method calls and exceptions. By
examining the logbook entries, you can analyze what took place across
machines. The logbook uses custom context attribute. |
25/10/2005 |
|
Generic Serialization and Serialization Events
|
System Programming |
The
IFormatter interfaces and the binary and SOAP formatters that support
it were all defined in .NET 1.0, before generics were available, and as
such, are not type safe. The zip file contains the definition and
implementations of IGenericFormatter, a generic wrapper around the basic
formatter. In addition, the demo shows how to define and use the
serialization events. |
22/10/2005 |
|
System.Transactions
|
System Programming |
The
application demonstrates the new features of System.Transactions in
.NET 2.0: how transaction flows between clients, services, and code
scopes, how to use TransactionScope and how transactions manage
consistency in the application. |
25/10/2005 |
|
Approximating TransactionScope
|
System Programming |
You
can approximate .NET 2.0 TransactionScope using Service Domains. This
provides you in .NET 1.1 the superior programming model of .NET 2.0 and
Indigo. Note that the approximation only works on Windows 2003 Server,
or on Windows XP Service Pack 2, and that it does not support promotion
(always uses the DTC). Given those prerequisites, you can start using
TransactionScope in .NET 1.1, and make a seamless transition into .NET
2.0 in the future. |
25/10/2005 |
|
Custom Synchronization Context
|
System Programming |
In
.NET, you can bounce a call from one thread to another using
synchronization context. The canonical example is when updating user
interface (such as Windows Forms) from a worker thread, since Windows
Forms has its own synchronization context. But the synchronization
context is a general-purpose mechanism, used whenever an affinity to a
particular thread or a group of threads is needed. While using a
synchronization context is straightforward, developing one requires some
advanced .NET programming. The download contains two custom
synchronization contexts- one used to establish an affinity to a custom
pool of thread, that is, the calling thread can bounce the call to the
custom pool, and the second synchronization context is used to estab |
25/02/2007 |
|
Declarative Transaction Support for Context Bound Objects
|
System Programming |
You
can use context and interception to provide for declarative transaction
support for context bound object, ala ServicedComponent, yet without
Enterprise Services. The demo application installs a transnational
message sink, that uses TransactionScope to ensure that the rest of the
call chain down stream is transactional, and a demo client and server.
|
29/10/2005 |
|
Concurrent Transactions
|
System Programming |
System.Transactions
allows you to combine the work of multiple threads in a single
transaction. You need to provide each worker thread with a clone of the
original transactions, and signal to the original client thread when the
worker threads have completed their work. This application demonstrates
this complex topic and a few related issues such as passing the
transaction between threads and synchronizing access to state. |
25/10/2005 |
|
Leasing and sponsorship
|
System Programming |
.NET
remoting requires a lease and a sponsor for a remote object, so that it
will be kept alive. The app demonstrates how to develop and deploy a
sponsor, how objects can provide their own custom lease, and the
required configuration and administration entries. The demo uses
IDesign's SponsorshipManager utility to manage the sponsors.
SponsorshipManager is a generic implementation of a client –side object
that manages all the sponsors for the client. The Sponsorship Manager
unregisters itself on application shutdown. It also uses a practical
heuristic to correctly renew the leases. |
25/10/2005 |
|
Asynchronous execution
|
System Programming |
.NET
provides built-in support for invoking methods asynchronously. There
are several available programming models, with a few permutations of
polling and callback mechanism. The zip file contains a demo client that
uses every possible way of invoking methods asynchronously: call and
forget, poll, callback and waiting on an event object, as well as
providing special call identifiers and state objects. |
25/10/2005 |
|
TransactionScope Snippet
|
System Programming |
A
Visual Studio 2005 code snippet that automates creating a transaction
scope, by typing ts. You can use the snippet either as an expansion or
as a surrounds with.
|
29/10/2005 |
|
Volatile Resource Manager
|
System Programming |
Transactional
programming has traditionally been the privilege of database-centric
applications. Other types of applications did not benefit easily from
this superior programming model. The zip file contains a generic
resource manager called Transactional<T> that enables you to
transact any type, from integers to strings to arrays. In addition, the
zip file contains transactional version of all the generic collections
in .NET 2.0, such as TransactionalList<T> and
TrasnactionalArray<T> that are used just like their predecessors
but with the added value and protection of transactions. |
08/11/2005 |
|
|
|
|
|