Skip to content

Commit 3ae0124

Browse files
committed
Merge branch 'develop'
2 parents 5a25790 + b725f26 commit 3ae0124

23 files changed

+311
-125
lines changed

IntegrationEngine.Client.Tests/IntegrationEngine.Client.Tests.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<RootNamespace>IntegrationEngine.Client.Tests</RootNamespace>
99
<AssemblyName>IntegrationEngine.Client.Tests</AssemblyName>
1010
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
12+
<RestorePackages>true</RestorePackages>
1113
</PropertyGroup>
1214
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1315
<DebugSymbols>true</DebugSymbols>
@@ -67,4 +69,11 @@
6769
<ItemGroup>
6870
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
6971
</ItemGroup>
72+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
73+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
74+
<PropertyGroup>
75+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
76+
</PropertyGroup>
77+
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
78+
</Target>
7079
</Project>

IntegrationEngine.Core/Mail/SmtpClientAdapter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class SmtpClientAdapter : ISmtpClient
1111

1212
public SmtpClientAdapter()
1313
{
14+
SmtpClient = new SmtpClient();
1415
}
1516

1617
public virtual void Send(MailMessage mailMessage)

IntegrationEngine.Core/Storage/DatabaseRepository.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public IEnumerable<TItem> SelectAll<TItem>() where TItem : class, IHasLongId
2929
return db.Set<TItem>().ToList<TItem>();
3030
}
3131

32-
public TItem SelectById<TItem>(object id) where TItem : class, IHasLongId
32+
public TItem SelectById<TItem>(long id) where TItem : class, IHasLongId
3333
{
3434
return db.Set<TItem>().Find(id);
3535

@@ -47,7 +47,7 @@ public TItem Update<TItem>(TItem item) where TItem : class, IHasLongId
4747
return db.Entry(item).Entity;
4848
}
4949

50-
public void Delete<TItem>(object id) where TItem : class
50+
public void Delete<TItem>(long id) where TItem : class
5151
{
5252
TItem existing = db.Set<TItem>().Find(id);
5353
db.Set<TItem>().Remove(existing);
@@ -58,7 +58,7 @@ public void Save()
5858
db.SaveChanges();
5959
}
6060

61-
public bool Exists<TItem>(object id) where TItem : class
61+
public bool Exists<TItem>(long id) where TItem : class
6262
{
6363
return db.Set<TItem>().Find(id) != null;
6464
}

IntegrationEngine.Core/Storage/ElasticsearchRepository.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public IEnumerable<TItem> Search<TItem, TKey>(string query,
7171
return documents.AsEnumerable();
7272
}
7373

