Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
565 changed files
with
70,983 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# Visual Studio 2010 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Presentation", "Presentation\Presentation.csproj", "{08D7DCC3-AB48-4DFF-9A0C-74FA4D1854BE}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure", "Infrastructure\Infrastructure.csproj", "{64ED44D3-8164-412B-8569-9E7A39855FD4}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure.Impl", "Infrastructure.Impl\Infrastructure.Impl.csproj", "{A36E64F0-0D1F-4738-88DF-BFF3E797C5E9}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "Domain\Domain.csproj", "{5B300AEF-59BF-42A4-B407-1E48A6D0660D}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure.Web", "Infrastructure.Web\Infrastructure.Web.csproj", "{998E00CE-3190-472E-B0F7-5D161D70A6EA}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{08D7DCC3-AB48-4DFF-9A0C-74FA4D1854BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{08D7DCC3-AB48-4DFF-9A0C-74FA4D1854BE}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{08D7DCC3-AB48-4DFF-9A0C-74FA4D1854BE}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{08D7DCC3-AB48-4DFF-9A0C-74FA4D1854BE}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{64ED44D3-8164-412B-8569-9E7A39855FD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{64ED44D3-8164-412B-8569-9E7A39855FD4}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{64ED44D3-8164-412B-8569-9E7A39855FD4}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{64ED44D3-8164-412B-8569-9E7A39855FD4}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{A36E64F0-0D1F-4738-88DF-BFF3E797C5E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{A36E64F0-0D1F-4738-88DF-BFF3E797C5E9}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{A36E64F0-0D1F-4738-88DF-BFF3E797C5E9}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{A36E64F0-0D1F-4738-88DF-BFF3E797C5E9}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{5B300AEF-59BF-42A4-B407-1E48A6D0660D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{5B300AEF-59BF-42A4-B407-1E48A6D0660D}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{5B300AEF-59BF-42A4-B407-1E48A6D0660D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{5B300AEF-59BF-42A4-B407-1E48A6D0660D}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{998E00CE-3190-472E-B0F7-5D161D70A6EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{998E00CE-3190-472E-B0F7-5D161D70A6EA}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{998E00CE-3190-472E-B0F7-5D161D70A6EA}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{998E00CE-3190-472E-B0F7-5D161D70A6EA}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Infrastructure; | ||
using nVentive.Umbrella.Extensions; | ||
using nVentive.Umbrella.Validation; | ||
|
||
namespace Domain | ||
{ | ||
public class Class : AggregateRoot | ||
{ | ||
/// <summary> | ||
/// NHibernate constructor. | ||
/// </summary> | ||
protected Class() { } | ||
|
||
public Class(string name, int credits) | ||
{ | ||
// Business rules | ||
if (string.IsNullOrWhiteSpace(name) || name.Length > 255) | ||
{ | ||
throw new ArgumentException("name must be a text that have between 1 and 255 characters"); | ||
} | ||
if (credits < 3 || credits > 6) | ||
{ | ||
throw new ArgumentException("credits must be between 3 and 6"); | ||
} | ||
|
||
// State changes | ||
Name = name; | ||
Credits = credits; | ||
} | ||
|
||
public virtual string Name { get; private set; } | ||
public virtual int Credits { get; private set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> | ||
<class name="Domain.Class, Domain" lazy="true"> | ||
|
||
<id name="Id"> | ||
<generator class="assigned" /> | ||
</id> | ||
<version name="version" type="timestamp" access="field" /> | ||
|
||
<property name="Name" /> | ||
<property name="Credits" /> | ||
|
||
</class> | ||
</hibernate-mapping> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?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>{5B300AEF-59BF-42A4-B407-1E48A6D0660D}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Domain</RootNamespace> | ||
<AssemblyName>Domain</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="Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\Lib\Iesi.Collections.dll</HintPath> | ||
</Reference> | ||
<Reference Include="NHibernate, Version=2.1.2.4000, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\Lib\NHibernate.dll</HintPath> | ||
</Reference> | ||
<Reference Include="nVentive.Umbrella"> | ||
<HintPath>..\Lib\nVentive.Umbrella.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Class.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Registration.cs" /> | ||
<Compile Include="Repositories\IClassRepository.cs" /> | ||
<Compile Include="Repositories\IStudentRepository.cs" /> | ||
<Compile Include="Repositories\NHibernateClassRepository.cs" /> | ||
<Compile Include="Repositories\NHibernateStudentRepository.cs" /> | ||
<Compile Include="Student.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Infrastructure.Impl\Infrastructure.Impl.csproj"> | ||
<Project>{A36E64F0-0D1F-4738-88DF-BFF3E797C5E9}</Project> | ||
<Name>Infrastructure.Impl</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj"> | ||
<Project>{64ED44D3-8164-412B-8569-9E7A39855FD4}</Project> | ||
<Name>Infrastructure</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="Student.hbm.xml"> | ||
<SubType>Designer</SubType> | ||
</EmbeddedResource> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="Class.hbm.xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="Registration.hbm.xml" /> | ||
</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("Domain")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("Microsoft")] | ||
[assembly: AssemblyProduct("Domain")] | ||
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] | ||
[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("96aa80b2-2cfb-44c7-a842-e5666be20973")] | ||
|
||
// 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")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Infrastructure; | ||
|
||
namespace Domain | ||
{ | ||
public class Registration : Entity<Student> | ||
{ | ||
/// <summary> | ||
/// NHibernate constructor. | ||
/// </summary> | ||
protected Registration() { } | ||
|
||
public Registration(Student student, int id, Class @class) | ||
: base(student, id) | ||
{ | ||
Class = @class; | ||
} | ||
|
||
public virtual Class Class { get; private set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> | ||
<class name="Domain.Registration, Domain" lazy="true"> | ||
|
||
<composite-id> | ||
<key-many-to-one name="aggregateRoot" access="field" class="Domain.Student, Domain"/> | ||
<key-property name="Id"/> | ||
</composite-id> | ||
<version name="version" type="timestamp" access="field" /> | ||
|
||
<many-to-one name="Class" class="Domain.Class, Domain"/> | ||
|
||
</class> | ||
</hibernate-mapping> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Infrastructure; | ||
|
||
namespace Domain.Repositories | ||
{ | ||
public interface IClassRepository : IRepository<Class> | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Infrastructure; | ||
|
||
namespace Domain.Repositories | ||
{ | ||
public interface IStudentRepository : IRepository<Student> | ||
{ | ||
IPaginable<Student> ByNameLike(string name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Infrastructure.Impl; | ||
using Infrastructure; | ||
|
||
namespace Domain.Repositories | ||
{ | ||
public class NHibernateClassRepository : NHibernateRepository<Class>, IClassRepository | ||
{ | ||
public NHibernateClassRepository(NHibernatePersistenceManager pm) | ||
: base(pm) | ||
{ | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
DDDPart1/Domain/Repositories/NHibernateStudentRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Infrastructure.Impl; | ||
using NHibernate.Criterion; | ||
|
||
namespace Domain.Repositories | ||
{ | ||
public class NHibernateStudentRepository : NHibernateRepository<Student>, IStudentRepository | ||
{ | ||
public NHibernateStudentRepository(NHibernatePersistenceManager pm) | ||
: base(pm) | ||
{ | ||
} | ||
|
||
#region IStudentRepository Members | ||
|
||
public Infrastructure.IPaginable<Student> ByNameLike(string name) | ||
{ | ||
if (string.IsNullOrWhiteSpace(name)) | ||
{ | ||
return All(); | ||
} | ||
else | ||
{ | ||
return ByCriteria( | ||
Restrictions.Or( | ||
Restrictions.Like("FirstName", name), | ||
Restrictions.Like("LastName", name))); | ||
} | ||
} | ||
|
||
#endregion | ||
|
||
} | ||
} |
Oops, something went wrong.