http://www.idesign.net

http://www.idesign.net/idesign/DesktopDefault.aspx?tabindex=5&tabid=11

WCF Downloads
 TitleCategoryDescriptionLast Updated

Thread Affinity Attribute Concurrency ManagementThe 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. 2007-10-21

Callbacks thread Affinity Attribute Concurrency ManagementThe 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.2007-2-24

Form Host Concurrency ManagementInstead 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. 2007-2-28

Safe Asynchronous Calls Concurrency Managementby 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).2007-7-15

Asynchronous calls Concurrency ManagementWCF 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. 2007-7-30

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. 2006-9-7

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. 2006-9-7

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. 2006-9-7

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. 2007-1-9

Calls Priority Attribute Concurrency ManagementBy 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. 2007-10-21

Thread Pool Attribute Concurrency ManagementBy 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. 2007-10-21

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. 2006-9-7

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. 2006-9-7

Safe Controls Concurrency ManagementCalls 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. 2006-9-7

Windows Forms and Callbacks Concurrency ManagementWhen 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. 2006-9-7

Reentrancy Concurrency ManagementWhile 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. 2006-9-7

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. 2006-9-7

Service Contract Inheritance with proxy chaining ContractsEven 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. 2006-9-7

Metadata Helper ContractsThe 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.2006-9-7

Service Contract Inheritance ContractsOn 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. 2006-9-7

Contract Overloading ContractsWhile 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.2006-9-7

Class Hierarchy Data ContractsWhen 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.2006-9-7

Custom Collection Data ContractsWCF 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. 2006-9-7

Versioning Data ContractsWCF 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. 2006-9-7

Data Extensions and Round Trip Data ContractsWhile 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. 2006-9-7

Known Types in Config Data ContractsWhile 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. 2006-9-7

Order and Equivalence Data ContractsWhen 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. 2006-9-7

Data Tables Data ContractsThe 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. 2006-9-7

Data Tables as arrays Data ContractsWhile 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.2006-9-7

Enums Data ContractsThe 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. 2006-9-7

Known Type Resolver Data ContractsWith .NET 4.0, WCF provides for a simple programmatic way of resolving a known type issue. Whenever the serializer encounters a type it does not know how to resolve, allows the developer to resolve it at runtime by deriving from DataContractResolver and calling ResolveName() during deserialization to return the resolved type or TryResolveType() to return the name and namespace of a type being serialized. The demo shows how to implement such a resolver for a particular case. You will also see how to install the resolver on the host and the client sides. As you can see, it is very labor intensive. This issue is addressed with the Generic Resolver provided by IDesign.2011-2-12

Generic Resolver Data ContractsThe WCF provided known type resolver requires dedicated coding for each and every sub class, and also to manually install the resolver on the host and the client. IDesign's generic resolver addresses all that, and to a large extent, makes the whole issue of known types simply go away. The generic resolver uses reflection to find all possible known types in all referenced assemblies and as long as the compiler allowed them, the resolver resolves it automatically. You can also instruct it to resolve only specific known types. On the service side, you can use the GenericResolverBehaviorAttribute to allow the service to accept any sub class of its data contracts. You can also use the AddGenericResolver() host extension method to attach the reso2011-2-12

Ad-hoc Discovery DiscoveryThe 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.2010-1-22

Dynamic Addresses DiscoveryIf 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. 2010-1-22

Announcements DiscoveryThe 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 en2010-1-22

Publish-Subscribe Framework DiscoveryA 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 t2010-1-22

Scopes DiscoveryA simple demonstrations of using scopes to filter on the discovered service endpoints. 2010-1-22

ServiceModelEx EssentialsA 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.2009-1-24

NetNamedPipeContextBinding EssentialsWhile .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. 2009-1-24

Metadata Explorer EssentialsThe 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, allowing2010-1-9

Trace Interceptor EssentialsThis 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. 2009-1-24

Message headers as custom context EssentialsA 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 simp2008-10-30

Service Host Factory EssentialsUsing 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. 2007-7-15

Context bindings as custom context EssentialsWith .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 ClientBas2008-10-30

Service Snippet EssentialsThe 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.2006-9-7

Aborting the Host EssentialsWhen 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(). 2006-9-7

In-Proc Hosting EssentialsWCF 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. 2006-9-7

