Skip to content

Commit

Permalink
Merge pull request #8 from nsip/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
bencart authored Jul 29, 2017
2 parents 5b558fb + 3f1f43a commit 3f86be8
Show file tree
Hide file tree
Showing 86 changed files with 1,152 additions and 984 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("3.2.1.0")]
[assembly: AssemblyFileVersion("3.2.1.0")]
[assembly: AssemblyVersion("3.2.1.3")]
[assembly: AssemblyFileVersion("3.2.1.3")]
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Iesi.Collections.4.0.1.4000\lib\net40\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Sif3FrameworkDemo\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
Expand All @@ -61,6 +61,14 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\SharedLibs\Sif.Specification.Infrastructure 3.2.1\Sif.Specification.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="slf4net, Version=0.1.32.1, Culture=neutral, PublicKeyToken=592edb3b6b36b5ba, processorArchitecture=MSIL">
<HintPath>..\packages\slf4net.0.1.32.1\lib\net35\slf4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="slf4net.log4net, Version=0.1.32.1, Culture=neutral, PublicKeyToken=592edb3b6b36b5ba, processorArchitecture=MSIL">
<HintPath>..\packages\slf4net.log4net.0.1.32.1\lib\net35\slf4net.log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.SQLite, Version=1.0.94.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\System.Data.SQLite.Core.1.0.94.0\lib\net45\System.Data.SQLite.dll</HintPath>
Expand Down Expand Up @@ -117,6 +125,9 @@
<Content Include="packages.config">
<SubType>Designer</SubType>
</Content>
<Content Include="log4net.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</None>
Expand Down
78 changes: 15 additions & 63 deletions Code/Sif3Framework/Sif.Framework.EnvironmentProvider/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@
http://go.microsoft.com/fwlink/?LinkId=301879
-->
<configuration>
<!-- Register a section handler for the log4net section -->
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<section name="slf4net" type="slf4net.Configuration.SlfConfigurationSection, slf4net" />
</configSections>

<slf4net>
<factory type="slf4net.log4net.Log4netLoggerFactory, slf4net.log4net">
<factory-data>
<configFile value="log4net.config" />
<watch value="true" />
</factory-data>
</factory>
</slf4net>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
Expand All @@ -28,75 +33,22 @@
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.webServer>
<handlers>
<remove name="WebDAV"/>
<remove name="WebDAV" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
<modules>
<remove name="WebDAVModule"/>
<remove name="WebDAVModule" />
</modules>
</system.webServer>

<!-- This section contains the log4net configuration settings. -->
<log4net>
<appender name="ManagedColoredConsoleAppender" type="log4net.Appender.ManagedColoredConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{yyyyMMdd;HH:mm:ss} %level %logger{1} - %message%newline"/>
</layout>
<mapping>
<level value="ERROR" />
<foreColor value="DarkRed" />
</mapping>
<mapping>
<level value="WARN" />
<foreColor value="DarkYellow" />
</mapping>
<mapping>
<level value="DEBUG" />
<foreColor value="DarkGreen" />
</mapping>
<mapping>
<level value="INFO" />
<foreColor value="DarkBlue" />
</mapping>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="App.log"/>
<appendToFile value="true"/>
<lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
<maxSizeRollBackups value="10"/>
<maximumFileSize value="1MB"/>
<rollingStyle value="Size"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<header value="[START %utcdate]&#xD;&#xA;" />
<footer value="[END %utcdate]&#xD;&#xA;" />
<conversionPattern value="%utcdate %-5level %logger{3} - %property{instance} - %message%newline"/>
</layout>
</appender>
<root>
<level value="WARN"/>
<appender-ref ref="ManagedColoredConsoleAppender"/>
<appender-ref ref="RollingLogFileAppender"/>
</root>
<!-- Specify the level for some specific categories -->
<!--logger name="NHibernate">
<level value="WARN"/>
</logger-->
<logger name="Sif.Framework">
<level value="DEBUG"/>
</logger>
<logger name="Sif.Framework.EnvironmentProvider">
<level value="DEBUG"/>
</logger>
</log4net>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
</configSections>
<log4net>
<appender name="TraceAppender" type="log4net.Appender.TraceAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
<root>
<level value="WARN" />
<appender-ref ref="TraceAppender" />
</root>
<logger name="Sif.Framework">
<level value="DEBUG" />
</logger>
</log4net>
</configuration>
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Iesi.Collections" version="4.0.1.4000" targetFramework="net45" />
<package id="log4net" version="2.0.8" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.5" targetFramework="net45" />
<package id="log4net" version="2.0.3" targetFramework="net45" />
<package id="NHibernate" version="4.0.1.4000" targetFramework="net45" />
<package id="slf4net" version="0.1.32.1" targetFramework="net45" />
<package id="slf4net.log4net" version="0.1.32.1" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.94.0" targetFramework="net45" />
</packages>
17 changes: 15 additions & 2 deletions Code/Sif3Framework/Sif.Framework.Tests/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>

<configSections>
<section name="slf4net" type="slf4net.Configuration.SlfConfigurationSection, slf4net" />
</configSections>
<slf4net>
<factory type="slf4net.log4net.Log4netLoggerFactory, slf4net.log4net">
<factory-data>
<configFile value="log4net.config" />
<watch value="true" />
</factory-data>
</factory>
</slf4net>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
Expand All @@ -11,7 +21,10 @@
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

