Fix #210: Move ConfigurationBinder functionality into its own package in the Configuration repo

This commit is contained in:
Kirthi Krishnamraju 2015-05-21 10:33:43 -07:00
Родитель 59e8430ef5
Коммит 71be4574c7
13 изменённых файлов: 335 добавлений и 79 удалений

Просмотреть файл

@ -37,6 +37,10 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.Configu
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.Configuration.EnvironmentVariables.Test", "test\Microsoft.Framework.Configuration.EnvironmentVariables.Test\Microsoft.Framework.Configuration.EnvironmentVariables.Test.xproj", "{7D0F805B-ADFF-4C47-A90C-24DD74416821}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.Configuration.Binder", "src\Microsoft.Framework.Configuration.Binder\Microsoft.Framework.Configuration.Binder.xproj", "{D506FD2F-59A0-4A26-AA6D-E81998B58B34}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.Configuration.Binder.Test", "test\Microsoft.Framework.Configuration.Binder.Test\Microsoft.Framework.Configuration.Binder.Test.xproj", "{AE6FFE9B-6378-4D57-AA24-7D257F18B235}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -213,6 +217,30 @@ Global
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Release|x86.ActiveCfg = Release|Any CPU
{7D0F805B-ADFF-4C47-A90C-24DD74416821}.Release|x86.Build.0 = Release|Any CPU
{D506FD2F-59A0-4A26-AA6D-E81998B58B34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D506FD2F-59A0-4A26-AA6D-E81998B58B34}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D506FD2F-59A0-4A26-AA6D-E81998B58B34}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D506FD2F-59A0-4A26-AA6D-E81998B58B34}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D506FD2F-59A0-4A26-AA6D-E81998B58B34}.Debug|x86.ActiveCfg = Debug|Any CPU
{D506FD2F-59A0-4A26-AA6D-E81998B58B34}.Debug|x86.Build.0 = Debug|Any CPU
{D506FD2F-59A0-4A26-AA6D-E81998B58B34}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D506FD2F-59A0-4A26-AA6D-E81998B58B34}.Release|Any CPU.Build.0 = Release|Any CPU
{D506FD2F-59A0-4A26-AA6D-E81998B58B34}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D506FD2F-59A0-4A26-AA6D-E81998B58B34}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D506FD2F-59A0-4A26-AA6D-E81998B58B34}.Release|x86.ActiveCfg = Release|Any CPU
{D506FD2F-59A0-4A26-AA6D-E81998B58B34}.Release|x86.Build.0 = Release|Any CPU
{AE6FFE9B-6378-4D57-AA24-7D257F18B235}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE6FFE9B-6378-4D57-AA24-7D257F18B235}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE6FFE9B-6378-4D57-AA24-7D257F18B235}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{AE6FFE9B-6378-4D57-AA24-7D257F18B235}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{AE6FFE9B-6378-4D57-AA24-7D257F18B235}.Debug|x86.ActiveCfg = Debug|Any CPU
{AE6FFE9B-6378-4D57-AA24-7D257F18B235}.Debug|x86.Build.0 = Debug|Any CPU
{AE6FFE9B-6378-4D57-AA24-7D257F18B235}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE6FFE9B-6378-4D57-AA24-7D257F18B235}.Release|Any CPU.Build.0 = Release|Any CPU
{AE6FFE9B-6378-4D57-AA24-7D257F18B235}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{AE6FFE9B-6378-4D57-AA24-7D257F18B235}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{AE6FFE9B-6378-4D57-AA24-7D257F18B235}.Release|x86.ActiveCfg = Release|Any CPU
{AE6FFE9B-6378-4D57-AA24-7D257F18B235}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -233,5 +261,7 @@ Global
{CE9C8903-AA8A-40E6-B03D-32A08A4A39AF} = {B54371FF-B920-46C8-8D55-6B19DBB43EBF}
{80A8F10C-E9A6-4677-919D-FE5DB320FEDF} = {B54371FF-B920-46C8-8D55-6B19DBB43EBF}
{7D0F805B-ADFF-4C47-A90C-24DD74416821} = {B54371FF-B920-46C8-8D55-6B19DBB43EBF}
{D506FD2F-59A0-4A26-AA6D-E81998B58B34} = {F141E2D0-F9B8-4ADB-A19A-7B6FF4CA19A1}
{AE6FFE9B-6378-4D57-AA24-7D257F18B235} = {B54371FF-B920-46C8-8D55-6B19DBB43EBF}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.Framework.Internal;
using Microsoft.Framework.Configuration.Binder;
namespace Microsoft.Framework.Configuration
{

Просмотреть файл

@ -0,0 +1,20 @@
<?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>d506fd2f-59a0-4a26-aa6d-e81998b58b34</ProjectGuid>
<RootNamespace>Microsoft.Framework.Configuration.ConfigurationBinder</RootNamespace>
<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>

Просмотреть файл

@ -0,0 +1,8 @@
// 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;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.Framework.Configuration.Binder.Test")]
[assembly: AssemblyMetadata("Serviceable", "True")]

Просмотреть файл

@ -0,0 +1,94 @@
// <auto-generated />
namespace Microsoft.Framework.Configuration.Binder
{
using System.Globalization;
using System.Reflection;
using System.Resources;
internal static class Resources
{
private static readonly ResourceManager _resourceManager
= new ResourceManager("Microsoft.Framework.Configuration.Binder.Resources", typeof(Resources).GetTypeInfo().Assembly);
/// <summary>
/// Cannot create instance of type '{0}' because it is either abstract or an interface.
/// </summary>
internal static string Error_CannotActivateAbstractOrInterface
{
get { return GetString("Error_CannotActivateAbstractOrInterface"); }
}
/// <summary>
/// Cannot create instance of type '{0}' because it is either abstract or an interface.
/// </summary>
internal static string FormatError_CannotActivateAbstractOrInterface(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_CannotActivateAbstractOrInterface"), p0);
}
/// <summary>
/// Failed to convert '{0}' to type '{1}'.
/// </summary>
internal static string Error_FailedBinding
{
get { return GetString("Error_FailedBinding"); }
}
/// <summary>
/// Failed to convert '{0}' to type '{1}'.
/// </summary>
internal static string FormatError_FailedBinding(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_FailedBinding"), p0, p1);
}
/// <summary>
/// Failed to create instance of type '{0}'.
/// </summary>
internal static string Error_FailedToActivate
{
get { return GetString("Error_FailedToActivate"); }
}
/// <summary>
/// Failed to create instance of type '{0}'.
/// </summary>
internal static string FormatError_FailedToActivate(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_FailedToActivate"), p0);
}
/// <summary>
/// Cannot create instance of type '{0}' because it is missing a public parameterless constructor.
/// </summary>
internal static string Error_MissingParameterlessConstructor
{
get { return GetString("Error_MissingParameterlessConstructor"); }
}
/// <summary>
/// Cannot create instance of type '{0}' because it is missing a public parameterless constructor.
/// </summary>
internal static string FormatError_MissingParameterlessConstructor(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_MissingParameterlessConstructor"), p0);
}
private static string GetString(string name, params string[] formatterNames)
{
var value = _resourceManager.GetString(name);
System.Diagnostics.Debug.Assert(value != null);
if (formatterNames != null)
{
for (var i = 0; i < formatterNames.Length; i++)
{
value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}");
}
}
return value;
}
}
}

