Skip to content

Commit 06dfba2

Browse files
committed
Revert
1 parent 30c003a commit 06dfba2

File tree

7 files changed

+44
-1109
lines changed

7 files changed

+44
-1109
lines changed

samples/searchable-todo/src/.vs/config/applicationhost.config

Lines changed: 0 additions & 1038 deletions
This file was deleted.

samples/searchable-todo/src/searchabletodo/Data/DocumentDBRepository.cs

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ public static class DocumentDBRepository<T> where T : Document
1515
{
1616
public static T Get(Expression<Func<T, bool>> predicate)
1717
{
18-
return Client.CreateDocumentQuery<T>(Collection.DocumentsLink, DefaultOptions)
19-
.Where(predicate)
20-
.AsEnumerable()
21-
.FirstOrDefault();
18+
return Client.CreateDocumentQuery<T>(Collection.DocumentsLink)
19+
.Where(predicate)
20+
.AsEnumerable()
21+
.FirstOrDefault();
2222
}
2323

2424
public static T GetById(string id)
2525
{
26-
T doc = Client.CreateDocumentQuery<T>(Collection.SelfLink, DefaultOptions)
26+
T doc = Client.CreateDocumentQuery<T>(Collection.SelfLink)
2727
.Where(d => d.Id == id)
2828
.AsEnumerable()
2929
.FirstOrDefault();
@@ -33,7 +33,7 @@ public static T GetById(string id)
3333

3434
public static IEnumerable<T> Find(Expression<Func<T, bool>> predicate)
3535
{
36-
var ret = Client.CreateDocumentQuery<T>(Collection.SelfLink, DefaultOptions)
36+
var ret = Client.CreateDocumentQuery<T>(Collection.SelfLink)
3737
.Where(predicate)
3838
.AsEnumerable();
3939

@@ -43,7 +43,6 @@ public static IEnumerable<T> Find(Expression<Func<T, bool>> predicate)
4343
public static async Task<T> CreateAsync(T entity)
4444
{
4545
Document doc = await Client.CreateDocumentAsync(Collection.SelfLink, entity);
46-
4746
T ret = (T)(dynamic)doc;
4847
return ret;
4948
}
@@ -60,6 +59,7 @@ public static async Task DeleteAsync(string id)
6059
await Client.DeleteDocumentAsync(doc.SelfLink);
6160
}
6261

62+
private static string databaseId;
6363
public static String DatabaseId
6464
{
6565
get
@@ -74,6 +74,7 @@ public static String DatabaseId
7474
}
7575
}
7676

77+
private static string collectionId;
7778
public static String CollectionId
7879
{
7980
get
@@ -88,6 +89,7 @@ public static String CollectionId
8889
}
8990
}
9091

92+
private static Database database;
9193
private static Database Database
9294
{
9395
get
@@ -102,6 +104,7 @@ private static Database Database
102104
}
103105
}
104106

107+
private static DocumentCollection collection;
105108
private static DocumentCollection Collection
106109
{
107110
get
@@ -115,6 +118,7 @@ private static DocumentCollection Collection
115118
}
116119
}
117120