</configuration>
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// 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("3.2.1.0")]
[assembly: AssemblyFileVersion("3.2.1.0")]
[assembly: AssemblyVersion("3.2.1.3")]
[assembly: AssemblyFileVersion("3.2.1.3")]
15 changes: 15 additions & 0 deletions Code/Sif3Framework/Sif.Framework.Tests/Sif.Framework.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Iesi.Collections.4.0.1.4000\lib\net40\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NHibernate, Version=4.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NHibernate.4.0.1.4000\lib\net40\NHibernate.dll</HintPath>
Expand All @@ -47,6 +51,14 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\SharedLibs\Sif.Specification.Infrastructure 3.2.1\Sif.Specification.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="slf4net, Version=0.1.32.1, Culture=neutral, PublicKeyToken=592edb3b6b36b5ba, processorArchitecture=MSIL">
<HintPath>..\packages\slf4net.0.1.32.1\lib\net35\slf4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="slf4net.log4net, Version=0.1.32.1, Culture=neutral, PublicKeyToken=592edb3b6b36b5ba, processorArchitecture=MSIL">
<HintPath>..\packages\slf4net.log4net.0.1.32.1\lib\net35\slf4net.log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
Expand Down Expand Up @@ -103,6 +115,9 @@
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<Content Include="log4net.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
Expand Down
48 changes: 48 additions & 0 deletions Code/Sif3Framework/Sif.Framework.Tests/log4net.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
</configSections>
<log4net>
<appender name="ManagedColoredConsoleAppender" type="log4net.Appender.ManagedColoredConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{yyyyMMdd;HH:mm:ss} %level %logger{1} - %message%newline" />
</layout>
<mapping>
<level value="ERROR" />
<foreColor value="White" />
<backColor value="DarkRed" />
</mapping>
<mapping>
<level value="WARN" />
<foreColor value="White" />
<backColor value="DarkYellow" />
</mapping>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="App.log" />
<appendToFile value="true" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="1MB" />
<rollingStyle value="Size" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.DynamicPatternLayout">
<header value="[BEGIN %date]%newline" />
<footer value="[END %date]%newline" />
<conversionPattern value="%date %-5level %logger{3} - %property{instance} - %message%newline" />
</layout>
</appender>
<root>
<level value="WARN" />
<appender-ref ref="ManagedColoredConsoleAppender" />
<appender-ref ref="RollingFileAppender" />
</root>
<logger name="Sif.Framework">
<level value="DEBUG" />
</logger>
</log4net>
</configuration>
3 changes: 3 additions & 0 deletions Code/Sif3Framework/Sif.Framework.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Iesi.Collections" version="4.0.1.4000" targetFramework="net45" />
<package id="log4net" version="2.0.8" targetFramework="net45" />
<package id="NHibernate" version="4.0.1.4000" targetFramework="net45" />
<package id="slf4net" version="0.1.32.1" targetFramework="net45" />
<package id="slf4net.log4net" version="0.1.32.1" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.94.0" targetFramework="net45" />
</packages>
16 changes: 7 additions & 9 deletions Code/Sif3Framework/Sif.Framework/Consumers/Consumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

using log4net;
using Sif.Framework.Extensions;
using Sif.Framework.Model.DataModels;
using Sif.Framework.Model.Query;
Expand All @@ -27,7 +26,6 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
using System.Text;
using Environment = Sif.Framework.Model.Infrastructure.Environment;

Expand All @@ -42,7 +40,7 @@ namespace Sif.Framework.Consumers
/// <typeparam name="TPrimaryKey">Primary key type of the SIF data model object.</typeparam>
public class Consumer<TSingle, TMultiple, TPrimaryKey> : IConsumer<TSingle, TMultiple, TPrimaryKey> where TSingle : ISifRefId<TPrimaryKey>
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly slf4net.ILogger log = slf4net.LoggerFactory.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

private Environment environmentTemplate;
private IRegistrationService registrationService;
Expand Down Expand Up @@ -176,9 +174,9 @@ public string GetChangesSinceMarker(string zoneId = null, string contextId = nul
}

/// <summary>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Create(TSingle, string, string)">Create</see>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Create(TSingle, bool?, string, string)">Create</see>
/// </summary>
public virtual TSingle Create(TSingle obj, string zoneId = null, string contextId = null)
public virtual TSingle Create(TSingle obj, bool? mustUseAdvisory = null, string zoneId = null, string contextId = null)
{

if (!RegistrationService.Registered)
Expand All @@ -188,17 +186,17 @@ public virtual TSingle Create(TSingle obj, string zoneId = null, string contextI

string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + TypeName + HttpUtils.MatrixParameters(zoneId, contextId);
string body = SerialiseSingle(obj);
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body);
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, mustUseAdvisory: mustUseAdvisory);
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
if (log.IsDebugEnabled) log.Debug(xml);

return DeserialiseSingle(xml);
}

/// <summary>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Create(TMultiple, string, string)">Create</see>
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Create(TMultiple, bool?, string, string)">Create</see>
/// </summary>
public virtual MultipleCreateResponse Create(TMultiple obj, string zoneId = null, string contextId = null)
public virtual MultipleCreateResponse Create(TMultiple obj, bool? mustUseAdvisory = null, string zoneId = null, string contextId = null)
{

if (!RegistrationService.Registered)
Expand All @@ -208,7 +206,7 @@ public virtual MultipleCreateResponse Create(TMultiple obj, string zoneId = null

string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zoneId, contextId);
string body = SerialiseMultiple(obj);
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body);
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, mustUseAdvisory: mustUseAdvisory);
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
if (log.IsDebugEnabled) log.Debug(xml);
createResponseType createResponseType = SerialiserFactory.GetXmlSerialiser<createResponseType>().Deserialise(xml);
Expand Down
Loading

0 comments on commit 3f86be8

Please sign in to comment.