Click here to Skip to main content
15,895,813 members
Articles / Web Development / ASP.NET

How to Build Flexible and Reusable WCF Services

Rate me:
Please Sign up or sign in to vote.
4.85/5 (13 votes)
6 May 2013GPL313 min read 77.2K   1.9K   126  
Design Patterns and best practices for building flexible and reusable WCF services.
<Application x:Class="AdventureWorks.Client.WPF.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:xom="clr-namespace:Xomega.Framework;assembly=Xomega.Framework"
    StartupUri="_EmployeeSearch.xaml" Startup="Application_Startup" DispatcherUnhandledException="Application_DispatcherUnhandledException">
    <Application.Resources>
        <Style x:Key="RadioButtonListStyle" TargetType="{x:Type ListBox}">
            <Setter Property="ItemContainerStyle">
                <Setter.Value>
                    <Style TargetType="{x:Type ListBoxItem}" >
                        <Setter Property="Margin" Value="2" />
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListBoxItem}" >
                                    <RadioButton Focusable="False" IsChecked="{Binding Path=IsSelected,
                                        Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
                                        <ContentPresenter></ContentPresenter>
                                    </RadioButton>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>
        <ControlTemplate x:Key="validationTemplate">
            <DockPanel>
                <TextBlock Foreground="Red" Text="*" FontSize="18" FontWeight="Bold"
                           ToolTip="{Binding ElementName=adornerPlaceholder, Path=AdornedElement.(xom:Property.Validation).Errors.ErrorsText}" />
                <AdornedElementPlaceholder Name="adornerPlaceholder"/>
            </DockPanel>
        </ControlTemplate>
        <Style x:Key="LabelStyle" TargetType="{x:Type Label}">
            <Style.Triggers>
                <Trigger Property="xom:Property.Required" Value="True">
                    <Setter Property="FontWeight" Value="Bold"/>
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="OperatorStyle" TargetType="{x:Type ComboBox}">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
        </Style>
        <Style x:Key="ControlStyle" TargetType="{x:Type FrameworkElement}">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
            <Setter Property="Validation.ErrorTemplate" Value="{StaticResource validationTemplate}"/>
        </Style>
        <Style x:Key="CriteriaStyle" TargetType="{x:Type Control}">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="Validation.ErrorTemplate" Value="{StaticResource validationTemplate}"/>
        </Style>
    </Application.Resources>
</Application>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Architect Xomega.Net
United States United States
Xomega Team is striving to increase productivity and development quality by utilizing Model Driven Development coupled with Code Generation and the best design practices for application development.
We provide MDD tools, code generators and frameworks for Visual Studio and .Net development.
Visit us at http://www.xomega.net
This is a Organisation

1 members

Comments and Discussions