Skip to content

Commit afc98c2

Browse files
authored
Merge pull request #12 from Access4LearningUK/develop
Addition of Functional Services
2 parents c8ae162 + 06f713f commit afc98c2

180 files changed

Lines changed: 56388 additions & 432 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ DocProject/Help/*.hhp
7474
DocProject/Help/Html2
7575
DocProject/Help/html
7676

77+
# Generated IIS configuration
78+
applicationhost.config
79+
7780
# Click-Once directory
7881
publish
7982

@@ -108,3 +111,7 @@ Generated_Code #added for RIA/Silverlight projects
108111
_UpgradeReport_Files/
109112
Backup*/
110113
UpgradeLog*.XML
114+
115+
# Log files
116+
*.log
117+
*.log.[123456789]

Code/Sif3Framework/Sif.Framework.EnvironmentProvider/App_Start/WebApiConfig.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Web.Http;
1+
using System.Web.Http;
52

63
namespace Sif.Framework.EnvironmentProvider
74
{

Code/Sif3Framework/Sif.Framework.EnvironmentProvider/Sif.Framework.EnvironmentProvider.csproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
<SpecificVersion>False</SpecificVersion>
4545
<HintPath>..\packages\Iesi.Collections.4.0.1.4000\lib\net40\Iesi.Collections.dll</HintPath>
4646
</Reference>
47+
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
48+
<SpecificVersion>False</SpecificVersion>
49+
<HintPath>..\..\Sif3FrameworkDemo\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath>
50+
</Reference>
4751
<Reference Include="Microsoft.CSharp" />
4852
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
4953
<SpecificVersion>False</SpecificVersion>
@@ -53,9 +57,9 @@
5357
<SpecificVersion>False</SpecificVersion>
5458
<HintPath>..\packages\NHibernate.4.0.1.4000\lib\net40\NHibernate.dll</HintPath>
5559
</Reference>
56-
<Reference Include="Sif.Specification.Infrastructure, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
60+
<Reference Include="Sif.Specification.Infrastructure, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL">
5761
<SpecificVersion>False</SpecificVersion>
58-
<HintPath>..\..\..\SharedLibs\Sif.Specification.Infrastructure 3.0.1\Sif.Specification.Infrastructure.dll</HintPath>
62+
<HintPath>..\..\..\SharedLibs\Sif.Specification.Infrastructure 3.2.0\Sif.Specification.Infrastructure.dll</HintPath>
5963
</Reference>
6064
<Reference Include="System.Data.SQLite, Version=1.0.94.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
6165
<SpecificVersion>False</SpecificVersion>

Code/Sif3Framework/Sif.Framework.EnvironmentProvider/SifFramework.cfg.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<property name="connection.driver_class">NHibernate.Driver.SQLite20Driver</property>
88
<property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
99
<property name="query.substitutions">true=1;false=0</property>
10-
10+
1111
<!-- SQL Server LocalDB specific properties -->
1212
<!--
1313
<property name="connection.connection_string">Server=(localdb)\v11.0;Integrated Security=true;AttachDbFileName=C:\Users\user\Documents\GitHub\Sif3Framework-dotNet\Data\Databases\LocalDB\SifFrameworkDatabase.mdf;</property>
@@ -17,8 +17,8 @@
1717
-->
1818

1919
<!-- SQL Server specific properties -->
20-
<!--
21-
<property name="connection.connection_string">Server=machine_name\SQLEXPRESS;Database=SifFrameworkDatabase;Trusted_Connection=True;</property>
20+
<!--
21+
<property name="connection.connection_string">Server=machine_name\SQLEXPRESS;Database=SifFrameworkDatabase;Trusted_Connection=True;</property>
2222
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
2323
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
2424
<property name="hbm2ddl.keywords">auto-quote</property>
@@ -40,7 +40,7 @@
4040
-->
4141

4242
<!-- Properties that are not specific to a database type -->
43-
<property name="show_sql">true</property>
43+
<property name="show_sql">false</property>
4444
<!-- Mapping files -->
4545
<mapping assembly="Sif.Framework"/>
4646
</session-factory>

Code/Sif3Framework/Sif.Framework.EnvironmentProvider/Web.config

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
http://go.microsoft.com/fwlink/?LinkId=301879
55
-->
66
<configuration>
7-
<appSettings>
8-
</appSettings>
7+
<!-- Register a section handler for the log4net section -->
8+
<configSections>
9+
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
10+
</configSections>
11+
912
<system.web>
1013
<compilation debug="true" targetFramework="4.5" />
1114
<httpRuntime targetFramework="4.5" />
1215
</system.web>
13-
16+
1417
<runtime>
1518
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
1619
<dependentAssembly>
@@ -27,11 +30,73 @@
2730
</dependentAssembly>
2831
</assemblyBinding>
2932
</runtime>
30-
<system.webServer>
33+
<system.webServer>
3134
<handlers>
35+
<remove name="WebDAV"/>
3236
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
3337
<remove name="OPTIONSVerbHandler" />
3438
<remove name="TRACEVerbHandler" />
3539
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
3640
</handlers>
37-
</system.webServer></configuration>
41+
<modules>
42+
<remove name="WebDAVModule"/>
43+
</modules>
44+
</system.webServer>
45+
46+
<!-- This section contains the log4net configuration settings. -->
47+
<log4net>
48+
<appender name="ManagedColoredConsoleAppender" type="log4net.Appender.ManagedColoredConsoleAppender">
49+
<layout type="log4net.Layout.PatternLayout">
50+
<conversionPattern value="%date{yyyyMMdd;HH:mm:ss} %level %logger{1} - %message%newline"/>
51+
</layout>
52+
<mapping>
53+
<level value="ERROR" />
54+
<foreColor value="DarkRed" />
55+
</mapping>
56+
<mapping>
57+
<level value="WARN" />
58+
<foreColor value="DarkYellow" />
59+
</mapping>
60+
<mapping>
61+
<level value="DEBUG" />
62+
<foreColor value="DarkGreen" />
63+
</mapping>
64+
<mapping>
65+
<level value="INFO" />
66+
<foreColor value="DarkBlue" />
67+
</mapping>
68+
<layout type="log4net.Layout.PatternLayout">
69+
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
70+
</layout>
71+
</appender>
72+
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
73+
<file value="App.log"/>
74+
<appendToFile value="true"/>
75+
<lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
76+
<maxSizeRollBackups value="10"/>
77+
<maximumFileSize value="1MB"/>
78+
<rollingStyle value="Size"/>
79+
<staticLogFileName value="true"/>
80+
<layout type="log4net.Layout.PatternLayout">
81+
<header value="[START %utcdate]&#xD;&#xA;" />
82+
<footer value="[END %utcdate]&#xD;&#xA;" />
83+
<conversionPattern value="%utcdate %-5level %logger{3} - %property{instance} - %message%newline"/>
84+
</layout>
85+
</appender>
86+
<root>
87+
<level value="WARN"/>
88+
<appender-ref ref="ManagedColoredConsoleAppender"/>
89+
<appender-ref ref="RollingLogFileAppender"/>
90+
</root>
91+
<!-- Specify the level for some specific categories -->
92+
<!--logger name="NHibernate">
93+
<level value="WARN"/>
94+
</logger-->
95+
<logger name="Sif.Framework">
96+
<level value="DEBUG"/>
97+
</logger>
98+
<logger name="Sif.Framework.EnvironmentProvider">
99+
<level value="DEBUG"/>
100+
</logger>
101+
</log4net>
102+
</configuration>

Code/Sif3Framework/Sif.Framework.EnvironmentProvider/packages.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
77
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net45" />
88
<package id="Newtonsoft.Json" version="6.0.5" targetFramework="net45" />
9+
<package id="log4net" version="2.0.3" targetFramework="net45" />
910
<package id="NHibernate" version="4.0.1.4000" targetFramework="net45" />
1011
<package id="System.Data.SQLite.Core" version="1.0.94.0" targetFramework="net45" />
1112
</packages>

Code/Sif3Framework/Sif.Framework.Tests/DataFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ public static Environment CreateEnvironmentResponse()
9393
{ subscriptionsURL.Name, subscriptionsURL }
9494
};
9595

