百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
G

Grace

> 编程语言
开源

Grace 是一款功能丰富的依赖注入容器库

338 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

Grace 是一款功能丰富的依赖注入容器库

Notice:

After many years of development I am making the decision to sunset Grace. While it's still possible to use Grace, the evolution of the built in dependency injection container has made Grace less relavent. I say thank you to the people that have supported the project over the past decade and look forward to the future of C# and specifically source code generators. You can check out my next project that builds on top of the existing microsoft DI container https://github.com/ipjohnson/DependencyModules.

Grace

Grace is a feature-rich dependency injection container designed with ease of use and performance in mind.

csharp
using Grace.DependencyInjection;

var container = new DependencyInjectionContainer();

container.Configure(c => c.Export().As());

var basicService = container.Locate();

It's as easy as create, configure, and locate.

Getting Grace

NuGet package supports .Net 4.5 and .Net Standard 1.0.

Getting Started - A getting started guide for Grace as well as documentation for more complex topics

Features in Grace

  • Fluent interface or Attributes for configuration allowing for maximum flexibility
  • Supports child containers and light weight lifetime scopes
  • Contextual binding support (similar to NInject)
  • IDisposable objects created by the container will be tracked and disposed by the container unless configured otherwise.
  • Performance characteristics that make it one of the fastest containers available. (Benchmarks)
  • Supports special types
    • IEnumerable<T> - supports resolving collections as IEnumerable<T> as well as most other types of collections List<T>, ReadOnlyCollection<T>, T[] and any collection that implements ICollection<T>
    • Func<T> - supports resolving Func<T> automatically
    • Lazy<T> - when resolved a Lazy<T> will be created that resolves T from the scope it was created in
    • Owned<T> - object resolved within a Owned<T> will have their disposal lifecycle tied to the Owned<T> (similar to Autofac)
    • Meta<T> - objects resolved within a Meta<T> are resolved along with their metadata
    • Custom Delegates - any delegate that returns a type can be automatically resolved.
    • Custom interface factories with Grace.Factory
  • Many LifeStyles supported including Singleton, SingletonPerScope, SingletonPerRequest (MVC4, MVC5 & WCF packages), SingletonPerObjectGraph, SingletonPerAncestor<T>, and WeakSingleton. If none of the provided life styles meet your need you can always implement your own ICompiledLifeStyle class.
  • Built in support for the decorator pattern
  • Support for custom wrappers (Func<T> and Meta<T> are examples of built-in wrappers)
  • ASP.Net Core supports
  • Source Link support enabled
  • Release Notes

Grace is a supported Microsoft DI container, View Grace in .NET Matrix.

Special thanks to @silkfire for the logo

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#c-sharpdependency-injectionioc-container

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言