#60 Merge FeatureModel into Http.Features. Remove unused FeatureObject.

This commit is contained in:
Chris R 2015-07-16 15:10:48 -07:00
parent 6a21a4bc26
commit b8af07e3c1
29 changed files with 15 additions and 257 deletions

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23017.0
VisualStudioVersion = 14.0.22823.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A5A15F1C-885A-452A-A731-B0173DDBD913}"
EndProject
@ -13,11 +13,9 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Http.Abstr
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Http.Features", "src\Microsoft.AspNet.Http.Features\Microsoft.AspNet.Http.Features.xproj", "{D9128247-8F97-48B8-A863-F1F21A029FCE}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.FeatureModel", "src\Microsoft.AspNet.FeatureModel\Microsoft.AspNet.FeatureModel.xproj", "{32A4C918-30EE-41DB-8E26-8A3BB88ED231}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Http.Tests", "test\Microsoft.AspNet.Http.Tests\Microsoft.AspNet.Http.Tests.xproj", "{AA99AF26-F7B1-4A6B-A922-5C25539F6391}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.FeatureModel.Tests", "test\Microsoft.AspNet.FeatureModel.Tests\Microsoft.AspNet.FeatureModel.Tests.xproj", "{C5D2BAE1-E182-48A0-AA74-1AF14B782BF7}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Http.Features.Tests", "test\Microsoft.AspNet.Http.Features.Tests\Microsoft.AspNet.Http.Features.Tests.xproj", "{C5D2BAE1-E182-48A0-AA74-1AF14B782BF7}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Http.Abstractions.Tests", "test\Microsoft.AspNet.Http.Abstractions.Tests\Microsoft.AspNet.Http.Abstractions.Tests.xproj", "{F16692B8-9F38-4DCA-A582-E43172B989C6}"
EndProject
@ -85,16 +83,6 @@ Global
{D9128247-8F97-48B8-A863-F1F21A029FCE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D9128247-8F97-48B8-A863-F1F21A029FCE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D9128247-8F97-48B8-A863-F1F21A029FCE}.Release|x86.ActiveCfg = Release|Any CPU
{32A4C918-30EE-41DB-8E26-8A3BB88ED231}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{32A4C918-30EE-41DB-8E26-8A3BB88ED231}.Debug|Any CPU.Build.0 = Debug|Any CPU
{32A4C918-30EE-41DB-8E26-8A3BB88ED231}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{32A4C918-30EE-41DB-8E26-8A3BB88ED231}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{32A4C918-30EE-41DB-8E26-8A3BB88ED231}.Debug|x86.ActiveCfg = Debug|Any CPU
{32A4C918-30EE-41DB-8E26-8A3BB88ED231}.Release|Any CPU.ActiveCfg = Release|Any CPU
{32A4C918-30EE-41DB-8E26-8A3BB88ED231}.Release|Any CPU.Build.0 = Release|Any CPU
{32A4C918-30EE-41DB-8E26-8A3BB88ED231}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{32A4C918-30EE-41DB-8E26-8A3BB88ED231}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{32A4C918-30EE-41DB-8E26-8A3BB88ED231}.Release|x86.ActiveCfg = Release|Any CPU
{AA99AF26-F7B1-4A6B-A922-5C25539F6391}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA99AF26-F7B1-4A6B-A922-5C25539F6391}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA99AF26-F7B1-4A6B-A922-5C25539F6391}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@ -265,7 +253,6 @@ Global
{BCF0F967-8753-4438-BD07-AADCA9CE509A} = {A5A15F1C-885A-452A-A731-B0173DDBD913}
{22071333-15BA-4D16-A1D5-4D5B1A83FBDD} = {A5A15F1C-885A-452A-A731-B0173DDBD913}
{D9128247-8F97-48B8-A863-F1F21A029FCE} = {A5A15F1C-885A-452A-A731-B0173DDBD913}
{32A4C918-30EE-41DB-8E26-8A3BB88ED231} = {A5A15F1C-885A-452A-A731-B0173DDBD913}
{AA99AF26-F7B1-4A6B-A922-5C25539F6391} = {F31FF137-390C-49BF-A3BD-7C6ED3597C21}
{C5D2BAE1-E182-48A0-AA74-1AF14B782BF7} = {F31FF137-390C-49BF-A3BD-7C6ED3597C21}
{F16692B8-9F38-4DCA-A582-E43172B989C6} = {F31FF137-390C-49BF-A3BD-7C6ED3597C21}

