Skip to content

Commit

Permalink
Update EF solution
Browse files Browse the repository at this point in the history
  • Loading branch information
chinadragon0515 committed Aug 4, 2016
1 parent 42ce651 commit d164004
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion RESTier.EF7.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{D5E947EB-03CB-4D04-8937-FF2131BB1F04}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
using Microsoft.Restier.Core.Submit;
using Microsoft.Restier.Providers.EntityFramework.Properties;

namespace Microsoft.Restier.Providers.EntityFramework.Submit
namespace Microsoft.Restier.Providers.EntityFramework
{
/// <summary>
/// To prepare changed entries for the given <see cref="ChangeSet"/>.
Expand All @@ -43,13 +43,13 @@ public async Task InitializeAsync(

foreach (var entry in context.ChangeSet.Entries.OfType<DataModificationItem>())
{
object strongTypedDbSet = dbContext.GetType().GetProperty(entry.EntitySetName).GetValue(dbContext);
object strongTypedDbSet = dbContext.GetType().GetProperty(entry.ResourceSetName).GetValue(dbContext);
Type entityType = strongTypedDbSet.GetType().GetGenericArguments()[0];

// This means request entity is sub type of entity type
if (entry.ActualEntityType != null && entityType != entry.ActualEntityType)
// This means request resource is sub type of resource type
if (entry.ActualResourceType != null && entityType != entry.ActualResourceType)
{
entityType = entry.ActualEntityType;
entityType = entry.ActualResourceType;
}

MethodInfo prepareEntryMethod = prepareEntryGeneric.MakeGenericMethod(entityType);
Expand Down Expand Up @@ -104,15 +104,15 @@ private static async Task PrepareEntry<TEntity>(
throw new NotSupportedException(Resources.DataModificationMustBeCUD);
}

entry.Entity = entity;
entry.Resource = entity;
}

private static async Task<object> FindEntity(
SubmitContext context,
DataModificationItem entry,
CancellationToken cancellationToken)
{
IQueryable query = context.ApiContext.GetQueryableSource(entry.EntitySetName);
IQueryable query = context.ApiContext.GetQueryableSource(entry.ResourceSetName);
query = entry.ApplyTo(query);

QueryResult result = await context.ApiContext.QueryAsync(new QueryRequest(query), cancellationToken);
Expand Down Expand Up @@ -150,7 +150,7 @@ private static object CreateFullUpdateInstance(DataModificationItem entry, Type
// This will set any unspecified properties to their default value.
object newInstance = Activator.CreateInstance(entityType);

ChangeSetInitializer.SetValues(newInstance, entityType, entry.EntityKey);
ChangeSetInitializer.SetValues(newInstance, entityType, entry.ResourceKey);
ChangeSetInitializer.SetValues(newInstance, entityType, entry.LocalValues);

return newInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using Microsoft.Restier.Providers.EntityFramework7.Tests.Models.Primitives;
using Microsoft.Restier.Publishers.OData;
using Microsoft.Restier.Publishers.OData.Batch;
using Microsoft.Restier.Publishers.OData.Routing;
using Microsoft.Restier.Tests;
using Newtonsoft.Json;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@
<HintPath>..\..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.OData, Version=5.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNet.OData.5.9.0\lib\net45\System.Web.OData.dll</HintPath>
<Reference Include="System.Web.OData, Version=5.9.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNet.OData.5.9.1\lib\net45\System.Web.OData.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Ix-Async" version="1.2.5" targetFramework="net451" />
<package id="Microsoft.AspNet.OData" version="5.9.0" targetFramework="net451" />
<package id="Microsoft.AspNet.OData" version="5.9.1" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net451" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@
<HintPath>..\..\..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.OData, Version=5.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.AspNet.OData.5.9.0\lib\net45\System.Web.OData.dll</HintPath>
<Reference Include="System.Web.OData, Version=5.9.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.AspNet.OData.5.9.1\lib\net45\System.Web.OData.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Ix-Async" version="1.2.5" targetFramework="net451" />
<package id="Microsoft.AspNet.OData" version="5.9.0" targetFramework="net451" />
<package id="Microsoft.AspNet.OData" version="5.9.1" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net451" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
<HintPath>..\..\..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.OData, Version=5.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.AspNet.OData.5.9.0\lib\net45\System.Web.OData.dll</HintPath>
<Reference Include="System.Web.OData, Version=5.9.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.AspNet.OData.5.9.1\lib\net45\System.Web.OData.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Ix-Async" version="1.2.5" targetFramework="net451" />
<package id="Microsoft.AspNet.OData" version="5.9.0" targetFramework="net451" />
<package id="Microsoft.AspNet.OData" version="5.9.1" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net451" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<Reference Include="FluentAssertions, Version=4.12.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\FluentAssertions.4.12.0\lib\net45\FluentAssertions.dll</HintPath>
<Reference Include="FluentAssertions, Version=4.13.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\FluentAssertions.4.13.0\lib\net45\FluentAssertions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FluentAssertions.Core, Version=4.12.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\FluentAssertions.4.12.0\lib\net45\FluentAssertions.Core.dll</HintPath>
<Reference Include="FluentAssertions.Core, Version=4.13.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\FluentAssertions.4.13.0\lib\net45\FluentAssertions.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.OData.Client, Version=6.15.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FluentAssertions" version="4.12.0" targetFramework="net45" />
<package id="FluentAssertions" version="4.13.0" targetFramework="net45" />
<package id="Microsoft.OData.Client" version="6.15.0" targetFramework="net45" />
<package id="Microsoft.OData.Core" version="6.15.0" targetFramework="net45" />
<package id="Microsoft.OData.Edm" version="6.15.0" targetFramework="net45" />
Expand Down

0 comments on commit d164004

Please sign in to comment.