96-
Right adminRight = new Right { Type = "ADMIN", Value = "APPROVED" };
97-
Right createRight = new Right { Type = "CREATE", Value = "APPROVED" };
96+
Right adminRight = new Right() { Type = RightType.ADMIN.ToString(), Value = RightValue.APPROVED.ToString() };
97+
Right createRight = new Right() { Type = RightType.CREATE.ToString(), Value = RightValue.APPROVED.ToString() };
9898
IDictionary<string, Right> rights = new Dictionary<string, Right> { { adminRight.Type, adminRight } };
9999

100100
Infrastructure.Service studentPersonalsService = new Infrastructure.Service

Code/Sif3Framework/Sif.Framework.Tests/Sif.Framework.Tests.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@
4343
<SpecificVersion>False</SpecificVersion>
4444
<HintPath>..\packages\NHibernate.4.0.1.4000\lib\net40\NHibernate.dll</HintPath>
4545
</Reference>
46-
<Reference Include="Sif.Specification.Infrastructure">
47-
<HintPath>..\..\..\SharedLibs\Sif.Specification.Infrastructure 3.0.1\Sif.Specification.Infrastructure.dll</HintPath>
46+
<Reference Include="Sif.Specification.Infrastructure, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL">
47+
<SpecificVersion>False</SpecificVersion>
48+
<HintPath>..\..\..\SharedLibs\Sif.Specification.Infrastructure 3.2.0\Sif.Specification.Infrastructure.dll</HintPath>
4849
</Reference>
4950
<Reference Include="System" />
5051
<Reference Include="System.ComponentModel.DataAnnotations" />