121+
private static DocumentClient client;
118122
private static DocumentClient Client
119123
{
120124
get
@@ -138,47 +142,33 @@ private static DocumentClient Client
138142

139143
public static DocumentCollection GetOrCreateCollection(string databaseLink, string collectionId)
140144
{
141-
var collection = Client.CreateDocumentCollectionQuery(databaseLink)
142-
.Where(c => c.Id == collectionId)
143-
.AsEnumerable()
144-
.FirstOrDefault();
145+
var col = Client.CreateDocumentCollectionQuery(databaseLink)
146+
.Where(c => c.Id == collectionId)
147+
.AsEnumerable()
148+
.FirstOrDefault();
145149

146-
if (collection == null)
150+
if (col == null)
147151
{
148-
DocumentCollection collectionDefinition = new DocumentCollection();
149-
collectionDefinition.Id = collectionId;
150-
collectionDefinition.PartitionKey.Paths.Add("/title");
151-
collectionDefinition.IndexingPolicy = new IndexingPolicy(new RangeIndex(DataType.String) { Precision = -1 });
152-
153-
collection = client.CreateDocumentCollectionAsync(
154-
databaseLink,
155-
collectionDefinition,
156-
new RequestOptions { OfferThroughput = 500 }
157-
).Result;
152+
col = client.CreateDocumentCollectionAsync(databaseLink,
153+
new DocumentCollection { Id = collectionId },
154+
new RequestOptions { OfferType = "S1" }).Result;
158155
}
159156

160-
return collection;
157+
return col;
161158
}
162159
public static Database GetOrCreateDatabase(string databaseId)
163160
{
164-
Database database = Client.CreateDatabaseQuery()
165-
.Where(d => d.Id == databaseId)
166-
.AsEnumerable()
167-
.FirstOrDefault();
161+
var db = Client.CreateDatabaseQuery()
162+
.Where(d => d.Id == databaseId)
163+
.AsEnumerable()
164+
.FirstOrDefault();
168165

169-
if (database == null)
166+
if (db == null)
170167
{
171-
database = client.CreateDatabaseAsync(new Database { Id = databaseId }).Result;
168+
db = client.CreateDatabaseAsync(new Database { Id = databaseId }).Result;
172169
}
173170

174-
return database;
171+
return db;
175172
}
176-
177-
private static FeedOptions DefaultOptions = new FeedOptions { EnableCrossPartitionQuery = true };
178-
private static string databaseId;
179-
private static string collectionId;
180-
private static Database database;
181-
private static DocumentCollection collection;
182-
private static DocumentClient client;
183173
}
184174
}

samples/searchable-todo/src/searchabletodo/Global.asax.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ protected void Application_Start()
2626

2727
// uncomment to force reset and reload
2828
// ItemSearchRepository.DeleteAll().Wait();
29-
//ItemSearchRepository.SetupSearchAsync().Wait();
30-
//ItemSearchRepository.RunIndexerAsync().Wait();
29+
ItemSearchRepository.SetupSearchAsync().Wait();
30+
ItemSearchRepository.RunIndexerAsync().Wait();
3131
}
3232
}
3333
}

samples/searchable-todo/src/searchabletodo/Models/Item.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class Item : Document
2121
public bool Completed { get; set; }
2222

