diff --git a/README.md b/README.md
index 500eadc..e48b8a0 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@
**使用Nuget安装**
```PM
-Install-Package CatLib.Core -Version 1.2.3
+Install-Package CatLib.Core -Version 1.2.4
```
**直接下载发布版本**
diff --git a/src/CatLib.Core.NetStandard/CatLib.Core.NetStandard.csproj b/src/CatLib.Core.NetStandard/CatLib.Core.NetStandard.csproj
index 31b2042..6c30e6f 100644
--- a/src/CatLib.Core.NetStandard/CatLib.Core.NetStandard.csproj
+++ b/src/CatLib.Core.NetStandard/CatLib.Core.NetStandard.csproj
@@ -77,6 +77,7 @@
+
diff --git a/src/CatLib.Core.Tests/Properties/AssemblyInfo.cs b/src/CatLib.Core.Tests/Properties/AssemblyInfo.cs
index aeabfd3..443a768 100644
--- a/src/CatLib.Core.Tests/Properties/AssemblyInfo.cs
+++ b/src/CatLib.Core.Tests/Properties/AssemblyInfo.cs
@@ -17,7 +17,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CatLib")]
[assembly: AssemblyProduct("CatLib.Core.Tests")]
-[assembly: AssemblyCopyright("Copyright © CatLib 2017")]
+[assembly: AssemblyCopyright("Copyright © CatLib 2017-2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -25,5 +25,5 @@
[assembly: Guid("3c9f4024-910c-4881-a04d-34a6c3a09019")]
-[assembly: AssemblyVersion("1.2.3.0")]
-[assembly: AssemblyFileVersion("1.2.3.0")]
+[assembly: AssemblyVersion("1.2.4.0")]
+[assembly: AssemblyFileVersion("1.2.4.0")]
diff --git a/src/CatLib.Core/CatLib.Core.csproj b/src/CatLib.Core/CatLib.Core.csproj
index 657a067..caf0a95 100644
--- a/src/CatLib.Core/CatLib.Core.csproj
+++ b/src/CatLib.Core/CatLib.Core.csproj
@@ -49,6 +49,7 @@
+
diff --git a/src/CatLib.Core/CatLib/App.cs b/src/CatLib.Core/CatLib/App.cs
index 45e52a0..41a1e75 100644
--- a/src/CatLib.Core/CatLib/App.cs
+++ b/src/CatLib.Core/CatLib/App.cs
@@ -666,9 +666,9 @@ public static string Type2Service(Type type)
{
return Handler.Type2Service(type);
}
-#endregion
+ #endregion
-#region Container Extend API
+ #region Container Extend API
///
/// 获取服务的绑定数据,如果绑定不存在则返回null
///
@@ -1269,6 +1269,6 @@ public static string Type2Service()
{
return Handler.Type2Service();
}
-#endregion
+ #endregion
}
}
\ No newline at end of file
diff --git a/src/CatLib.Core/CatLib/Facade.cs b/src/CatLib.Core/CatLib/Facade.cs
index eb486c4..4382351 100644
--- a/src/CatLib.Core/CatLib/Facade.cs
+++ b/src/CatLib.Core/CatLib/Facade.cs
@@ -166,7 +166,7 @@ private static void Rebind(IBindData newBinder)
/// 服务实例
private static TService Build(params object[] userParams)
{
- return (TService) App.Make(service, userParams);
+ return (TService)App.Make(service, userParams);
}
}
}
\ No newline at end of file
diff --git a/src/CatLib.Core/Properties/AssemblyInfo.cs b/src/CatLib.Core/Properties/AssemblyInfo.cs
index b190d33..ee50603 100644
--- a/src/CatLib.Core/Properties/AssemblyInfo.cs
+++ b/src/CatLib.Core/Properties/AssemblyInfo.cs
@@ -18,7 +18,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CatLib")]
[assembly: AssemblyProduct("CatLib.Core")]
-[assembly: AssemblyCopyright("Copyright © CatLib 2017")]
+[assembly: AssemblyCopyright("Copyright © CatLib 2017-2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -26,8 +26,8 @@
[assembly: Guid("4204658e-81fd-4106-a347-890cd369c8a4")]
-[assembly: AssemblyVersion("1.2.3.0")]
-[assembly: AssemblyFileVersion("1.2.3.0")]
+[assembly: AssemblyVersion("1.2.4.0")]
+[assembly: AssemblyFileVersion("1.2.4.0")]
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor"),
InternalsVisibleTo("Assembly-CSharp-Editor-firstpass"),
diff --git a/src/CatLib.Core/Support/Container/Container.cs b/src/CatLib.Core/Support/Container/Container.cs
index b2f82a6..932c4f6 100644
--- a/src/CatLib.Core/Support/Container/Container.cs
+++ b/src/CatLib.Core/Support/Container/Container.cs
@@ -1359,7 +1359,7 @@ protected virtual object GetCompactInjectUserParams(ParameterInfo baseParam, ref
}
///
- /// 获取参数()匹配器
+ /// 获取参数()匹配器
/// 开发者重写后可以实现自己的匹配器
/// 如果调用获取到的匹配器后返回结果为null则表示没有匹配到参数
///
@@ -1733,27 +1733,27 @@ private BindData GetBindFillable(string service)
}
///
- /// 从中获取类型的变量
+ /// 从中获取类型的变量
///
/// 用户传入参数
/// 获取到的参数
- private Params[] GetParamsTypeInUserParams(ref object[] userParams)
+ private IParams[] GetParamsTypeInUserParams(ref object[] userParams)
{
- var elements = Arr.Remove(ref userParams, value => value is Params);
- var results = new Params[elements.Length];
+ var elements = Arr.Remove(ref userParams, value => value is IParams);
+ var results = new IParams[elements.Length];
for (var i = 0; i < elements.Length; i++)
{
- results[i] = (Params)elements[i];
+ results[i] = (IParams)elements[i];
}
return results;
}
///
- /// 生成一个默认的参数匹配器
+ /// 生成一个默认的参数匹配器
///
/// 参数表
/// 匹配器
- private Func MakeParamsMatcher(Params[] tables)
+ private Func MakeParamsMatcher(IParams[] tables)
{
// 默认匹配器策略将会将参数名和参数表的参数名进行匹配
// 最先匹配到的有效参数值将作为返回值返回
diff --git a/src/CatLib.Core/Support/Container/IParams.cs b/src/CatLib.Core/Support/Container/IParams.cs
new file mode 100644
index 0000000..4ebdbe6
--- /dev/null
+++ b/src/CatLib.Core/Support/Container/IParams.cs
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the CatLib package.
+ *
+ * (c) Yu Bin
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * Document: http://catlib.io/
+ */
+
+namespace CatLib
+{
+ ///
+ /// 参数名注入表
+ ///
+ public interface IParams
+ {
+ ///
+ /// 获取一个参数
+ ///
+ /// 参数名
+ /// 参数值
+ /// 是否成功获取
+ bool TryGetValue(string key, out object value);
+ }
+}
diff --git a/src/CatLib.Core/Support/Container/Params.cs b/src/CatLib.Core/Support/Container/Params.cs
index f182d79..28c731f 100644
--- a/src/CatLib.Core/Support/Container/Params.cs
+++ b/src/CatLib.Core/Support/Container/Params.cs
@@ -17,12 +17,12 @@ namespace CatLib
/// 参数名注入表
///
[ExcludeFromCodeCoverage]
- public sealed class Params : IEnumerable>
+ public sealed class Params : IParams, IEnumerable>
{
///
/// 参数表
///
- private readonly Dictionary table = new Dictionary();
+ private readonly IDictionary table;
///
/// 迭代器
@@ -34,14 +34,31 @@ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
}
///
- ///
+ /// 迭代器
///
- ///
+ /// 迭代器
IEnumerator> IEnumerable>.GetEnumerator()
{
return table.GetEnumerator();
}
+ ///
+ /// 参数名注入表
+ ///
+ public Params()
+ {
+ table = new Dictionary();
+ }
+
+ ///
+ /// 参数名注入表
+ ///
+ /// 参数表
+ public Params(IDictionary args)
+ {
+ table = args;
+ }
+
///
/// 获取或者设定一个参数
///