Skip to content

Commit 7c734c3

Browse files
Merge pull request #595 from JocaPC/master
Updated WWI App and CLR sample
2 parents 8e892b9 + 73a418a commit 7c734c3

5 files changed

Lines changed: 45 additions & 23 deletions

File tree

samples/databases/wide-world-importers/wwi-app/wwi-app.csproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
<EmbeddedResource Remove="wwwroot\public\**" />
1111
<None Remove="wwwroot\public\**" />
1212
</ItemGroup>
13+
<ItemGroup>
14+
<Content Remove="wwwroot\OData.tt" />
15+
</ItemGroup>
1316
<ItemGroup>
1417
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.2" />
1518
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.0.3" />
@@ -24,6 +27,12 @@
2427
<ItemGroup>
2528
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
2629
</ItemGroup>
30+
<ItemGroup>
31+
<EmbeddedResource Include="wwwroot\OData.tt">
32+
<Generator>TextTemplatingFileGenerator</Generator>
33+
<LastGenOutput>OData.yaml</LastGenOutput>
34+
</EmbeddedResource>
35+
</ItemGroup>
2736
<ItemGroup>
2837
<None Update="Controllers\ODataController.tt">
2938
<LastGenOutput>ODataController.cs</LastGenOutput>
@@ -55,4 +64,11 @@
5564
<Folder Include="wwwroot\lib\nvd3-new\" />
5665
<Folder Include="wwwroot\lib\nvd3\" />
5766
</ItemGroup>
67+
<ItemGroup>
68+
<Content Update="wwwroot\OData.yaml">
69+
<DesignTime>True</DesignTime>
70+
<AutoGen>True</AutoGen>
71+
<DependentUpon>OData.tt</DependentUpon>
72+
</Content>
73+
</ItemGroup>
5874
</Project>

samples/databases/wide-world-importers/wwi-app/wwwroot/OData.tt

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,23 @@ paths:
3636
get:
3737
tags:
3838
- "<#= t.Table #>"
39-
summary: "Find information about <#= t.Table #>"
40-
description: "Multiple status values can be provided with comma separated strings"
39+
summary: "Provides information about <#= t.Table #> using OData protocol."
40+
description: "Enables querying <#= t.Table #> information using OData parameters."
4141
operationId: "<#= t.Table #>"
4242
produces:
4343
- "application/json"
4444
parameters:
4545
- name: "$select"
4646
in: "query"
47-
description: "Selecting the properties that should be returned by service"
47+
description: "Selecting the <#= t.Table #> properties that should be returned by service."
4848
required: false
4949
type: "array"
5050
items:
5151
type: "string"
52-
enum:<# foreach(var c in t.ODataColumns.Split(',')) {#>
53-
- "<#= c #>"<# } #>
52+
enum:
53+
<# foreach(var c in t.ODataColumns.Split(',')) {#>
54+
- "<#= c #>"
55+
<# } #>
5456
collectionFormat: "multi"
5557
- name: "$orderby"
5658
in: "query"
@@ -59,29 +61,31 @@ paths:
5961
type: "array"
6062
items:
6163
type: "string"
62-
enum:<# foreach(var c in t.ODataColumns.Split(',')) {#>
64+
enum:
65+
<# foreach(var c in t.ODataColumns.Split(',')) {#>
6366
- "<#= c #>"
6467
- "<#= c #> asc"
65-
- "<#= c #> desc"<# } #>
68+
- "<#= c #> desc"
69+
<# } #>
6670
collectionFormat: "multi"
6771
- name: "$top"
6872
in: "query"
69-
description: "Selecting the properties that should be returned by service"
73+
description: "Selecting the <#= t.Table #> properties that should be returned by the API."
7074
required: false
7175
type: "integer"
7276
- name: "$skip"
7377
in: "query"
74-
description: "Selecting the properties that should be returned by service"
78+
description: "Specify number of <#= t.Table #> records that should be skipped."
7579
required: false
7680
type: "integer"
7781
- name: "$apply"
7882
in: "query"
79-
description: "aggregation function that should be applied on the results"
83+
description: "Aggregation function that should be applied on the results."
8084
required: false
8185
type: "string"
8286
- name: "$filter"
8387
in: "query"
84-
description: "Condition that returned items must satisfy"
88+
description: "Condition that returned <#= t.Table #> items must satisfy. It can contain and, or, not logical operators and lt, le, gt, ge, ne, eq relational operators."
8589
required: false
8690
type: "string"
8791
responses:
@@ -90,12 +94,13 @@ paths:
9094
400:
9195
description: "The OData request is not valid"
9296
500:
93-
description: "Cannot process request"<# } #>
97+
description: "OData service cannot process request"<# } #>
9498
<#+
9599
public class TableDef {
96100
public string Schema {get; set;}
97101
public string Table {get; set;}
98102
public string ODataColumns {get; set;}
99103
public bool IsReadOnly {get; set;}
100104
}
105+
101106
#>

samples/features/sql-clr/Curl/Curl.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ private static void AddHeader(SqlChars H, WebClient client)
7575
{
7676
var header = H.ToSqlString().Value;
7777
if (!string.IsNullOrWhiteSpace(header))
78-
client.Headers.Add(header);
78+
foreach(string h in header.Split(';'))
79+
client.Headers.Add(h);
7980
}
8081
}
8182
};

samples/features/sql-clr/Curl/README.md

Lines changed: 6 additions & 8 deletions
Large diffs are not rendered by default.

samples/features/sql-clr/Curl/SqlClrCurl.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>SqlClr</RootNamespace>
1111
<AssemblyName>SqlClrCurl</AssemblyName>
12-
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
14+
<TargetFrameworkProfile />
1415
</PropertyGroup>
1516
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1617
<DebugSymbols>true</DebugSymbols>
@@ -20,6 +21,7 @@
2021
<DefineConstants>DEBUG;TRACE</DefineConstants>
2122
<ErrorReport>prompt</ErrorReport>
2223
<WarningLevel>4</WarningLevel>
24+
<Prefer32Bit>false</Prefer32Bit>
2325
</PropertyGroup>
2426
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2527
<DebugType>none</DebugType>
@@ -28,6 +30,7 @@
2830
<DefineConstants>TRACE</DefineConstants>
2931
<ErrorReport>prompt</ErrorReport>
3032
<WarningLevel>4</WarningLevel>
33+
<Prefer32Bit>false</Prefer32Bit>
3134
</PropertyGroup>
3235
<PropertyGroup>
3336
<SignAssembly>true</SignAssembly>
@@ -43,7 +46,6 @@
4346
<Reference Include="System.Data.DataSetExtensions" />
4447
<Reference Include="Microsoft.CSharp" />
4548
<Reference Include="System.Data" />
46-
<Reference Include="System.Net.Http" />
4749
<Reference Include="System.Xml" />
4850
</ItemGroup>
4951
<ItemGroup>

0 commit comments

Comments
 (0)