Code/Sif3Framework/Sif.Framework/Consumers/Consumer.cs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public Consumer(Environment environment)
101101
/// <param name="applicationKey">Application key.</param>
102102
/// <param name="instanceId">Instance ID.</param>
103103
/// <param name="userToken">User token.</param>
104-
/// <param name="solutionId">Olution ID.</param>
104+
/// <param name="solutionId">Solution ID.</param>
105105
public Consumer(string applicationKey, string instanceId = null, string userToken = null, string solutionId = null)
106106
{
107107
Environment environment = new Environment(applicationKey, instanceId, userToken, solutionId);
@@ -115,6 +115,7 @@ public Consumer(string applicationKey, string instanceId = null, string userToke
115115
/// <param name="zone">Zone associated with a request.</param>
116116
/// <param name="context">Zone context.</param>
117117
/// <returns>String of Matrix Parameters.</returns>
118+
[Obsolete("This method is obsolete; HttpUtils.MatrixParameters instead")]
118119
private string MatrixParameters(string zone = null, string context = null)
119120
{
120121
string matrixParameters = "";
@@ -173,7 +174,7 @@ public void Register()
173174
}
174175

175176
/// <summary>
176-
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Unregister()">Unregister</see>
177+
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Unregister(bool?)">Unregister</see>
177178
/// </summary>
178179
public void Unregister(bool? deleteOnUnregister = null)
179180
{
@@ -191,7 +192,7 @@ public virtual TSingle Create(TSingle obj, string zone = null, string context =
191192
throw new InvalidOperationException("Consumer has not registered.");
192193
}
193194

194-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + TypeName + MatrixParameters(zone, context);
195+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + TypeName + HttpUtils.MatrixParameters(zone, context);
195196
string body = SerialiseSingle(obj);
196197
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body);
197198
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
@@ -201,7 +202,7 @@ public virtual TSingle Create(TSingle obj, string zone = null, string context =
201202
}
202203

203204
/// <summary>
204-
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Create(TMultiple)">Create</see>
205+
/// <see cref="IConsumer{TSingle,TMultiple,TPrimaryKey}.Create(TMultiple, string, string)">Create</see>
205206
/// </summary>
206207
public virtual MultipleCreateResponse Create(TMultiple obj, string zone = null, string context = null)
207208
{
@@ -211,7 +212,7 @@ public virtual MultipleCreateResponse Create(TMultiple obj, string zone = null,
211212
throw new InvalidOperationException("Consumer has not registered.");
212213
}
213214

214-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
215+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
215216
string body = SerialiseMultiple(obj);
216217
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body);
217218
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
@@ -237,7 +238,7 @@ public virtual TSingle Query(TPrimaryKey refId, string zone = null, string conte
237238

238239
try
239240
{
240-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + MatrixParameters(zone, context);
241+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + HttpUtils.MatrixParameters(zone, context);
241242
string xml = HttpUtils.GetRequest(url, RegistrationService.AuthorisationToken);
242243
if (log.IsDebugEnabled) log.Debug("XML from GET request ...");
243244
if (log.IsDebugEnabled) log.Debug(xml);
@@ -281,7 +282,7 @@ public virtual TMultiple Query(uint? navigationPage = null, uint? navigationPage
281282
throw new InvalidOperationException("Consumer has not registered.");
282283
}
283284

284-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
285+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
285286
string xml;
286287

287288
if (navigationPage.HasValue && navigationPageSize.HasValue)
@@ -307,7 +308,7 @@ public virtual TMultiple QueryByExample(TSingle obj, uint? navigationPage = null
307308
throw new InvalidOperationException("Consumer has not registered.");
308309
}
309310

310-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
311+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
311312
string body = SerialiseSingle(obj);
312313
// TODO: Update PostRequest to accept paging parameters.
313314
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, "GET");
@@ -340,7 +341,7 @@ public virtual TMultiple QueryByServicePath(IEnumerable<EqualCondition> conditio
340341

341342
}
342343

343-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + servicePath + "/" + TypeName + "s" + MatrixParameters(zone, context);
344+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + servicePath + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
344345
if (log.IsDebugEnabled) log.Debug("Service Path URL is " + url);
345346
string xml;
346347

@@ -367,7 +368,7 @@ public virtual void Update(TSingle obj, string zone = null, string context = nul
367368
throw new InvalidOperationException("Consumer has not registered.");
368369
}
369370

370-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + obj.RefId + MatrixParameters(zone, context);
371+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + obj.RefId + HttpUtils.MatrixParameters(zone, context);
371372
string body = SerialiseSingle(obj);
372373
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body);
373374
if (log.IsDebugEnabled) log.Debug("XML from PUT request ...");
@@ -385,7 +386,7 @@ public virtual MultipleUpdateResponse Update(TMultiple obj, string zone = null,
385386
throw new InvalidOperationException("Consumer has not registered.");
386387
}
387388

388-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
389+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
389390
string body = SerialiseMultiple(obj);
390391
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body);
391392
if (log.IsDebugEnabled) log.Debug("XML from PUT request ...");
@@ -407,7 +408,7 @@ public virtual void Delete(TPrimaryKey refId, string zone = null, string context
407408
throw new InvalidOperationException("Consumer has not registered.");
408409
}
409410

410-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + MatrixParameters(zone, context);
411+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + "/" + refId + HttpUtils.MatrixParameters(zone, context);
411412
string xml = HttpUtils.DeleteRequest(url, RegistrationService.AuthorisationToken);
412413
if (log.IsDebugEnabled) log.Debug("XML from DELETE request ...");
413414
if (log.IsDebugEnabled) log.Debug(xml);
@@ -433,7 +434,7 @@ public virtual MultipleDeleteResponse Delete(IEnumerable<TPrimaryKey> refIds, st
433434
}
434435

435436
deleteRequestType request = new deleteRequestType { deletes = deleteIds.ToArray() };
436-
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + MatrixParameters(zone, context);
437+
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zone, context);
437438
string body = SerialiserFactory.GetXmlSerialiser<deleteRequestType>().Serialise(request);
438439
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body, "DELETE");
439440
if (log.IsDebugEnabled) log.Debug("XML from PUT (DELETE) request ...");

0 commit comments

Comments
 (0)