Просмотреть файл

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Error_CannotActivateAbstractOrInterface" xml:space="preserve">
<value>Cannot create instance of type '{0}' because it is either abstract or an interface.</value>
</data>
<data name="Error_FailedBinding" xml:space="preserve">
<value>Failed to convert '{0}' to type '{1}'.</value>
</data>
<data name="Error_FailedToActivate" xml:space="preserve">
<value>Failed to create instance of type '{0}'.</value>
</data>
<data name="Error_MissingParameterlessConstructor" xml:space="preserve">
<value>Cannot create instance of type '{0}' because it is missing a public parameterless constructor.</value>
</data>
</root>

Просмотреть файл

@ -0,0 +1,13 @@
{
"version": "1.0.0-*",
"description": "Binder configuration source for the Configuration package.",
"dependencies": {
"Microsoft.Framework.Configuration": "1.0.0-*",
"Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" }
},
"frameworks": {
"net45": { },
"dnx451": { },
"dnxcore50": { }
}
}

Просмотреть файл

@ -10,54 +10,6 @@ namespace Microsoft.Framework.Configuration
private static readonly ResourceManager _resourceManager
= new ResourceManager("Microsoft.Framework.Configuration.Resources", typeof(Resources).GetTypeInfo().Assembly);
/// <summary>
/// Cannot create instance of type '{0}' because it is either abstract or an interface.
/// </summary>
internal static string Error_CannotActivateAbstractOrInterface
{
get { return GetString("Error_CannotActivateAbstractOrInterface"); }
}
/// <summary>
/// Cannot create instance of type '{0}' because it is either abstract or an interface.
/// </summary>
internal static string FormatError_CannotActivateAbstractOrInterface(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_CannotActivateAbstractOrInterface"), p0);
}
/// <summary>
/// Failed to convert '{0}' to type '{1}'.
/// </summary>
internal static string Error_FailedBinding
{
get { return GetString("Error_FailedBinding"); }
}
/// <summary>
/// Failed to convert '{0}' to type '{1}'.
/// </summary>
internal static string FormatError_FailedBinding(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_FailedBinding"), p0, p1);
}
/// <summary>
/// Failed to create instance of type '{0}'.
/// </summary>
internal static string Error_FailedToActivate
{
get { return GetString("Error_FailedToActivate"); }
}
/// <summary>
/// Failed to create instance of type '{0}'.
/// </summary>
internal static string FormatError_FailedToActivate(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_FailedToActivate"), p0);
}
/// <summary>
/// Unable to resolve path '{0}'; construct this {1} with a non-null {2}.
/// </summary>
@ -74,22 +26,6 @@ namespace Microsoft.Framework.Configuration
return string.Format(CultureInfo.CurrentCulture, GetString("Error_MissingBasePath"), p0, p1, p2);
}
/// <summary>
/// Cannot create instance of type '{0}' because it is missing a public parameterless constructor.
/// </summary>
internal static string Error_MissingParameterlessConstructor
{
get { return GetString("Error_MissingParameterlessConstructor"); }
}
/// <summary>
/// Cannot create instance of type '{0}' because it is missing a public parameterless constructor.
/// </summary>
internal static string FormatError_MissingParameterlessConstructor(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Error_MissingParameterlessConstructor"), p0);
}
/// <summary>
/// A configuration source is not registered. Please register one before setting a value.
/// </summary>

