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
Binary file not shown.
Binary file not shown.
Binary file not shown.
5,476 changes: 5,476 additions & 0 deletions src/Packages/FluentAssertions.1.7.1.1/Lib/net35/FluentAssertions.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
5,476 changes: 5,476 additions & 0 deletions src/Packages/FluentAssertions.1.7.1.1/Lib/net40/FluentAssertions.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
5,260 changes: 5,260 additions & 0 deletions src/Packages/FluentAssertions.1.7.1.1/Lib/sl40/FluentAssertions.Silverlight.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.
1,655 changes: 1,655 additions & 0 deletions src/Packages/FluentAssertions.1.7.1.1/Lib/sl40/System.Xml.Linq.xml

Large diffs are not rendered by default.

Binary file not shown.
1,633 changes: 1,633 additions & 0 deletions src/Packages/FluentAssertions.1.7.1.1/Lib/sl40/System.Xml.Serialization.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6,186 changes: 6,186 additions & 0 deletions src/Packages/Ninject.3.0.0.15/lib/net35/Ninject.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
6,134 changes: 6,134 additions & 0 deletions src/Packages/Ninject.3.0.0.15/lib/net40/Ninject.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
6,134 changes: 6,134 additions & 0 deletions src/Packages/Ninject.3.0.0.15/lib/net45-full/Ninject.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
6,097 changes: 6,097 additions & 0 deletions src/Packages/Ninject.3.0.0.15/lib/sl2/Ninject.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
6,048 changes: 6,048 additions & 0 deletions src/Packages/Ninject.3.0.0.15/lib/sl3-wp/Ninject.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
6,097 changes: 6,097 additions & 0 deletions src/Packages/Ninject.3.0.0.15/lib/sl3/Ninject.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
5,996 changes: 5,996 additions & 0 deletions src/Packages/Ninject.3.0.0.15/lib/sl4-windowsphone71/Ninject.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
6,045 changes: 6,045 additions & 0 deletions src/Packages/Ninject.3.0.0.15/lib/sl4/Ninject.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
6,045 changes: 6,045 additions & 0 deletions src/Packages/Ninject.3.0.0.15/lib/sl5/Ninject.xml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/Packages/repositories.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<repositories>
<repository path="..\ServiceLocators\SimpleCqrs.Ninject\packages.config" />
<repository path="..\ServiceLocators\SimpleCqrs.StructureMap\packages.config" />
<repository path="..\Tests\ServiceLocators\SimpleCqrs.Ninject.Tests\packages.config" />
</repositories>
288 changes: 288 additions & 0 deletions src/ServiceLocators/SimpleCqrs.Ninject/NinjectServiceLocator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,288 @@
// -----------------------------------------------------------------------
// Juan Pablo Olmos Lara
// https://github.com/jupaol
// jupaol@hotmail.com
// http://jupaol.blogspot.com/
// -----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using Ninject;