View File

@ -1,166 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
namespace Microsoft.AspNet.FeatureModel
{
public class FeatureObject : IFeatureCollection
{
private readonly object _instance;
public FeatureObject(object instance)
{
_instance = instance;
}
public void Dispose()
{
var disposable = _instance as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}
public object GetInterface(Type type)
{
if (type.IsInstanceOfType(_instance))
{
return _instance;
}
return null;
}
public void SetInterface(Type type, object feature)
{
throw new NotImplementedException();
}
public int Revision
{
get { return 0; }
}
public IEnumerator<KeyValuePair<Type, object>> GetEnumerator()
{
return GetTypeInterfaces()
.Select(interfaceType => new KeyValuePair<Type, object>(interfaceType, _instance))
.GetEnumerator();
}
private IEnumerable<Type> GetTypeInterfaces()
{
return _instance.GetType()
.GetTypeInfo()
.ImplementedInterfaces;
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public void Add(KeyValuePair<Type, object> item)
{
throw new NotImplementedException();
}
public void Clear()
{
throw new NotImplementedException();
}
public bool Contains(KeyValuePair<Type, object> item)
{
throw new NotImplementedException();
}
public void CopyTo(KeyValuePair<Type, object>[] array, int arrayIndex)
{
var enumerator = GetTypeInterfaces().GetEnumerator();
for (var index = 0; index != arrayIndex; ++index)
{
if (!enumerator.MoveNext())
{
throw new IndexOutOfRangeException();
}
}
for (var index = 0; index != array.Length; ++index)
{
if (!enumerator.MoveNext())
{
throw new IndexOutOfRangeException();
}
array[index] = new KeyValuePair<Type, object>(enumerator.Current, _instance);
}
}
public bool Remove(KeyValuePair<Type, object> item)
{
throw new NotImplementedException();
}
public int Count
{
get { return GetTypeInterfaces().Count(); }
}
public bool IsReadOnly
{
get { return true; }
}
public bool ContainsKey(Type key)
{
return key.GetTypeInfo().IsAssignableFrom(_instance.GetType().GetTypeInfo());
}
public void Add(Type key, object value)
{
throw new NotImplementedException();
}
public bool Remove(Type key)
{
throw new NotImplementedException();
}
public bool TryGetValue(Type key, out object value)
{
value = GetInterface(key);
return value != null;
}
public object this[Type key]
{
get { return GetInterface(key); }
set { throw new NotImplementedException(); }
}
public ICollection<Type> Keys
{
get { return GetTypeInterfaces().ToArray(); }
}
public ICollection<object> Values
{
get
{
var length = GetTypeInterfaces().Count();
var array = new object[length];
for (var index = 0; index != length; ++index)
{
array[index] = _instance;
}
return array;
}
}
}
}

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>32a4c918-30ee-41db-8e26-8a3bb88ed231</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -1,6 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
[assembly: AssemblyMetadata("Serviceable", "True")]

View File

@ -1,25 +0,0 @@
{
"version": "1.0.0-*",
"description": "ASP.NET 5 HTTP feature infrastructure.",
"repository": {
"type": "git",
"url": "git://github.com/aspnet/httpabstractions"
},
"dependencies": {
"Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" }
},
"frameworks": {
"dnx451": {},
"dnxcore50": {
"dependencies": {
"System.Collections": "4.0.10-beta-*",
"System.Linq": "4.0.0-beta-*",
"System.Reflection": "4.0.10-beta-*",
"System.Reflection.TypeExtensions": "4.0.0-beta-*",
"System.Runtime": "4.0.20-beta-*",
"System.Runtime.InteropServices": "4.0.20-beta-*",
"System.Threading": "4.0.10-beta-*"
}
}
}
}

View File

