Permalink
Browse files

Validation

  • Loading branch information...
1 parent f1474b5 commit 6fc7e8c74f82a9a2be5a66b0e7db1834f120dab1 JoergEg committed Mar 14, 2011
Showing with 1,520 additions and 20 deletions.
  1. +4 −0 CQRSSample.App/CQRSSample.App.csproj
  2. +1 −1 CQRSSample.App/Program.cs
  3. +53 −0 CQRSSample.Commands/CQRSSample.Commands.csproj
  4. +1 −1 {CQRSSample.Domain/Commands → CQRSSample.Commands}/Command.cs
  5. +1 −1 {CQRSSample.Domain/Commands → CQRSSample.Commands}/CreateCustomerCommand.cs
  6. +7 −0 CQRSSample.Commands/DynamicCommand.cs
  7. +36 −0 CQRSSample.Commands/Properties/AssemblyInfo.cs
  8. +1 −1 {CQRSSample.Domain/Commands → CQRSSample.Commands}/RelocatingCustomerCommand.cs
  9. +6 −3 CQRSSample.Domain/CQRSSample.Domain.csproj
  10. +1 −1 CQRSSample.Domain/CommandHandlers/CreateCustomerCommandHandler.cs
  11. +1 −1 CQRSSample.Domain/CommandHandlers/Handles.cs
  12. +1 −1 CQRSSample.Domain/CommandHandlers/RelocatingCustomerCommandHandler.cs
  13. +1 −1 CQRSSample.Domain/CommandHandlers/TransactionHandler.cs
  14. +4 −0 CQRSSample.Infrastructure/CQRSSample.Infrastructure.csproj
  15. +1 −1 CQRSSample.Infrastructure/InProcessBus.cs
  16. +1 −0 CQRSSample.WpfClient/App.xaml
  17. +26 −0 CQRSSample.WpfClient/ApplicationFramework/Resources/Style.xaml
  18. +12 −0 CQRSSample.WpfClient/CQRSSample.WpfClient.csproj
  19. +1 −1 CQRSSample.WpfClient/Modules/CustomerDetails/CreateCustomer/CreateCustomerViewModel.cs
  20. +1 −1 CQRSSample.WpfClient/Modules/CustomerDetails/CustomerRelocating/CustomerRelocatingView.xaml
  21. +144 −6 CQRSSample.WpfClient/Modules/CustomerDetails/CustomerRelocating/CustomerRelocatingViewModel.cs
  22. +12 −0 CQRSSample.sln
  23. +1,027 −0 External Libs/FluentValidation/FluentValidation.XML
  24. BIN External Libs/FluentValidation/FluentValidation.dll
  25. BIN External Libs/FluentValidation/FluentValidation.pdb
  26. +176 −0 External Libs/FluentValidation/License.txt
  27. BIN External Libs/FluentValidation/de/FluentValidation.resources.dll
  28. BIN External Libs/FluentValidation/es/FluentValidation.resources.dll
  29. BIN External Libs/FluentValidation/fr/FluentValidation.resources.dll
  30. BIN External Libs/FluentValidation/it/FluentValidation.resources.dll
  31. BIN External Libs/FluentValidation/nl/FluentValidation.resources.dll
  32. BIN External Libs/FluentValidation/pt/FluentValidation.resources.dll
  33. BIN External Libs/FluentValidation/sv/FluentValidation.resources.dll
  34. +1 −0 README