Multiple Endpoints EssentialsA 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. 2006-9-7

Programmatic Configuration EssentialsBoth 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. 2007-2-24

WAS Hosting EssentialsWith 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. 2007-10-21

App Domain Host EssentialsBy 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. 2007-10-21

In-Proc Factory EssentialsThe 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. 2007-2-24

ErrorHandlerBehavior Attribute FaultsThe 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. 2007-2-24

CallbackErrorHandler Attribute FaultsThe 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. 2007-2-24

Debug-Time Exception Extraction FaultsWhile 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. 2007-2-25

Debugging and Unknown Faults FaultsWCF 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.2007-2-24

Fault Contract FaultsBy 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. 2006-9-7

IErrorHandler FaultsIf 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. 2006-9-7

Deactivation Instance ManagementNormally, 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.2006-9-7

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.2006-9-7

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.2006-9-7

Throttling in Config Instance ManagementUsing 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. 2006-9-7

Programmatic Throttling Instance ManagementThrottling 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. 2006-9-7

Durable service using SQL persistence provider Instance ManagementFor 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. 2008-10-30

Durable service using custom persistence provider Instance ManagementFor 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 2008-10-30

Publish-Subscribe Framework OperationsUsing 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 code2006-9-10

Publish-Subscribe Example OperationsThe download contains another example for using the IDesign framework for implementing a publish/subscribe service. The example is a traffic lights management application. 2006-9-10

Connect-Disconnect OperationsWhen 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.2006-9-7

Dual HTTP Callback Address in config OperationsWhen 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.2006-9-7

Events OperationsThe 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. 2006-9-7

One-Way Calls OperationsAll 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. 2006-9-7

Streaming OperationsBy 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.2007-6-19

Programmatic Dual HTTP Callback Address OperationsWhen 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. 2006-9-7

Dual HTTP Callback Address using an attribute OperationsWhen 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.2006-9-7

Type-Safe Duplex Callbacks OperationsThe 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. 2006-9-7

Queued Singleton QueuingThis 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. 2007-7-25

Queued Calls QueuingUsing 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.2006-9-7

Online/Offline Service QueuingAn 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). 2006-9-7

Queued Per Call Service QueuingWhich 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.2006-9-7

Queued Per Session Service QueuingWhich 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. 2006-9-7

Queued Publish-Subscribe QueuingThis 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. 2007-7-25

Response Service QueuingA 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 me2007-1-31

Queued HTTP Bridge QueuingThe 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. 2007-1-31

Poison Message QueuingWhen 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.2007-1-31

Response Service - form as response service QueuingThe 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.2009-1-24

Identity Stack Tracing SecurityThis 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.2009-1-24

Declarative Security - Business to Business SecuritySecurity 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. 2007-7-15

Declarative Security - Anonymous Access SecuritySecurity 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. 2007-7-15

Declarative Security - None SecuritySecurity 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. 2007-7-15

Declarative Security - Security Audit SecurityThe 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. 2007-7-15

Declarative Security - Alternative Windows Credentials SecuritySecurity 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. 2007-7-15

Declarative Security - Using ASP.NET Providers in the Intranet SecuritySecurity 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. 2007-7-15

Declarative Security - Windows Credentials over the Internet SecuritySecurity 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. 2007-7-15

Declarative Security - ASP.NET Providers over the Internet SecuritySecurity 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.2007-7-15

Alternative Windows Credentials SecurityBy 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.2007-7-15

Windows Role-Based Security SecurityBy 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.2006-9-7

Windows Identity Management SecurityWhen 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.2006-9-7

Username Message Security and Windows credentials SecurityWCF 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.2006-9-7

Custom Credentials using ASP.NET Providers SecurityWCF 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.2006-9-7

Credentials Manager for WCF SecurityBoth 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.2006-9-7

Business to Business SecurityTwo 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.2006-9-7

Anonymous SecurityA 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.2006-9-7

Specifying application name in config for ASP.NET providers SecurityThis 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.2006-9-7

Business to Business with ASP.NET roles SecurityWhile 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. 2006-9-7

Demanding Protection Level SecurityWhen 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. 2006-9-7

Security Audit SecurityWCF 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.2006-9-7

Code-Access Security - Partial Trusted Clients SecurityBy 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. 2008-10-30

Code-Access Security - Partial Trusted Hosts SecurityBy 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 aspec2008-10-30