2323
private DateTime dueDate;
24-
[DataType(System.ComponentModel.DataAnnotations.DataType.Date)]
24+
[DataType(DataType.Date)]
2525
[JsonProperty(PropertyName = "dueDate")]
2626
public DateTime DueDate
2727
{

samples/searchable-todo/src/searchabletodo/Web.config

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,17 @@
99
<add key="webpages:Enabled" value="false" />
1010
<add key="ClientValidationEnabled" value="true" />
1111
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
12+
1213
<add key="search-endpoint" value="https://[your search accountname].search.windows.net" />
1314
<add key="search-authKey" value="C07F27D774D1E484E31508A7F382306F" />
14-
<add key="docdb-endpoint" value="https://querydemo.documents.azure.com:443/" />
15-
<add key="docdb-authKey" value="+9x2hFc7QsZ5hReULaqmBs01amCFiQAJZuoTqdZ79h/fGd2RSYoJVXAegVS7suJBg1pB+RQC8D45gp7bk0rSUw==" />
15+
16+
<add key="docdb-endpoint" value="https://[your documentdb account name].documents.azure.com:443/" />
17+
<add key="docdb-authKey" value="[your primary / secondary master key]" />
1618
<add key="docdb-database" value="todo" />
1719
<add key="docdb-collection" value="items" />
1820
</appSettings>
19-
<!--
20-
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
21-
22-
The following attributes can be set on the <httpRuntime> tag.
23-
<system.Web>
24-
<httpRuntime targetFramework="4.5.1" />
25-
</system.Web>
26-
-->
2721
<system.web>
28-
<compilation debug="true" targetFramework="4.5.1" />
22+
<compilation debug="true" targetFramework="4.5" />
2923
<httpRuntime targetFramework="4.5" />
3024
</system.web>
3125
<runtime>
@@ -60,4 +54,4 @@
6054
</dependentAssembly>
6155
</assemblyBinding>
6256
</runtime>
63-
</configuration>
57+
</configuration>

samples/searchable-todo/src/searchabletodo/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
1010
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
1111
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
12-
<package id="Microsoft.Azure.DocumentDB" version="1.6.0" targetFramework="net451" />
12+
<package id="Microsoft.Azure.DocumentDB" version="1.0.0" targetFramework="net45" />
1313
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.3" targetFramework="net45" />
1414
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
1515
<package id="Modernizr" version="2.8.3" targetFramework="net45" />

samples/searchable-todo/src/searchabletodo/searchabletodo.csproj

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,14 @@
1313
<AppDesignerFolder>Properties</AppDesignerFolder>
1414
<RootNamespace>searchabletodo</RootNamespace>
1515
<AssemblyName>searchabletodo</AssemblyName>
16-
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
16+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1717
<MvcBuildViews>false</MvcBuildViews>
1818
<UseIISExpress>true</UseIISExpress>
1919
<IISExpressSSLPort />
2020
<IISExpressAnonymousAuthentication />
2121
<IISExpressWindowsAuthentication />
2222
<IISExpressUseClassicPipelineMode />
2323
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
24-
<TargetFrameworkProfile />
25-
<UseGlobalApplicationHostFile />
26-
<NuGetPackageImportStamp>
27-
</NuGetPackageImportStamp>
2824
</PropertyGroup>
2925
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
3026
<DebugSymbols>true</DebugSymbols>
@@ -48,9 +44,8 @@
4844
<SpecificVersion>False</SpecificVersion>
4945
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
5046
</Reference>
51-
<Reference Include="Microsoft.Azure.Documents.Client, Version=1.6.0.0, Culture=neutral, PublicKeyToken=69c3241e6f0468ca, processorArchitecture=MSIL">
52-
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.6.0\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
53-
<Private>True</Private>
47+
<Reference Include="Microsoft.Azure.Documents.Client">
48+
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.0.0\lib\net40\Microsoft.Azure.Documents.Client.dll</HintPath>
5449
</Reference>
5550
<Reference Include="Microsoft.CSharp" />
5651
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
@@ -59,13 +54,13 @@
5954
</Reference>
6055
<Reference Include="System" />
6156
<Reference Include="System.Data" />
62-
<Reference Include="System.Data.DataSetExtensions" />
6357
<Reference Include="System.Drawing" />
6458
<Reference Include="System.Web.DynamicData" />
6559
<Reference Include="System.Web.Entity" />
6660
<Reference Include="System.Web.ApplicationServices" />
6761
<Reference Include="System.ComponentModel.DataAnnotations" />
68-
<Reference Include="System.Web.Extensions" />
62+
<Reference Include="System.Core" />
63+
<Reference Include="System.Data.DataSetExtensions" />
6964
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7065
<SpecificVersion>False</SpecificVersion>
7166
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
@@ -90,7 +85,9 @@
9085
<SpecificVersion>False</SpecificVersion>
9186
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
9287
</Reference>
88+
<Reference Include="System.Xml.Linq" />
9389
<Reference Include="System.Web" />
90+
<Reference Include="System.Web.Extensions" />
9491
<Reference Include="System.Web.Abstractions" />
9592
<Reference Include="System.Web.Routing" />
9693
<Reference Include="System.Xml" />
@@ -108,7 +105,6 @@
108105
<Reference Include="System.Web.Optimization">
109106
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
110107
</Reference>
111-
<Reference Include="System.Xml.Linq" />
112108
<Reference Include="WebGrease, Version=1.6.5135.21930, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
113109
<SpecificVersion>False</SpecificVersion>
114110
<HintPath>..\packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath>
@@ -251,13 +247,6 @@
251247
</FlavorProperties>
252248
</VisualStudio>
253249
</ProjectExtensions>
254-
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.6.0\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.6.0\build\Microsoft.Azure.DocumentDB.targets')" />
255-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
256-
<PropertyGroup>
257-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
258-
</PropertyGroup>
259-
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.6.0\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.6.0\build\Microsoft.Azure.DocumentDB.targets'))" />
260-
</Target>
261250
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
262251
Other similar extension points exist, see Microsoft.Common.targets.
263252
<Target Name="BeforeBuild">

0 commit comments

Comments
 (0)