Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions BuildRevisionCounter.Contract/BuildRevisionCounter.Protocol.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{667844E5-6D11-474D-A18F-BC4784626F34}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BuildRevisionCounter.Protocol</RootNamespace>
<AssemblyName>BuildRevisionCounter.Protocol</AssemblyName>
<TargetFrameworkVersion>v4.5</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="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="Properties\AssemblyInfo.cs" />
<Compile Include="Revision.cs" />
<Compile Include="User.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>
36 changes: 36 additions & 0 deletions BuildRevisionCounter.Contract/Properties/AssemblyInfo.cs
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("BuildRevisionCounter.Contract")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BuildRevisionCounter.Contract")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[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("91410165-4321-4bb2-9665-c1c0e36dc1d4")]

// 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")]
15 changes: 15 additions & 0 deletions BuildRevisionCounter.Contract/Revision.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;

namespace BuildRevisionCounter.Protocol
{
public class Revision
{
public string Id { get; set; }

public DateTime Created { get; set; }

public DateTime Updated { get; set; }

public long CurrentNumber { get; set; }
}
}
11 changes: 11 additions & 0 deletions BuildRevisionCounter.Contract/User.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace BuildRevisionCounter.Protocol
{
public class User
{
public string Name { get; set; }

public string Password { get; set; }

public string[] Roles { get; set; }
}
}
92 changes: 92 additions & 0 deletions BuildRevisionCounter.Core/BuildRevisionCounter.Core.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DDF51396-4EE1-45AF-B134-CA1C56B0CD9F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BuildRevisionCounter.Core</RootNamespace>
<AssemblyName>BuildRevisionCounter.Core</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</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="MongoDB.Bson, Version=2.0.0.828, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Bson.2.0.0\lib\net45\MongoDB.Bson.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MongoDB.Driver, Version=2.0.0.828, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Driver.2.0.0\lib\net45\MongoDB.Driver.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MongoDB.Driver.Core, Version=2.0.0.828, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Driver.Core.2.0.0\lib\net45\MongoDB.Driver.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MongoDB.Driver.Legacy, Version=2.0.0.828, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\mongocsharpdriver.2.0.0\lib\net45\MongoDB.Driver.Legacy.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<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="Converters\IUserConverter.cs" />
<Compile Include="Converters\IRevisionConverter.cs" />
<Compile Include="Converters\Impl\UserConverter.cs" />
<Compile Include="DomainObjects\User.cs" />
<Compile Include="MongoDBStorage.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Converters\Impl\RevisionConverter.cs" />
<Compile Include="Repositories\Impl\RevisionRepository.cs" />
<Compile Include="Repositories\Impl\UserRepository.cs" />
<Compile Include="Repositories\IRevisionRepository.cs" />
<Compile Include="DomainObjects\Revision.cs" />
<Compile Include="Repositories\IUserRepository.cs" />
<Compile Include="RepositoryFactory.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BuildRevisionCounter.Contract\BuildRevisionCounter.Protocol.csproj">
<Project>{667844e5-6d11-474d-a18f-bc4784626f34}</Project>
<Name>BuildRevisionCounter.Protocol</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<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>
11 changes: 11 additions & 0 deletions BuildRevisionCounter.Core/Converters/IRevisionConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using BuildRevisionCounter.Core.DomainObjects;

namespace BuildRevisionCounter.Core.Converters
{
internal interface IRevisionConverter
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

полиморфизм не используется - интерфейс не нужен.
Был бы смысл его использовать если бы интерфейс находился в другой сборке, ну или тут присутствовала бы еще одна реализация.

{
Protocol.Revision ToProtocol(Revision revision);

Revision ToDomain(Protocol.Revision revision);
}
}
11 changes: 11 additions & 0 deletions BuildRevisionCounter.Core/Converters/IUserConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using BuildRevisionCounter.Core.DomainObjects;

namespace BuildRevisionCounter.Core.Converters
{
internal interface IUserConverter
{
Protocol.User ToProtocol(User user);

User ToDomain(Protocol.User user);
}
}
33 changes: 33 additions & 0 deletions BuildRevisionCounter.Core/Converters/Impl/RevisionConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using BuildRevisionCounter.Core.DomainObjects;

namespace BuildRevisionCounter.Core.Converters.Impl
{
internal class RevisionConverter : IRevisionConverter
{
public Protocol.Revision ToProtocol(Revision revision)
{
var revisionProtocol = new Protocol.Revision
{
Id = revision.Id,
CurrentNumber = revision.CurrentNumber,
Updated = revision.Updated,
Created = revision.Created
};

return revisionProtocol;
}

public Revision ToDomain(Protocol.Revision revision)
{
var revisionDomain = new Revision
{
Id = revision.Id,
CurrentNumber = revision.CurrentNumber,
Updated = revision.Updated,
Created = revision.Created
};

return revisionDomain;
}
}
}
21 changes: 21 additions & 0 deletions BuildRevisionCounter.Core/Converters/Impl/UserConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using BuildRevisionCounter.Core.DomainObjects;

namespace BuildRevisionCounter.Core.Converters.Impl
{
internal class UserConverter : IUserConverter
{
public Protocol.User ToProtocol(User user)
{
var userProtocol = new Protocol.User { Name = user.Name, Password = user.Password, Roles = user.Roles };

return userProtocol;
}

public User ToDomain(Protocol.User user)
{
var userDomain = new User { Name = user.Name, Password = user.Password, Roles = user.Roles };

return userDomain;
}
}
}
20 changes: 20 additions & 0 deletions BuildRevisionCounter.Core/DomainObjects/Revision.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using MongoDB.Bson.Serialization.Attributes;

namespace BuildRevisionCounter.Core.DomainObjects
{
internal class Revision
{
[BsonId]
public string Id;

[BsonElement("created"), BsonDateTimeOptions(Kind = DateTimeKind.Utc)]
public DateTime Created;

[BsonElement("updated"), BsonDateTimeOptions(Kind = DateTimeKind.Utc)]
public DateTime Updated;

[BsonElement("currentNumber")]
public long CurrentNumber;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using MongoDB.Bson.Serialization.Attributes;

namespace BuildRevisionCounter.Model
namespace BuildRevisionCounter.Core.DomainObjects
{
public class UserModel
internal class User
{
[BsonId]
public string Name { get; set; }
Expand Down
Loading