Code-Access Security - Partial Trusted Service via AppDomainHost SecurityEven 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. 2008-10-30

End to End Authentication - Oneway Relay Binding Service BusWhen 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.2010-1-22

End to End Authentication - TCP Relay Binding Service BusA 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. 2010-1-22

Declarative Security Service BusSimilar 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.2010-1-22

End to End Authentication - WS Relay Binding Service BusThe 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. 2010-1-23

Events Relay Binding Service BusA simple demo showing the collaborative abilities of the NetEventRelayBinding, enabling a distributed chat application.2010-1-22

Simple Publish-Subscribe Service BusWhen 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.2010-1-22

Publish-Subscribe Service BusWhen 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.2010-1-22

Publish-Subscribe and User Interface Updates Service BusThis 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. 2010-1-22

The Service Bus Explorer Service BusAn 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. 2010-1-22

The Oneway Relay Binding Service BusA 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.2010-1-22

Buffers with raw messages Service BusThe 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. 2010-1-22

Buffered Services, with structured, type safe object programming Service BusThe 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. 2010-1-22

Buffered Response Service Service BusSimilar 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. 2010-1-22

Service Bus Authentication Service BusThe .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 sim2010-1-22

Duplex Callbacks Service BusThe 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.2010-1-22

Hybrid Calls Service BusWhen 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. 2010-1-22

WS Relay Binding Service BusThe Ws2007HttpRelayBinding defaults to Transport security. The demo shows the IDesign extensions that streamline using the Ws2007HttpRelayBinding by automating the security configuration.2010-1-23

Transactional Behavior TransactionsThe 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. 2009-1-24

TransactionalBehavior - InProcFactory TransactionsThis 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.2009-1-24

TransactionalBehavior - InProcFactory Wrapper TransactionsThis 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.2009-1-24

Transaction Flow TransactionsIn 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.2006-9-7

Concurrent Transactions TransactionsWCF 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.2006-9-7

Volatile Resource Managers TransactionsA 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. 2006-9-7

Duplex Transactions TransactionsIn 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.2006-9-7

Transactional singleton TransactionsBy 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. 2006-9-7

Requiring Transaction Flow TransactionsWhen 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 BindingRequirementAttrib2007-2-24

.NET Downloads
 TitleCategoryDescriptionLast Updated

Deterministic finalization template .NET EssentialsThere 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.2005-10-25

Dynamic Factory .NET EssentialsThis 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.2005-11-20

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. 2005-10-25

EXE Reference .NET EssentialsVisual 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.2005-10-25

Friend Assembly .NET EssentialsIn 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.2005-10-25

Visualizers Application FrameworksVisualizers 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 Au2005-10-22

Safe Controls Application FrameworksWindows 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. 2005-10-25

SQL Express Scripter Application FrameworksThis 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. 2005-10-22

WinFormsEx Application FrameworksA 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. 2005-10-25

BackgroundWorker Demo Application FrameworksWindows 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.2005-10-25

BackgroundWorker for .NET 1.1 Application FrameworksEven 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. 2005-10-25

Isolated Storage Settings Helper Application FrameworksSmart 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 settings2005-10-25

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.2005-10-25

Windows Forms error provider control Application FrameworksThe 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.2005-10-25

GDI+ Application FrameworksDemonstrates 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. .2005-10-25

Windows Forms opacity Application FrameworksAdvanced (and yet easy) blending and fading using Windows forms Opacity property. 2005-10-25

Windows Forms Custom Browser Application FrameworksThe 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.2005-10-25

Web services and type-safe ADO.NET 2.0 data sets Application FrameworksWeb 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. 2005-10-25

Windows Forms Splash Screen Application FrameworksThe SplashScreen is a helper class that displays a splash screen (such as the one used by Outlook or Visual Studio) during application startup. 2005-10-25

Composite Extensions For Windows Forms Application FrameworksComposite 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.2008-10-14

BindingList<T> Application FrameworksThe 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. 2005-10-25

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. 2005-10-25

Windows Forms Singleton Application FrameworksBy 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.2006-11-6

Windows Forms and Windows messages Application FrameworksThe 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. 2005-10-25

ASP.NET 2.0 server side Back control Application FrameworksCommon 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. 2005-10-25

