Skip to content

Commit

Permalink
Merge pull request #61 from CatLib/1.0
Browse files Browse the repository at this point in the history
bug fixed
  • Loading branch information
喵喵大人 authored Sep 12, 2017
2 parents dc5c51f + 0db74d4 commit f3369aa
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 59 deletions.
2 changes: 1 addition & 1 deletion CatLib.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 15
VisualStudioVersion = 15.0.26430.16
VisualStudioVersion = 15.0.26430.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CatLib", "projects\CatLib\CatLib.csproj", "{BBB2DAE2-638B-4419-9591-3CECCA312E4E}"
EndProject
Expand Down
Binary file modified build/CatLib.API.dll
Binary file not shown.
Binary file modified build/CatLib.API.pdb
Binary file not shown.
22 changes: 4 additions & 18 deletions build/CatLib.API.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified build/CatLib.dll
Binary file not shown.
Binary file modified build/CatLib.pdb
Binary file not shown.
56 changes: 30 additions & 26 deletions build/CatLib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7447,6 +7447,31 @@
当注册服务提供者
</summary>
</member>
<member name="T:CatLib.Facade.Compress">
<summary>
压缩器
</summary>
</member>
<member name="T:CatLib.Facade.Converters">
<summary>
转换器
</summary>
</member>
<member name="T:CatLib.Facade.Dispatcher">
<summary>
全局事件调度器
</summary>
</member>
<member name="T:CatLib.Facade.Encrypter">
<summary>
加密器
</summary>
</member>
<member name="T:CatLib.Facade.Hashing">
<summary>
随机数
</summary>
</member>
<member name="T:CatLib.Facade.I18N">
<summary>
国际化I18N
Expand All @@ -7467,6 +7492,11 @@
文件系统管理器
</summary>
</member>
<member name="T:CatLib.Facade.Random">
<summary>
随机数
</summary>
</member>
<member name="T:CatLib.Facade.Router">
<summary>
路由
Expand Down Expand Up @@ -7669,11 +7699,6 @@
通配符事件句柄
</summary>
</member>
<member name="F:CatLib.Events.Dispatcher.actionMapping">
<summary>
Action对应Func映射
</summary>
</member>
<member name="F:CatLib.Events.Dispatcher.syncRoot">
<summary>
同步锁
Expand Down Expand Up @@ -7732,20 +7757,6 @@
<param name="life">在几次后事件会被自动释放</param>
<returns>事件句柄</returns>
</member>
<member name="M:CatLib.Events.Dispatcher.Off(System.String,System.Action{System.Object})">
<summary>
反注册一个事件
</summary>
<param name="eventName">事件名</param>
<param name="handler">事件句柄</param>
</member>
<member name="M:CatLib.Events.Dispatcher.WalkActionMapping(System.Action{System.Object},System.Action{System.Func{System.Object,System.Object}})">
<summary>
遍历行为映射
</summary>
<param name="handler">事件句柄</param>
<param name="callback">回调</param>
</member>
<member name="M:CatLib.Events.Dispatcher.Off(CatLib.Events.EventHandler)">
<summary>
移除一个事件
Expand Down Expand Up @@ -10689,13 +10700,6 @@
<param name="life">在几次后事件会被自动释放</param>
<returns>事件句柄</returns>
</member>
<member name="M:CatLib.Application.Off(System.String,System.Action{System.Object})">
<summary>
反注册一个事件
</summary>
<param name="eventName">事件名</param>
<param name="handler">事件句柄</param>
</member>
<member name="P:CatLib.Application.Version">
<summary>
CatLib版本(遵循semver)
Expand Down
12 changes: 6 additions & 6 deletions projects/CatLib.API/CatLib/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,11 @@ public static IBindData Singleton(string service, Func<IContainer, object[], obj
/// 以单例的形式绑定一个服务
/// </summary>
/// <typeparam name="TService">服务名</typeparam>
/// <typeparam name="TConcrete">服务实现</typeparam>
/// <typeparam name="TAlias">服务别名</typeparam>
/// <returns>服务绑定数据</returns>
public static IBindData Singleton<TService, TConcrete>() where TConcrete : class
public static IBindData Singleton<TService, TAlias>()
{
return Handler.Singleton<TService, TConcrete>();
return Handler.Singleton<TService, TAlias>();
}

/// <summary>
Expand Down Expand Up @@ -450,11 +450,11 @@ public static IBindData Singleton<TService>(Func<IContainer, object[], object> c
/// 常规绑定一个服务
/// </summary>
/// <typeparam name="TService">服务名</typeparam>
/// <typeparam name="TConcrete">服务实现</typeparam>
/// <typeparam name="TAlias">服务别名</typeparam>
/// <returns>服务绑定数据</returns>
public static IBindData Bind<TService, TConcrete>() where TConcrete : class
public static IBindData Bind<TService, TAlias>()
{
return Handler.Bind<TService, TConcrete>();
return Handler.Bind<TService, TAlias>();
}

/// <summary>
Expand Down
14 changes: 8 additions & 6 deletions projects/CatLib.API/Support/Container/ContainerExtend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ public static IBindData Singleton(this IContainer container, string service,
/// 以单例的形式绑定一个服务
/// </summary>
/// <typeparam name="TService">服务名</typeparam>
/// <typeparam name="TConcrete">服务实现</typeparam>
/// <typeparam name="TAlias">服务别名</typeparam>
/// <param name="container">服务容器</param>
/// <returns>服务绑定数据</returns>
public static IBindData Singleton<TService, TConcrete>(this IContainer container) where TConcrete : class
public static IBindData Singleton<TService, TAlias>(this IContainer container)
{
return container.Bind(container.Type2Service(typeof(TService)), typeof(TConcrete), true);
return container.Bind(container.Type2Service(typeof(TService)), typeof(TService), true)
.Alias(container.Type2Service(typeof(TAlias)));
}

/// <summary>
Expand Down Expand Up @@ -71,12 +72,13 @@ public static IBindData Singleton<TService>(this IContainer container,
/// 常规绑定一个服务
/// </summary>
/// <typeparam name="TService">服务名</typeparam>
/// <typeparam name="TConcrete">服务实现</typeparam>
/// <typeparam name="TAlias">服务别名</typeparam>
/// <param name="container">服务容器</param>
/// <returns>服务绑定数据</returns>
public static IBindData Bind<TService, TConcrete>(this IContainer container) where TConcrete : class
public static IBindData Bind<TService, TAlias>(this IContainer container)
{
return container.Bind(container.Type2Service(typeof(TService)), typeof(TConcrete), false);
return container.Bind(container.Type2Service(typeof(TService)), typeof(TService), false)
.Alias(container.Type2Service(typeof(TAlias)));
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void BindSingletonTServiceTConcrete()
{
var container = MakeContainer();
container.Singleton<TestClassService, ContainerHelperTestClass>();
var obj = container.Make(container.Type2Service(typeof(TestClassService)));
var obj = container.Make(container.Type2Service(typeof(ContainerHelperTestClass)));
var obj2 = container.Make(container.Type2Service(typeof(TestClassService)));

Assert.AreSame(obj, obj2);
Expand Down
2 changes: 1 addition & 1 deletion projects/CatLib.Tests/Support/Container/ContainerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ public void CanParamUseInjectAttrRequired()
container.Make<TestMakeParamInjectAttrRequiredClass>();
});

container.Bind<IMsg, MakeTestClassDependency>();
container.Bind<MakeTestClassDependency, IMsg>();
var result = container.Make<TestMakeParamInjectAttrRequiredClass>();
Assert.AreEqual("hello", result.GetMsg());
}
Expand Down
1 change: 1 addition & 0 deletions projects/CatLib/Encryption/Encrypter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public sealed class Encrypter : IEncrypter
/// <param name="cipher">加密类型</param>
public Encrypter(byte[] key, string cipher)
{
Guard.Requires<ArgumentNullException>(key != null);
this.key = key;
if (!Supported(key, cipher))
{
Expand Down

0 comments on commit f3369aa

Please sign in to comment.