@@ -145,6 +145,10 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\CQRSSample.Commands\CQRSSample.Commands.csproj">
+ <Project>{22374340-0C08-4F74-86B7-6C229BE1E550}</Project>
+ <Name>CQRSSample.Commands</Name>
+ </ProjectReference>
<ProjectReference Include="..\CQRSSample.Domain\CQRSSample.Domain.csproj">
<Project>{A9EE33AB-B226-491C-8F14-A78069618F21}</Project>
<Name>CQRSSample.Domain</Name>
@@ -5,7 +5,7 @@
using System;
using Castle.Windsor;
-using CQRSSample.Domain.Commands;
+using CQRSSample.Commands;
using CQRSSample.Infrastructure;
using CQRSSample.ReadModel;
using Raven.Client;
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{22374340-0C08-4F74-86B7-6C229BE1E550}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>CQRSSample.Commands</RootNamespace>
+ <AssemblyName>CQRSSample.Commands</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="FluentValidation">
+ <HintPath>..\External Libs\FluentValidation\FluentValidation.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Command.cs" />
+ <Compile Include="CreateCustomerCommand.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="RelocatingCustomerCommand.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
@@ -1,6 +1,6 @@
using System;
-namespace CQRSSample.Domain.Commands
+namespace CQRSSample.Commands
{
public abstract class Command
{
@@ -1,6 +1,6 @@
using System;
-namespace CQRSSample.Domain.Commands
+namespace CQRSSample.Commands
{
[Serializable]
public class CreateCustomerCommand : Command
@@ -0,0 +1,7 @@
+namespace CQRSSample.Commands
+{
+ public class DynamicCommand
+ {
+ private readonly dynamic _innerCommand;
+ }
+}
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("CQRSSample.Commands")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("CQRSSample.Commands")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("ed9a9403-426d-448b-8d07-085a9a7e75b6")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -1,6 +1,6 @@
using System;
-namespace CQRSSample.Domain.Commands
+namespace CQRSSample.Commands
{
[Serializable]
public class RelocatingCustomerCommand : Command
@@ -41,15 +41,18 @@
<Compile Include="CommandHandlers\RelocatingCustomerCommandHandler.cs" />
<Compile Include="CommandHandlers\Handles.cs" />
<Compile Include="CommandHandlers\TransactionHandler.cs" />
- <Compile Include="Commands\Command.cs" />
- <Compile Include="Commands\CreateCustomerCommand.cs" />
- <Compile Include="Commands\RelocatingCustomerCommand.cs" />
<Compile Include="Domain\Customer.cs" />
<Compile Include="Events\CustomerCreatedEvent.cs" />
<Compile Include="Events\CustomerRelocatedEvent.cs" />
<Compile Include="Events\DomainEvent.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\CQRSSample.Commands\CQRSSample.Commands.csproj">
+ <Project>{22374340-0C08-4F74-86B7-6C229BE1E550}</Project>
+ <Name>CQRSSample.Commands</Name>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@@ -1,6 +1,6 @@
using System;
using CommonDomain.Persistence;
-using CQRSSample.Domain.Commands;
+using CQRSSample.Commands;
using CQRSSample.Domain.Domain;
namespace CQRSSample.Domain.CommandHandlers
@@ -1,6 +1,6 @@
// ReSharper disable InconsistentNaming
-using CQRSSample.Domain.Commands;
+using CQRSSample.Commands;
namespace CQRSSample.Domain.CommandHandlers
{
@@ -1,6 +1,6 @@
using System;
using CommonDomain.Persistence;
-using CQRSSample.Domain.Commands;
+using CQRSSample.Commands;
using CQRSSample.Domain.Domain;
namespace CQRSSample.Domain.CommandHandlers
@@ -1,4 +1,4 @@
-using CQRSSample.Domain.Commands;
+using CQRSSample.Commands;
namespace CQRSSample.Domain.CommandHandlers
{
@@ -64,6 +64,10 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\CQRSSample.Commands\CQRSSample.Commands.csproj">
+ <Project>{22374340-0C08-4F74-86B7-6C229BE1E550}</Project>
+ <Name>CQRSSample.Commands</Name>
+ </ProjectReference>
<ProjectReference Include="..\CQRSSample.Domain\CQRSSample.Domain.csproj">
<Project>{A9EE33AB-B226-491C-8F14-A78069618F21}</Project>
<Name>CQRSSample.Domain</Name>
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Castle.Windsor;
+using CQRSSample.Commands;
using CQRSSample.Domain.CommandHandlers;
-using CQRSSample.Domain.Commands;
using CQRSSample.Domain.Events;
using EventStore;
using EventStore.Dispatcher;
@@ -11,6 +11,7 @@
</ResourceDictionary>
<ResourceDictionary Source="Themes\ExpressionDark.xaml" />
<ResourceDictionary Source="ApplicationFramework\Resources\ConverterResource.xaml" />
+ <ResourceDictionary Source="ApplicationFramework\Resources\Style.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
@@ -0,0 +1,26 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+
+ <!-- Validating TextBox-->
+ <Style x:Key="ValidatingTextBox" TargetType="{x:Type TextBox}">
+ <Setter Property="Margin" Value="3" />
+ <Setter Property="Validation.ErrorTemplate">
+ <Setter.Value>
+ <ControlTemplate>
+ <DockPanel DockPanel.Dock="Right" >
+ <AdornedElementPlaceholder />
+ <Image Source="/ApplicationFramework/Icons/customers.png" Width="15" Height="15" ToolTip="{Binding Path=AdornedElement.ToolTip, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Adorner}}}" />
+ </DockPanel>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ <Style.Triggers>
+ <Trigger Property="Validation.HasError" Value="True">
+ <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self},
+ Path=(Validation.Errors)[0].ErrorContent}" />
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+
+
+</ResourceDictionary>
@@ -49,6 +49,10 @@
<Reference Include="EventStore.Persistence.RavenPersistence">
<HintPath>..\External Libs\CommonDomain\bin\EventStore.Persistence.RavenPersistence.dll</HintPath>
</Reference>
+ <Reference Include="FluentValidation">
+ <HintPath>..\External Libs\FluentValidation\FluentValidation.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Windows.Shell, Version=3.5.41019.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<Reference Include="RibbonControlsLibrary, Version=3.5.41019.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -137,6 +141,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="ApplicationFramework\Resources\Style.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Modules\CustomerDetails\CreateCustomer\CreateCustomerView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -194,6 +202,10 @@
<Folder Include="ApplicationFramework\Controls\" />
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\CQRSSample.Commands\CQRSSample.Commands.csproj">
+ <Project>{22374340-0C08-4F74-86B7-6C229BE1E550}</Project>
+ <Name>CQRSSample.Commands</Name>
+ </ProjectReference>
<ProjectReference Include="..\CQRSSample.Domain\CQRSSample.Domain.csproj">
<Project>{A9EE33AB-B226-491C-8F14-A78069618F21}</Project>
<Name>CQRSSample.Domain</Name>
@@ -1,6 +1,6 @@
using System;
using Caliburn.Micro;
-using CQRSSample.Domain.Commands;
+using CQRSSample.Commands;
using CQRSSample.Infrastructure;
namespace CQRSSample.WpfClient.Modules.CustomerDetails.CreateCustomer
@@ -20,7 +20,7 @@
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="10">
<TextBlock Margin="0 0 10 0">City:</TextBlock>
- <TextBox Text="{Binding Command.City}" Width="400" />
+ <TextBox Text="{Binding Command.City, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource ValidatingTextBox}" Width="400" />
</StackPanel>
<Button x:Name="Save" Width="100" Margin="0 10 0 0">Save</Button>
Oops, something went wrong. Retry.

0 comments on commit 6fc7e8c

Please sign in to comment.