namespace SimpleCqrs.Ninject
{
/// <summary>
/// Ninject service locator
/// </summary>
public class NinjectServiceLocator : IServiceLocator
{
/// <summary>
/// Ninject kernel used as the current IoC container
/// </summary>
private IKernel kernel;

/// <summary>
/// Error message used when the type specified in the register methods is null
/// </summary>
private const string TypeNullErrorMessage = "The container does not accept null types to be registered";

/// <summary>
/// Error message used when the key specified in the register methods is null, empty or a string with white spaces only
/// </summary>
private const string KeyNullErrorMessage = "The key cannot be null, empty or a string with white spaces only";

/// <summary>
/// Error message used when the kernel is null
/// </summary>
private const string KernelNullErrorMessage = "The specified Ninject kernel cannot be null";

/// <summary>
/// Error message used when the reset method is called, actually it is not supported because Ninject does not suppor reseting the container
/// </summary>
private const string ResetingNinjectContainerErrorMessage = "Ninject does not support reseting the container";

/// <summary>
/// Error message used when the instance passed to the register methods is null
/// </summary>
private const string InstanceNullErrorMessage = "Null objects cannot be registered in the container";

/// <summary>
/// Error message used when the calling delegate passed to the register methods is null
/// </summary>
private const string CallingDelegateNullErrorMessage = "The calling delegate connot be null";

/// <summary>
/// Initializes a new instance of the <see cref="NinjectServiceLocator"/> class.
/// </summary>
/// <remarks>
/// It creates a new instance of the <see cref="StandardKernel"/> to initialize this instance
/// </remarks>
public NinjectServiceLocator()
: this(new StandardKernel())
{
}

/// <summary>
/// Initializes a new instance of the <see cref="NinjectServiceLocator"/> class.
/// </summary>
/// <param name="kernel">The Ninject kernel.</param>
public NinjectServiceLocator(IKernel kernel)
{
if (kernel == null)
{
throw new ArgumentNullException("kernel", KernelNullErrorMessage);
}

this.IsDisposed = false;
this.kernel = kernel;
}

/// <summary>
/// Gets or sets a value indicating whether this instance is disposed.
/// </summary>
/// <value>
/// <c>true</c> if this instance is disposed; otherwise, <c>false</c>.
/// </value>
public bool IsDisposed { get; protected set; }

public T Resolve<T>() where T : class
{
try
{
return this.kernel.Get<T>();
}
catch (Exception ex)
{
throw new ServiceResolutionException(typeof(T), ex);
}
}

public T Resolve<T>(string key) where T : class
{
try
{
return this.kernel.Get<T>(key);
}
catch (Exception ex)
{
throw new ServiceResolutionException(typeof(T), ex);
}
}

public object Resolve(Type type)
{
try
{
return this.kernel.Get(type);
}
catch (Exception ex)
{
throw new ServiceResolutionException(typeof(Type), ex);
}
}

public IList<T> ResolveServices<T>() where T : class
{
try
{
return this.kernel.GetAll<T>().ToList();
}
catch (Exception ex)
{
throw new ServiceResolutionException(typeof(T), ex);
}
}

public void Register<TInterface>(Type implType) where TInterface : class
{
if (implType == null)
{
throw new ArgumentNullException("implType", TypeNullErrorMessage);
}

this.kernel.Bind<TInterface>().To(implType);
}

public void Register<TInterface, TImplementation>() where TImplementation : class, TInterface
{
this.kernel.Bind<TInterface>().To<TImplementation>();
}

public void Register<TInterface, TImplementation>(string key) where TImplementation : class, TInterface
{
if (string.IsNullOrWhiteSpace(key))
{
throw new ArgumentNullException("key", KeyNullErrorMessage);
}

this.kernel.Bind<TInterface>().To<TImplementation>().Named(key);
}

public void Register(string key, Type type)
{
if (string.IsNullOrWhiteSpace(key))
{
throw new ArgumentNullException("key", KeyNullErrorMessage);
}

if (type == null)
{
throw new ArgumentNullException("implType", TypeNullErrorMessage);
}

this.kernel.Bind(type).ToSelf().Named(key);
}

public void Register(Type serviceType, Type implType)
{
if (serviceType == null)
{
throw new ArgumentNullException("serviceType", TypeNullErrorMessage);
}

if (implType == null)
{
throw new ArgumentNullException("implType", TypeNullErrorMessage);
}

this.kernel.Bind(serviceType).To(implType);
}

public void Register<TInterface>(TInterface instance) where TInterface : class
{
if (instance == null)
{
throw new ArgumentNullException("instance", InstanceNullErrorMessage);
}

this.kernel.Bind<TInterface>().ToConstant(instance);
}

public void Release(object instance)
{
if (instance == null)
{
return;
}

// TODO: verify call
this.kernel.Release(instance);
}

public void Reset()
{
throw new NotImplementedException(ResetingNinjectContainerErrorMessage);
}

public TService Inject<TService>(TService instance) where TService : class
{
if (instance == null)
{
throw new ArgumentNullException("instance", InstanceNullErrorMessage);
}

this.kernel.Inject(instance);
return instance;
}

public void TearDown<TService>(TService instance) where TService : class
{
if (instance == null)
{
return;
}

// TODO: verify call
this.kernel.Release(instance);
}

public void Register<TInterface>(Func<TInterface> factoryMethod) where TInterface : class
{
if (factoryMethod == null)
{
throw new ArgumentNullException("factoryMethod", CallingDelegateNullErrorMessage);
}

TInterface theInstance = factoryMethod();

if (theInstance == null)
{
throw new ArgumentNullException("factoryMethod", TypeNullErrorMessage);
}

this.kernel.Bind<TInterface>().ToMethod(x => theInstance);
}

/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
this.Dispose(true);
}

/// <summary>
/// Releases unmanaged and - optionally - managed resources
/// </summary>
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
if (!this.IsDisposed)
{
if (disposing)
{
if (this.kernel != null)
{
if (!this.kernel.IsDisposed)
{
this.kernel.Dispose();
}
}
}

this.IsDisposed = true;
}
}
}
}
36 changes: 36 additions & 0 deletions src/ServiceLocators/SimpleCqrs.Ninject/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("SimpleCqrs.Ninject")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Hewlett-Packard")]
[assembly: AssemblyProduct("SimpleCqrs.Ninject")]
[assembly: AssemblyCopyright("Copyright © Hewlett-Packard 2012")]
[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("d1e8154b-8823-48a2-a5e2-b796d5981615")]

// 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")]
62 changes: 62 additions & 0 deletions src/ServiceLocators/SimpleCqrs.Ninject/SimpleCqrs.Ninject.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?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>{6D4FCE2F-FEFE-4D41-9BC2-C8AC5DDEBAC7}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SimpleCqrs.Ninject</RootNamespace>
<AssemblyName>SimpleCqrs.Ninject</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>..\..\..\binaries\servicelocators\ninject\</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>..\..\..\binaries\servicelocators\ninject\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Ninject">
<HintPath>..\..\packages\Ninject.3.0.0.15\lib\net40\Ninject.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="NinjectServiceLocator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\SimpleCqrs\SimpleCqrs.csproj">
<Project>{E04C12B5-A6D3-4D64-9F38-896BEE68162E}</Project>
<Name>SimpleCqrs</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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Loading