Skip to content

Commit

Permalink
Merge pull request #21 from gigya/develop
Browse files Browse the repository at this point in the history
ver 1.0.0
  • Loading branch information
tsibelman authored Jun 4, 2017
2 parents c210b39 + 157102d commit b465cf5
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Gigya.Microdot.Logging.NLog/NLogLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected override Task<bool> WriteLog(TraceEventType level, LogCallSiteInfo log
var logLevel = ToLogLevel(level);
if (Logger.IsEnabled(logLevel))
{
var messageWithTags = message + string.Join(", ", unencryptedTags.Select(kvp => $"{kvp.Key.Substring(5)}={EventFieldFormatter.SerializeFieldValue(kvp.Value)}")) + ". ";
var messageWithTags = message + ". " + string.Join(", ", unencryptedTags.Select(kvp => $"{kvp.Key.Substring(5)}={EventFieldFormatter.SerializeFieldValue(kvp.Value)}")) + ". ";
Logger.Log(logLevel, exception, messageWithTags, null);
}

Expand Down
16 changes: 8 additions & 8 deletions Gigya.Microdot.Ninject.Host/MicrodotServiceHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
using Gigya.Microdot.Hosting.Service;
using Gigya.Microdot.Interfaces.Events;
using Gigya.Microdot.Interfaces.Logging;
using Gigya.Microdot.Ninject;
using Gigya.Microdot.SharedLogic;
using Ninject;
using Ninject.Syntax;

namespace Gigya.Ninject.Host
namespace Gigya.Microdot.Ninject.Host
{
/// <summary>
/// Base class for all non-Orleans services that use Ninject. Override <see cref="Configure"/> to configure your own
Expand Down Expand Up @@ -68,7 +67,7 @@ protected override void OnStart()
{
Kernel = CreateKernel();

PreConfigure();
PreConfigure(Kernel);

Kernel.Rebind<IActivator>().To<InstanceBasedActivator<TInterface>>().InSingletonScope();
Kernel.Rebind<IServiceInterfaceMapper>().To<IdentityServiceInterfaceMapper>().InSingletonScope().WithConstructorArgument(typeof(TInterface));
Expand Down Expand Up @@ -118,12 +117,13 @@ protected override void Dispose(bool disposing)
/// you should always call base.PreConfigure(), and if all inheritors of the class are concrete services, you should also
/// mark this method as sealed to prevent confusion with Configure().
/// </summary>
protected virtual void PreConfigure()
/// <param name="kernel">Kernel that should contain bindings for the service.</param>
protected virtual void PreConfigure(IKernel kernel)
{
Kernel.Load<MicrodotModule>();
Kernel.Load<MicrodotHostingModule>();
GetLoggingModule().Bind(Kernel.Rebind<ILog>(), Kernel.Rebind<IEventPublisher>());
Kernel.Rebind<ServiceArguments>().ToConstant(Arguments);
kernel.Load<MicrodotModule>();
kernel.Load<MicrodotHostingModule>();
GetLoggingModule().Bind(kernel.Rebind<ILog>(), kernel.Rebind<IEventPublisher>());
kernel.Rebind<ServiceArguments>().ToConstant(Arguments);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public abstract class MicrodotOrleansServiceHost : GigyaServiceHost

protected GigyaSiloHost SiloHost { get; set; }

protected IKernel Kernel { get; set; }
private IKernel Kernel { get; set; }

public abstract ILoggingModule GetLoggingModule();

Expand All @@ -58,7 +58,7 @@ protected override void OnStart()
{
Kernel = CreateKernel();

PreConfigure();
PreConfigure(Kernel);

Configure(Kernel, Kernel.Get<OrleansCodeConfig>());

Expand Down Expand Up @@ -98,15 +98,16 @@ protected virtual IKernel CreateKernel()
/// you should always call base.PreConfigure(), and if all inheritors of the class are concrete services, you should also
/// mark this method as sealed to prevent confusion with Configure().
/// </summary>
protected virtual void PreConfigure()
/// <param name="kernel"></param>
protected virtual void PreConfigure(IKernel kernel)
{
Kernel.Load<MicrodotModule>();
Kernel.Load<MicrodotHostingModule>();
Kernel.Load<MicrodotOrleansHostModule>();
kernel.Load<MicrodotModule>();
kernel.Load<MicrodotHostingModule>();
kernel.Load<MicrodotOrleansHostModule>();

Kernel.Rebind<ServiceArguments>().ToConstant(Arguments);
kernel.Rebind<ServiceArguments>().ToConstant(Arguments);

GetLoggingModule().Bind(Kernel.Rebind<ILog>(), Kernel.Rebind<IEventPublisher>());
GetLoggingModule().Bind(kernel.Rebind<ILog>(), kernel.Rebind<IEventPublisher>());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

namespace Gigya.Microdot.ServiceProxy.Caching
{
public class CachingProxyProvider<TInterface>
public class CachingProxyProvider<TInterface> : ICachingProxyProvider<TInterface>
{
/// <summary>
/// The instance of the transparent proxy used to access the data source with caching.
Expand Down
18 changes: 18 additions & 0 deletions Gigya.Microdot.ServiceProxy/Caching/ICachingProxyProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Gigya.Microdot.ServiceProxy.Caching
{
public interface ICachingProxyProvider<TInterface>
{
/// <summary>
/// The instance of the actual data source, used when the data is not present in the cache.
/// </summary>
TInterface DataSource { get; }

/// <summary>
/// The instance of the transparent proxy used to access the data source with caching.
/// </summary>
/// <remarks>
/// This is a thread-safe instance.
/// </remarks>
TInterface Proxy { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<Compile Include="Caching\AsyncMemoizer.cs" />
<Compile Include="Caching\CachingProxyProvider.cs" />
<Compile Include="Caching\ICache.cs" />
<Compile Include="Caching\ICachingProxyProvider.cs" />
<Compile Include="Caching\IMemoizer.cs" />
<Compile Include="Caching\IMetadataProvider.cs" />
<Compile Include="Caching\MetadataProvider.cs" />
Expand Down
2 changes: 1 addition & 1 deletion Gigya.Microdot.UnitTests/TestingHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
using Gigya.Microdot.Interfaces.Events;
using Gigya.Microdot.Interfaces.Logging;
using Gigya.Microdot.Ninject;
using Gigya.Microdot.Ninject.Host;
using Gigya.Microdot.SharedLogic;
using Gigya.Ninject.Host;
using Ninject;
using Ninject.Syntax;
using NSubstitute;
Expand Down

0 comments on commit b465cf5

Please sign in to comment.