74-
public TItem SelectById<TItem>(object id) where TItem : class, IHasStringId
74+
public TItem SelectById<TItem>(string id) where TItem : class, IHasStringId
7575
{
7676
var response = ElasticClient.Get<TItem>(x => x.Id(id.ToString()));
7777
if (response.Source == null)
@@ -83,26 +83,27 @@ public TItem SelectById<TItem>(object id) where TItem : class, IHasStringId
8383

8484
public TItem Insert<TItem>(TItem item) where TItem : class, IHasStringId
8585
{
86-
return SelectById<TItem>(ElasticClient.Index<TItem>(item));
86+
var indexResponse = ElasticClient.Index<TItem>(item);
87+
return SelectById<TItem>(indexResponse.Id);
8788
}
8889

8990
public TItem Update<TItem>(TItem item) where TItem : class, IHasStringId
9091
{
91-
return SelectById<TItem>(ElasticClient.Update<TItem>(x => x
92+
var updateResponse = ElasticClient.Update<TItem>(x => x
9293
.Id(item.Id)
9394
.Doc(item)
94-
));
95+
);
96+
return SelectById<TItem>(updateResponse.Id);
9597
}
96-
97-
public void Delete<TItem>(object id) where TItem : class
98+
99+
public void Delete<TItem>(string id) where TItem : class
98100
{
99101
ElasticClient.Delete<TItem>(x => x.Id(id.ToString()));
100-
101102
}
102103

103-
public bool Exists<TItem>(object id) where TItem : class
104+
public bool Exists<TItem>(string id) where TItem : class
104105
{
105-
return ElasticClient.DocumentExists<TItem>(x => x.Id(id.ToString())).Exists;
106+
return ElasticClient.DocumentExists<TItem>(x => x.Id(id)).Exists;
106107
}
107108

108109
public bool IsServerAvailable()

IntegrationEngine.Core/Storage/IDatabaseRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace IntegrationEngine.Core.Storage
66
{
7-
public interface IDatabaseRepository : IRepository<IHasLongId>, IDisposable
7+
public interface IDatabaseRepository : IRepository<IHasLongId, long>, IDisposable
88
{
99
void Save();
1010
void SetState<TItem>(TItem item, EntityState entityState) where TItem : class;

IntegrationEngine.Core/Storage/IElasticsearchRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace IntegrationEngine.Core.Storage
88
{
9-
public interface IElasticsearchRepository : IRepository<IHasStringId>
9+
public interface IElasticsearchRepository : IRepository<IHasStringId, string>
1010
{
1111
IEnumerable<TItem> SelectAll<TItem, TKey>(Expression<Func<TItem, TKey>> orderBy, bool ascending = true, int pageIndex = 0, int rowCount = 10) where TItem : class, IHasStringId;
1212
IEnumerable<TItem> Search<TItem, TKey>(string query, Expression<Func<TItem, TKey>> orderBy, bool ascending = true, int pageIndex = 0, int rowCount = 10) where TItem : class, IHasStringId;

IntegrationEngine.Core/Storage/IRepository.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
namespace IntegrationEngine.Core.Storage
99
{
10-
public interface IRepository<TId>
10+
public interface IRepository<THasId, TId>
1111
{
12-
IEnumerable<TItem> SelectAll<TItem>() where TItem : class, TId;
13-
TItem SelectById<TItem>(object id) where TItem : class, TId;
14-
TItem Insert<TItem>(TItem item) where TItem : class, TId;
15-
TItem Update<TItem>(TItem item) where TItem : class, TId;
16-
void Delete<TItem>(object id) where TItem : class;
17-
bool Exists<TItem>(object id) where TItem : class;
12+
IEnumerable<TItem> SelectAll<TItem>() where TItem : class, THasId;
13+
TItem SelectById<TItem>(TId id) where TItem : class, THasId;
14+
TItem Insert<TItem>(TItem item) where TItem : class, THasId;
15+
TItem Update<TItem>(TItem item) where TItem : class, THasId;
16+
void Delete<TItem>(TId id) where TItem : class;
17+
bool Exists<TItem>(TId id) where TItem : class;
1818
bool IsServerAvailable();
1919
}
2020
}

IntegrationEngine.Core/Storage/IntegrationEngineContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ namespace IntegrationEngine.Core.Storage
55
{
66
public class IntegrationEngineContext : DbContext
77
{
8+
public IntegrationEngineContext() { }
9+
810
public IntegrationEngineContext(string connectionString)
911
: base(connectionString)
1012
{ }

IntegrationEngine.Core/package.nuspec

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@
1717
<reference file="IntegrationEngine.Core.dll" />
1818
</references>
1919
<dependencies>
20+
<dependency id="IntegrationEngine.Model" version="$version$" />
2021
<dependency id="Common.Logging" version="3.0.0" />
21-
<dependency id="Common.Logging.Core" version="3.0.0" />
22-
<dependency id="Common.Logging.NLog31" version="3.0.0" />
23-
<dependency id="Elasticsearch.Net" version="1.4.0" />
24-
<dependency id="EntityFramework" version="6.1.2" />
25-
<dependency id="MySql.Data" version="6.9.5" />
26-
<dependency id="MySql.Data.Entity" version="6.9.5" />
27-
<dependency id="NEST" version="1.4.0" />
28-
<dependency id="Newtonsoft.Json" version="6.0.8" />
29-
<dependency id="NLog" version="3.1.0.0" />
30-
<dependency id="RabbitMQ.Client" version="3.4.3" />
22+
<dependency id="Common.Logging.Core" version="3.0.0" />
23+
<dependency id="Common.Logging.NLog31" version="3.0.0" />
24+
<dependency id="Elasticsearch.Net" version="1.4.0" />
25+
<dependency id="EntityFramework" version="6.1.2" />
26+
<dependency id="MySql.Data" version="6.9.5" />
27+
<dependency id="MySql.Data.Entity" version="6.9.5" />
28+
<dependency id="NEST" version="1.4.0" />
29+
<dependency id="Newtonsoft.Json" version="6.0.8" />
30+
<dependency id="NLog" version="3.1.0.0" />
31+
<dependency id="RabbitMQ.Client" version="3.4.3" />
3132
</dependencies>
3233
</metadata>
3334
</package>

IntegrationEngine.Model/package.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<reference file="IntegrationEngine.Model.dll" />
1818
</references>
1919
<dependencies>
20-
<dependency id="CronExpressionDescriptor" version="1.12.0" />
20+
<dependency id="CronExpressionDescriptor" version="1.13.0" />
2121
<dependency id="Elasticsearch.Net" version="1.4.0" />
2222
<dependency id="NEST" version="1.4.0" />
2323
<dependency id="Newtonsoft.Json" version="6.0.8" />

0 commit comments

Comments
 (0)