Click here to Skip to main content
15,896,912 members
Articles / Programming Languages / C#

Integrate Validation Block with WCF

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
23 Sep 2011CPOL4 min read 42.4K   1.1K   25  
Introduces how to integrate and use the validation block features in Microsoft Enterprise Library 5.0 with WCF.
<Window x:Class="ServiceTestClient.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="450">
    <Window.Resources>
        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="Margin" Value="5"></Setter>
            <Setter Property="HorizontalAlignment" Value="Left"></Setter>
            <Setter Property="VerticalAlignment" Value="Center"></Setter>
        </Style>
        <Style TargetType="{x:Type TextBox}">
            <Setter Property="Margin" Value="5"></Setter>
            <Setter Property="HorizontalAlignment" Value="Left"></Setter>
            <Setter Property="VerticalAlignment" Value="Center"></Setter>
        </Style>
        <Style TargetType="{x:Type Button}">
            <Setter Property="Margin" Value="5"></Setter>
            <Setter Property="HorizontalAlignment" Value="Center"></Setter>
            <Setter Property="VerticalAlignment" Value="Top"></Setter>
            <Setter Property="Width" Value="250"></Setter>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="220" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <TextBlock Name="textBlock1" Grid.Row="0" Grid.Column="0" Text="Education Level (2-5)" />
        <TextBlock Name="textBlock2" Grid.Row="1" Grid.Column="0" Text="Experience (Years)" />
        <TextBlock Name="textBlock3" Grid.Row="2" Grid.Column="0" Text="Currency" />
        <TextBlock Name="textBlock4" Grid.Row="3" Grid.Column="0" Text="Valid Certificate (True/False)"  />
        <TextBlock Name="textBlock5" Grid.Row="4" Grid.Column="0" Text="Management Experience (True/False)"/>
        <TextBox Name="txtEducationLevel" Width="120" Grid.Row="0" Grid.Column="1" />
        <TextBox Name="txtExperienceInYears" Width="120" Grid.Row="1" Grid.Column="1" />
        <TextBox Name="txtCurrency" Width="120" Grid.Row="2" Grid.Column="1" />
        <TextBox Name="txtHasCertificate" Width="120" Grid.Row="3" Grid.Column="1" />
        <TextBox Name="txtInvolvedInManagement" Width="120" Grid.Row="4" Grid.Column="1" />
        <StackPanel Grid.ColumnSpan="2" Grid.Row="5" Orientation="Vertical">
            <Button Name="btnSendDataPartial" Content="Calculate salary using partial validation" Click="btnSendDataPartial_Click"></Button>
            <Button Name="btnSendDataFull" Content="Calculate salary using full validation" Click="btnSendDataFull_Click"></Button>
        </StackPanel>
    </Grid>
</Window>

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 Code Project Open License (CPOL)


Written By
Software Developer
Turkey Turkey
I am interested in innovation and creativity in software development and passionate in learning new stuff.

Comments and Discussions