@ -6,7 +6,7 @@ using System.Collections;
using System.Collections.Generic;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.FeatureModel
namespace Microsoft.AspNet.Http.Features
{
public class FeatureCollection : IFeatureCollection
{

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNet.FeatureModel
namespace Microsoft.AspNet.Http.Features
{
public struct FeatureReference<T>
{

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace Microsoft.AspNet.FeatureModel
namespace Microsoft.AspNet.Http.Features
{
public interface IFeatureCollection : IDictionary<Type, object>, IDisposable
{

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Http.Features.Authentication;
using Microsoft.AspNet.Http.Features.Authentication.Internal;

View File

@ -5,7 +5,6 @@ using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Http.Features.Internal;

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.Http.Authentication;
using Microsoft.AspNet.Http.Authentication.Internal;
using Microsoft.AspNet.Http.Features;

View File

@ -5,7 +5,6 @@ using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Http.Features.Internal;
using Microsoft.Net.Http.Headers;

View File

@ -4,7 +4,6 @@
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Http.Features.Internal;
using Microsoft.Net.Http.Headers;

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Net.WebSockets;
using System.Threading.Tasks;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.Http.Features;
using Microsoft.Net.Http.Headers;

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.Http.Internal;
using Microsoft.AspNet.WebUtilities;
using Microsoft.Framework.Internal;

View File

@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.Http.Internal;
using Microsoft.Framework.Internal;
using Microsoft.Net.Http.Headers;

View File

@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.Http.Internal;
namespace Microsoft.AspNet.Http.Features.Internal

View File

@ -6,7 +6,6 @@
"url": "git://github.com/aspnet/httpabstractions"
},
"dependencies": {
"Microsoft.AspNet.FeatureModel": "1.0.0-*",
"Microsoft.AspNet.Http.Abstractions": "1.0.0-*",
"Microsoft.AspNet.WebUtilities": "1.0.0-*",
"Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" },

View File

@ -6,8 +6,8 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder.Internal;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Http.Internal;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.Owin;
namespace Microsoft.AspNet.Builder

View File

@ -14,7 +14,6 @@ using System.Security.Cryptography.X509Certificates;
using System.Security.Principal;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Http.Features.Authentication;
using Microsoft.Framework.Internal;

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNet.FeatureModel.Tests
namespace Microsoft.AspNet.Http.Features
{
public interface IThing
{

View File

@ -4,7 +4,7 @@
using System;
using Xunit;
namespace Microsoft.AspNet.FeatureModel.Tests
namespace Microsoft.AspNet.Http.Features
{
public class InterfaceDictionaryTests
{

View File

@ -8,11 +8,11 @@ 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("Microsoft.AspNet.FeatureModel.Tests")]
[assembly: AssemblyTitle("Microsoft.AspNet.Http.Features.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.AspNet.FeatureModel.Tests")]
[assembly: AssemblyProduct("Microsoft.AspNet.Http.Features.Tests")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNet.FeatureModel.Tests
namespace Microsoft.AspNet.Http.Features
{
public class Thing : IThing
{

View File

@ -1,6 +1,6 @@
{
"dependencies": {
"Microsoft.AspNet.FeatureModel": "1.0.0-*",
"Microsoft.AspNet.Http.Features": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
"commands": {

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Http.Features.Internal;
using Xunit;

View File

@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.FeatureModel;
using Xunit;
namespace Microsoft.AspNet.Http.Features.Internal

View File

@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.FeatureModel;
using Microsoft.AspNet.Http.Features;
using Xunit;
@ -32,7 +31,7 @@ namespace Microsoft.AspNet.Owin
{ "owin.RequestPathBase", "/pathBase" },
{ "owin.RequestQueryString", "name=value" },
};
var features = new FeatureObject(new OwinFeatureCollection(env));
var features = new OwinFeatureCollection(env);
var requestFeature = Get<IHttpRequestFeature>(features);
Assert.Equal(requestFeature.Method, "POST");
@ -51,7 +50,7 @@ namespace Microsoft.AspNet.Owin
{ "owin.RequestPathBase", "/pathBase" },
{ "owin.RequestQueryString", "name=value" },
};
var features = new FeatureObject(new OwinFeatureCollection(env));
var features = new OwinFeatureCollection(env);
var requestFeature = Get<IHttpRequestFeature>(features);
requestFeature.Method = "GET";
@ -72,11 +71,10 @@ namespace Microsoft.AspNet.Owin
{
{"owin.RequestMethod", "POST"}
};
var features = new FeatureObject(new OwinFeatureCollection(env));
var features = new OwinFeatureCollection(env);
var entries = features.ToArray();
var keys = features.Keys.ToArray();
var values = features.Values.ToArray();
Assert.Contains(typeof(IHttpRequestFeature), keys);
Assert.Contains(typeof(IHttpResponseFeature), keys);