ADO.NET 2.0 data binding Application FrameworksDemonstrates 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. 2005-10-25

Linking files in VS 2005 Application FrameworksDemonstrating 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. 2006-1-12

Improved Property Snippet Application FrameworksThis 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_.2005-10-24

Windows Forms Control Decorator Application FrameworksThis 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 direct2005-11-11

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. 2005-10-25

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. 2005-10-25

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. 2005-10-25

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. 2006-1-13

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.2005-10-25

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. 2005-10-22

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. 2005-10-25

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. 2006-1-13

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. 2005-10-25

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.2005-10-25

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. 2005-10-25

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.2007-9-13

Utilities and helper classes Enterprise ServicesA 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. 2005-10-25

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.2005-10-25

ES Component Remover Enterprise ServicesThis 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.2005-10-22

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. 2005-10-25

Object pooling Enterprise ServicesDemonstrates using Enterprise Services object pooling, the required steps and methods of ServicedComponent you need to override.2005-10-25

Queued components Enterprise ServicesDemonstrates using Enterprise Services queued components, for asynchronous, disconnected calls. 2005-10-25

Transactional component Enterprise ServicesDemonstrates developing a transactional serviced component that uses ADO.NET.2005-10-25

Transactional web services Enterprise ServicesWeb 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. 2005-10-25

Transactions and Windows Forms Enterprise ServicesDemonstrates using transactional serviced component by a Windows Forms client.2005-10-25

Transactional context utility Enterprise ServicesAllows 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.2005-11-14

Serviced Component Installer Enterprise ServicesThe 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.2006-1-13

The Enterprise Services Logbook Enterprise ServicesThe 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. 2006-1-13

SOAP Headers and Security and ASP.NET 2.0 Security SecurityYou 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.2005-10-25

SOAP Headers Statefull Security and ASP.NET 2.0 Security SecurityWhen 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.2005-10-25

Unified Windows Forms and ASP.NET Security - ASP.NET providers SecurityThis 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. 2005-10-25

Unified Windows Forms and ASP.NET Security - Over Web Services SecurityThis 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. 2005-10-25

Unified security model SecurityA 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 MS2006-1-13

Log-in Web Service and ASP.NET 2.0 security SecurityUsing 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. 2005-10-25

Web Service and Impersonation SecurityIf 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. 2006-1-13

Credential Manager SecurityBoth 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. 2005-10-23

Role-based security SecurityThe app demonstrates basic .NET role-based security, and the required app domain initialization steps.2005-10-25

App domains System ProgrammingDemonstrates creating new app domains, and injecting objects in it.2007-2-25

Custom context attribute System ProgrammingA 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.2005-10-25

Generic Custom Serialization System ProgrammingThis 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.2005-10-25

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. 2005-10-25

File IO System ProgrammingThis 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.2005-10-25

Automatic threads synchronization System ProgrammingThe 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.2005-10-25

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. 2005-10-25

Synchronized methods System ProgrammingDevelopers 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.2005-10-25

Implementing ISynchronizeInvoke System ProgrammingWhen 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.2005-10-25

Thread pool System ProgrammingThe 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. 2005-10-25

Timers System ProgrammingDevelopers 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.2005-10-25

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.2005-10-25

Worker thread wrapper class System ProgrammingWorkerThread 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. 2005-10-25

Remote events System ProgrammingWhen 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.2005-10-25

Rendezvous Demo System ProgrammingThe 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.2005-10-25

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.2008-10-24

Automatic logging and tracing using custom context attribute System ProgrammingOne 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. 2005-10-25

Generic Serialization and Serialization Events System ProgrammingThe 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. 2005-10-22

System.Transactions System ProgrammingThe 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. 2005-10-25

Approximating TransactionScope System ProgrammingYou 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. 2005-10-25

Custom Synchronization Context System ProgrammingIn .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 estab2007-2-25

Declarative Transaction Support for Context Bound Objects System ProgrammingYou 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. 2005-10-29

Concurrent Transactions System ProgrammingSystem.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. 2005-10-25

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. 2005-10-25

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. 2005-10-25

TransactionScope Snippet System ProgrammingA 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. 2005-10-29

Volatile Resource Manager System ProgrammingTransactional 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. 2005-11-8


 

posted @ 2011-07-06 13:10  青羽  阅读(2647)  评论(0编辑  收藏  举报