Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IDataServiceQueryProvider implementation seems good.
- Loading branch information
1 parent
17e5f0a
commit 2675198
Showing
35 changed files
with
941 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
src/MongoDB.OData.IntegrationTests/MongoDB.OData.IntegrationTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,83 @@ | |||
<?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>{628EAB24-C5B8-47C4-B634-EECA4089BDA4}</ProjectGuid> | |||
<OutputType>Library</OutputType> | |||
<AppDesignerFolder>Properties</AppDesignerFolder> | |||
<RootNamespace>MongoDB.OData.IntegrationTests</RootNamespace> | |||
<AssemblyName>MongoDB.OData.IntegrationTests</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>bin\Debug\</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>bin\Release\</OutputPath> | |||
<DefineConstants>TRACE</DefineConstants> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Reference Include="Microsoft.Data.Edm, Version=5.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | |||
<SpecificVersion>False</SpecificVersion> | |||
<HintPath>..\..\packages\Microsoft.Data.Edm.5.0.1\lib\net40\Microsoft.Data.Edm.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.Data.OData, Version=5.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | |||
<SpecificVersion>False</SpecificVersion> | |||
<HintPath>..\..\packages\Microsoft.Data.OData.5.0.1\lib\net40\Microsoft.Data.OData.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.Data.Services, Version=5.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | |||
<SpecificVersion>False</SpecificVersion> | |||
<HintPath>..\..\packages\Microsoft.Data.Services.5.0.1\lib\net40\Microsoft.Data.Services.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.Data.Services.Client, Version=5.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | |||
<SpecificVersion>False</SpecificVersion> | |||
<HintPath>..\..\packages\Microsoft.Data.Services.Client.5.0.1\lib\net40\Microsoft.Data.Services.Client.dll</HintPath> | |||
</Reference> | |||
<Reference Include="MongoDB.Bson"> | |||
<HintPath>..\..\packages\mongocsharpdriver.1.5\lib\net35\MongoDB.Bson.dll</HintPath> | |||
</Reference> | |||
<Reference Include="MongoDB.Driver"> | |||
<HintPath>..\..\packages\mongocsharpdriver.1.5\lib\net35\MongoDB.Driver.dll</HintPath> | |||
</Reference> | |||
<Reference Include="System" /> | |||
<Reference Include="System.Core" /> | |||
<Reference Include="System.Spatial, Version=5.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | |||
<SpecificVersion>False</SpecificVersion> | |||
<HintPath>..\..\packages\System.Spatial.5.0.1\lib\net40\System.Spatial.dll</HintPath> | |||
</Reference> | |||
<Reference Include="System.Xml.Linq" /> | |||
<Reference Include="System.Data.DataSetExtensions" /> | |||
<Reference Include="Microsoft.CSharp" /> | |||
<Reference Include="System.Data" /> | |||
<Reference Include="System.Xml" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Include="Properties\AssemblyInfo.cs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Include="packages.config" /> | |||
</ItemGroup> | |||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
<Import Project="$(SolutionDir)\tools\NuGet\nuget.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> |
36 changes: 36 additions & 0 deletions
36
src/MongoDB.OData.IntegrationTests/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | 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("MongoDB.OData.IntegrationTests")] | |||
[assembly: AssemblyDescription("")] | |||
[assembly: AssemblyConfiguration("")] | |||
[assembly: AssemblyCompany("Microsoft")] | |||
[assembly: AssemblyProduct("MongoDB.OData.IntegrationTests")] | |||
[assembly: AssemblyCopyright("Copyright © Microsoft 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("db1ce51c-c044-4790-8820-ae9c423ae9c3")] | |||
|
|||
// 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")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<packages> | |||
<package id="Microsoft.Data.Edm" version="5.0.1" /> | |||
<package id="Microsoft.Data.OData" version="5.0.1" /> | |||
<package id="Microsoft.Data.Services" version="5.0.1" /> | |||
<package id="Microsoft.Data.Services.Client" version="5.0.1" /> | |||
<package id="mongocsharpdriver" version="1.5" /> | |||
<package id="System.Spatial" version="5.0.1" /> | |||
</packages> |
2 changes: 1 addition & 1 deletion
2
src/MongoDB.OData.SampleHost/Sample.svc → src/MongoDB.OData.SampleHost/BlogApi.svc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,3 +1,3 @@ | |||
| | ||
|
|
||
<%@ ServiceHost Language="C#" Factory="System.Data.Services.DataServiceHostFactory, System.Data.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Service="MongoDB.OData.SampleHost.Sample" %> | <%@ ServiceHost Language="C#" Factory="System.Data.Services.DataServiceHostFactory, System.Data.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Service="MongoDB.OData.SampleHost.BlogApi" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
| |||
|
|||
<%@ ServiceHost Language="C#" Factory="System.Data.Services.DataServiceHostFactory, System.Data.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Service="MongoDB.OData.SampleHost.HumanResourcesApi" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,103 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Data.Services; | |||
using System.Data.Services.Common; | |||
using System.Linq; | |||
using System.ServiceModel.Web; | |||
using System.Web; | |||
using MongoDB.Bson.Serialization; | |||
using MongoDB.Driver; | |||
using MongoDB.OData.SampleModels.HumanResources; | |||
|
|||
namespace MongoDB.OData.SampleHost | |||
{ | |||
public class HumanResourcesApi : TypedMongoDataService | |||
{ | |||
// This method is called only once to initialize service-wide policies. | |||
public static void InitializeService(DataServiceConfiguration config) | |||
{ | |||
TypedMongoDataService.Configure(config); | |||
config.SetEntitySetAccessRule("*", EntitySetRights.All); | |||
config.UseVerboseErrors = true; | |||
} | |||
|
|||
protected override void BuildMetadata(TypedMongoDataServiceMetadataBuilder builder) | |||
{ | |||
if (!BsonClassMap.IsClassMapRegistered(typeof(Person))) | |||
{ | |||
BsonClassMap.RegisterClassMap<Person>(cm => | |||
{ | |||
cm.AutoMap(); | |||
cm.SetIsRootClass(true); | |||
cm.AddKnownType(typeof(Employee)); | |||
cm.AddKnownType(typeof(Manager)); | |||
cm.AddKnownType(typeof(Contractor)); | |||
}); | |||
} | |||
|
|||
builder.SetContainer("MongoDB.Samples", "HumanResources"); | |||
builder.AddResourceSet<Person>("People", "odata_hr", "people"); | |||
} | |||
|
|||
protected override MongoServer CreateDataSource() | |||
{ | |||
var server = MongoServer.Create(); | |||
|
|||
//create data if none exists... | |||
var db = server.GetDatabase("odata_hr"); | |||
|
|||
var people = db.GetCollection<Person>("people"); | |||
|
|||
if (people.Count() > 0) | |||
{ | |||
return server; | |||
} | |||
|
|||
var employee1 = new Employee | |||
{ | |||
Id = "Employee1", | |||
HireDate = new DateTime(2005, 1, 1), | |||
Name = new Name { First = "Jack", Last = "McJack" }, | |||
Salary = 1200 | |||
}; | |||
|
|||
var employee2 = new Employee | |||
{ | |||
Id = "Employee2", | |||
HireDate = new DateTime(2007, 1, 1), | |||
Name = new Name { First = "Jane", Last = "McJane" }, | |||
Salary = 1300 | |||
}; | |||
|
|||
var contractor1 = new Contractor | |||
{ | |||
Id = "Contractor1", | |||
HireDate = new DateTime(2010, 1, 1), | |||
Name = new Name { First = "Joe", Last = "McJoe" }, | |||
Salary = 300, | |||
Address = "123 Main ST.", | |||
}; | |||
|
|||
var manager1 = new Manager | |||
{ | |||
Id = "Manager1", | |||
HireDate = new DateTime(2000, 1, 1), | |||
Name = new Name { First = "Jim", Last = "McJim" }, | |||
Salary = 2000, | |||
Employees = new List<PersonRef> | |||
{ | |||
new PersonRef { Id = employee1.Id, Name = employee1.Name }, | |||
new PersonRef { Id = employee2.Id, Name = employee2.Name }, | |||
new PersonRef { Id = contractor1.Id, Name = contractor1.Name }, | |||
} | |||
}; | |||
|
|||
people.Save(employee1); | |||
people.Save(employee2); | |||
people.Save(contractor1); | |||
people.Save(manager1); | |||
|
|||
return server; | |||
} | |||
} | |||
} |
Oops, something went wrong.