GithubHelp home page GithubHelp logo

catlib / core Goto Github PK

View Code? Open in Web Editor NEW
189.0 14.0 40.0 2.81 MB

CatLib lightweight dependency injection container

Home Page: https://catlib.io

License: MIT License

C# 99.45% PowerShell 0.55%
unity framework unity3d ioc-container injection-container catlib

core's Introduction

Codecov Downloads

About CatLib

CatLib is the lightweight dependency injection container and helper functions library.

Install CatLib Core

Installed with Nuget

$ Install-Package CatLib.Core -Version 2.0.0

Installed with Bucket

$ bucket require catlib/core

Installed with Github Release

Download the latest version

Learning CatLib

CatLib has the most extensive and thorough documentation, making it a breeze to get started with the framework.

需要中文支持? 请访问CatLib中文文档

Contribution

CatLib is still a young framework, and her growth and your contribution are inseparable. If you want to contribute to the project, please refer to: CatLib Contribution Guide Your contribution will be included in the list of contributors,Welcome Pull Request!

License

The open source license used by CatLib is MIT license.

Support

core's People

Contributors

garfieldjiang avatar liiir1985 avatar ymh199478 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

core's Issues

v1.3.0 更新记录

CatLib v1.3.0 alpha 版本更新日志:

框架

  • 升级为 c# 7.0 语法(#64 )
  • 增加LogicException逻辑错误异常(#80 )
  • 增加CodeStandardException代码规范异常(#62 )
  • ServiceProvider.Register不再是abstract
  • 增加了ICoroutineInit 协同初始化接口(默认的迭代器为同步迭代器和Init没有本质区别,在其他环境下可能受到环境影响)
  • ApplicationEvents.OnIniting被标记为已过时,使用:ApplicationEvents.OnProviderInit替换
  • 新增了ApplicationEvents.OnProviderInit 服务提供者初始化之前
  • 新增了ApplicationEvents.OnProviderInited 服务提供者初始化完成
  • Application Version现在是静态化的了(#90 )

代码规范性检查

    • 如果尝试为同一个单例化的实例注册不同的服务名,则会异常发一个异常(#62)
    • 如果尝试在注册流程中Make服务,那么会引发一个异常。 (#59)
    • 通过容器Watch一个对象时,只有当对象时可以被构建时才允许被watch。因为我们认为观察的只能是一个已经被确定的服务,而不是一个未知服务。 (#59)
    • 如果尝试在注册流程中Invoke函数,那么会引发一个异常。(#62)

容器服务

  • 服务容器增加了解决事件和释放事件的条件筛选(#84 )
  • 服务容器增加OnAfterResolving的支持。(#83 )
  • 使用this[] set对象时会进行隐式的对象绑定(bind)(#82 )
  • 增加Extend函数,用于处理服务的覆盖及拓展关系,OnResolving不再允许覆盖对象。(#79)
  • 服务容器Watch接口从容器实现转移至扩展函数(#81)
  • 增加服务特殊字符@,$:识别,如果包含则不允许注册。(#61)
  • 增加变量标签$@一样,具备相同的变量映射作用。(#61)
  • 容器在flush对象时将会按照构建顺序的相反顺序释放服务(之前是需要通过辅助组件来完成)(#55)
  • 服务容器增加App.Alias<TService, TAlias>()的拓展方法支持(#57)

支持库

  • 增加 SegmentStream 分片流(#74)
  • 增加 WrapperStream 包装流(#69)
  • 增加 CombineStream 组合流(#70)
  • Arr.Filter 支持迭代器(#67)
  • Arr.Map 支持迭代器(#66)
  • 增加了SortSet.ReverseIterator(bool forward)指定反转方向的接口(#56)
  • StreamExtension.ToText() 加入对不能读取流的判断(#75)
  • 管理器模版支持OnAfterResolving(#92 )

v1.2.8 Version

  • 新增了 Stream 扩展函数 AppendTo
  • 修复了 SortSet.GetRangeCount 在一定情况下引发异常的bug
  • 增加了内存存储结构 MemoryStorage
  • 增加了存储流 StorageStream
  • 修复了Facade中Instance导致40B的GC Alloc

Given 允许返回一个闭包

上下文关系允许传入一个闭包来解决上下文。

container.Bind<MyClass>().Needs<IInterface>().Given(()=>{
      return new InterfaceClass();
});

这对于一些需要从管理器中获取接口实现的类非常有用。

增加 SegmentStream.cs

分片流可以用于包装指定分片的流。
使指定分片的流访问起来就像传统流那样从开头到结尾。

检查服务名是否包含不允许的字符 & 使用字符串内插处理字符串拼接

  • 增加虚方法 GuardServiceName

    • 对方法Bind生效
    • 对方法Instance生效
  • 增加虚方法 GuardMethodName

    • 对方法BindMethod生效

验证生效后应该使用Alias来代替拥有非法字符的服务名,例如:

container.Instance("@num", 777);

被替换为:

container.Instance("num",777);
container.Alias("@num", "num");

因为一个服务可能对应多个特殊别名,如果以服务名作为别名的简化来写,从语意上来说显得不清晰。

建议考虑添加 Timer Manager Catch异常处理

目前如果不做catch处理,当timer内逻辑发生错误,会一直逐帧报错,导致程序非常卡,无法进行。建议给timer添加一个是否略过异常的标记,可以选择性的抛出异常,防止程序因为大量LOG导致性能下降!

v1.3.0-Alpha.3更新日志

框架相关

  • 修复初始化顺序不正确的异常,不同运行时环境不一致(#102 )
  • copyright 名称变更为 CatLib(#106 )
  • 为Type增加ToService扩展函数(#105 )
  • 注释中的文档地址更新为 https(#108 )
  • DebugLevels允许在Register中被使用(#109
  • 提示内容优化(#117 )
  • App门面增加IsResolved(string service)的支持(#118 )
  • 移除实验的属性App.AutoInstance; 如果全局实例没有被构建则引发一个异常(#129
  • 如果在构建CatLib实例时,允许传入一个bool值决定是否应用到全局(#128

服务容器

  • 将IContainer接口缩减,缩减的接口将会被移动到扩展方法(#111 )
    -- Factory
  • 语意行为变更:Bind和Singleton相关(#112 )
  • IContainer.Release接口参数由string变更为object,允许通过对象实例来进行释放(#115 )
  • 优化UnresolvableException的异常提示消息 (#120
  • 允许在Needs时提供需求的变量名,以支持变量名需求,改善变量名上下文关系的流程 (#122 )
  • 服务容器的构建策略可以通过虚函数覆写(#124
  • 移除了Inject的别名支持 (#126

其他

  • 清理了无用代码(#119 )

v1.2.10 更新记录

  • 增加 Stream.ToText(); 扩展函数
  • Arr.Merge支持对于null元素的合并兼容
  • 增加了PipelineStream 管道流,可以用于安全的线程间通讯

Type2Service 将不允许为虚方法

不再允许Type2Service被覆写,因为会导致一些潜在性问题。

例如:在框架初始化的构造函数中调用Type2Service,会导致子类覆写类没有被实行。

v1.2.12 更新记录

  • 增加模版方法的门面静态类
  • 修复Dict.Modify的bug,这个bug导致不必要的字典实例 #52
  • DebugLevels 枚举命名调整
    -- Prod标记为已过时
    -- Dev标记为已过时
    -- 增加 Production
    -- 增加 Development
  • 尝试重复调用引导(Bootstrap)时会引发一个RuntimeException而不是静默忽略。
  • 尝试重复调用初始化(Init)时会引发一个RuntimeException而不是静默忽略。
  • 增加了ApplicationEvents.OnBootstrap在引导开始之前
  • 增加了ApplicationEvents.Bootstrapping在引导进行中
  • 增加了ApplicationEvents.OnInit在初始化开始之前
  • 增加了ApplicationEvents.OnInited在初始化完成之后
  • 增加了ApplicationEvents.OnRegisterProvider注册服务提供者事件
  • 允许ApplicationEvents.Bootstrapping返回一个不为null的值(一般是false)来终止当前引导激活。
  • 允许ApplicationEvents.OnRegisterProvider返回一个不为null的值(一般是false)来终止服务提供者注册。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.