Просмотреть файл

@ -117,21 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Error_CannotActivateAbstractOrInterface" xml:space="preserve">
<value>Cannot create instance of type '{0}' because it is either abstract or an interface.</value>
</data>
<data name="Error_FailedBinding" xml:space="preserve">
<value>Failed to convert '{0}' to type '{1}'.</value>
</data>
<data name="Error_FailedToActivate" xml:space="preserve">
<value>Failed to create instance of type '{0}'.</value>
</data>
<data name="Error_MissingBasePath" xml:space="preserve">
<value>Unable to resolve path '{0}'; construct this {1} with a non-null {2}.</value>
</data>
<data name="Error_MissingParameterlessConstructor" xml:space="preserve">
<value>Cannot create instance of type '{0}' because it is missing a public parameterless constructor.</value>
</data>
<data name="Error_NoSources" xml:space="preserve">
<value>A configuration source is not registered. Please register one before setting a value.</value>
</data>

Просмотреть файл

@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Reflection;
using Xunit;
namespace Microsoft.Framework.Configuration.Test
namespace Microsoft.Framework.Configuration.Binder.Test
{
public class ConfigurationBinderTests
{

Просмотреть файл

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using Xunit;
namespace Microsoft.Framework.Configuration.Test
namespace Microsoft.Framework.Configuration.Binder.Test
{
public class ConfigurationCollectionBinding
{

Просмотреть файл

@ -0,0 +1,21 @@
<?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>ae6ffe9b-6378-4d57-aa24-7d257f18b235</ProjectGuid>
<RootNamespace>Microsoft.Framework.Configuration.ConfigurationBinder.Test</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

Просмотреть файл

@ -0,0 +1,14 @@
{
"dependencies": {
"Microsoft.Framework.Configuration.Binder": "1.0.0-*",
"Microsoft.Framework.Configuration.Test.Common": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"commands": {
"test": "xunit.runner.aspnet"
}
}