NewLife.Core: .NET Components and First Use
Core basic components: log (file / network), configuration (XML / JSON / HTTP), cache (memory / redis), network (TCP / UDP / HTTP), RPC framework, serialization (binary / XML / JSON), APM performance tracking. 核心基础组件,日志(文件/网络)、配置(XML/Json/Http)、缓存(内存/Redis)、网络(Tcp/Udp/Http)、RPC框架、序列化(Binary/XML/Json)、APM性能追踪。
At a glance
- What is it?
- NewLife.Core is a broad C# utility library for logging, configuration, caching, networking, serialization, RPC, tracing, and application services. It suits .NET developers who prefer a bundled component ecosystem, but its scope and framework abstractions require scrutiny before adoption.
- Who is it for?
- NewLife.Core is a reasonable fit for a new C# service that needs several infrastructure components under one MIT-licensed package, especially when its NuGet template is acceptable as the starting point. It is less suitable for a small application that needs only one utility or for teams that cannot absorb a framework-sized dependency.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 1 day ago.
- What is it written in?
- Mainly C#, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 22, 2026, and from our analysis. They are not legal advice.
Editorial analysis
NewLife.Core's C# Infrastructure Scope
NewLife.Core addresses repeated infrastructure work in long-running C# applications: writing logs, loading settings, storing temporary or distributed data, exchanging serialized objects, hosting services, tracing operations, and coordinating concurrent work. The README places these capabilities in a broader NewLife ecosystem used as a foundation for web services, desktop software, and IoT applications. It is intended for developers who would otherwise assemble several separate libraries and write adapters between logging, configuration, cache, networking, and host abstractions.
The package is broad by design. Its documented modules include `ILog`, `ITracer`, `Config`, `ICache`, `ICacheProvider`, `MemoryCache`, `NewLife.Redis`, `ObjectPool`, packet and buffer types, `ObjectContainer`, `Host`, `IPlugin`, `Actor`, `Pipeline`, and `DeferredQueue`. There are also focused helpers for type conversion, strings, paths, I/O, processes, reflection, security, timers, CSV, Excel reading, and JSON, XML, or binary serialization. The repository layout includes dedicated projects such as `NewLife.Core`, `NewLife.Security`, `NewLife.Android`, plus samples, benchmarks, and tests.
This breadth is both the main reason to consider NewLife.Core and the main adoption cost. A service that needs logging plus configuration can use only those abstractions, but the package still presents the public surface of a framework rather than a narrowly focused utility. Engineers should identify the modules they will actually use before deciding whether separate, smaller dependencies would be easier to govern.
Configuration, Cache, and Logging Data Flow
The component model separates infrastructure facilities from their implementations. Configuration is represented through `Config` and provider interfaces such as `IConfigProvider`. The README states that configuration can come from XML, JSON, or HTTP sources, with callback support, a configuration node model, and hot loading. `Setting` controls core component behavior, while `SysConfig` covers application configuration and supports local, distributed, and encrypted forms. An engineer inspecting a specific deployment should consult `Directory.Build.props`, `Doc`, and the configuration implementation rather than infer source precedence from the module names.
Caching follows a provider model. `ICache` defines standard cache operations, while `ICacheProvider` supplies and manages `ICache` instances. The README lists `MemoryCache` for single-process caching, with expiration and capacity policies, and points to `NewLife.Redis` for distributed caching and multiple Redis data structures. `ObjectPool` and the CAS-based `Pool` serve a different purpose. They reuse objects to reduce garbage collection pressure rather than acting as general key-value caches. Their ownership, reset, and concurrency contracts should not be treated as interchangeable with eviction rules in `MemoryCache`.
Logging uses `ILog`, with documented support for multiple output methods and asynchronous writing. This interface allows application code to depend on a logging abstraction rather than bind every call site directly to one sink. However, the README does not enumerate sink configuration keys, buffering defaults, file rotation settings, or behavior after an output failure. Those details require inspection of the logging documentation and source before production configuration is selected.
Serialization, Packets, RPC, and Tracing Boundaries
For data exchange, NewLife.Core separates object-oriented serialization from binary message handling. The README lists JSON, XML, and binary serializers. It also documents `CsvFile`, `CsvDb`, and `ExcelReader` for tabular formats, with `ExcelReader` described as a lightweight reader that does not require Office dependencies. For protocol work, `IPacket` represents sliced or chained packets, while `PooledByteBufferWriter`, `SpanReader`, and `SpanWriter` handle buffer writing, binary parsing, and binary output. The linked advanced binary guide is specifically associated with zero-allocation encoding and decoding, but the README does not include API examples or compatibility rules for that feature.
The network side covers TCP, UDP, and HTTP, and the framework overview includes an RPC framework. Together, these pieces can support service communication, but the README does not show an RPC contract, transport selection policy, retry rule, timeout setting, or protocol version negotiation. It is therefore not enough evidence for a production RPC architecture. Engineers need to identify the exact RPC implementation and verify its wire format, error propagation, cancellation behavior, and cross-version compatibility before exposing it across service boundaries.
`ITracer` is presented as an APM tracing facility with integration involving the Stardust platform. That integration may be relevant to teams already connected to that platform, while teams without it need to determine what part of `ITracer` remains usable independently. The README does not describe trace export, sampling, retention, or required platform services, so these are explicit documentation gaps rather than confirmed capabilities.
Installing NewLife.Core and Running the Console Template
The README gives two adoption paths. The smallest path is to search for `NewLife.Core` in the project's NuGet manager and add the package. For a first executable example, it supplies a NewLife template workflow. The following commands install the template package, create a project named `test`, enter its directory, and run it with the .NET CLI:
dotnet new install NewLife.Templates
dotnet new nconsole --name test
cd test
dotnet runA successful first run depends on the selected SDK resolving the template and the generated project restoring successfully. The README says the framework supports .NET versions from .NET 2.0 through .NET 10.0, but it does not publish a package-by-package compatibility table. The repository's `global.json` is the first place to inspect for source-build SDK requirements, and the generated test project shows the target framework selected by the template.
For an existing solution, adding the NuGet package directly is more predictable than generating a new application because it does not introduce an unrelated sample structure. The README also states that the repository can be built with Visual Studio or through `dotnet build`, but it does not provide a complete command-line build recipe with an explicit restore step. Teams should not add undocumented flags or package versions to compensate for that omission.
NewLife.Core Hosting, Plugins, and Actor Execution
NewLife.Core includes application infrastructure beyond reusable helpers. `Host` is documented as a lightweight application host for long-running background services. `ObjectContainer` provides dependency injection with multiple lifetimes and injection modes, while `IPlugin` supplies a standard plugin contract for modular applications. These components show that the library is intended to shape application structure, not merely provide static functions.
The concurrency model includes `Actor`, described as processing work through message queues. This can make ownership and asynchronous communication explicit, but it introduces different programming rules from direct method calls. The repository's topics include threads, reflection, services, and servers, and the presence of `Test`, `Test2`, and `XUnitTest.Core` indicates dedicated test areas. The README does not explain actor supervision, restart behavior, message persistence, backpressure, or ordering guarantees. Those semantics should drive the adoption decision for any actor-based design.
`Pipeline` offers a bidirectional processing chain with `Read`, `Write`, `Open`, and `Close` stages. This is more specialized than a general logging pipeline because it appears intended to standardize component lifecycle and data handling. The tradeoff is tighter coupling to the framework's processing model. An application whose transport already owns equivalent pipeline abstractions should compare lifecycle ownership before adding a second abstraction.
Maintenance, Versioning, Licensing, and Smaller Alternatives
The repository is not archived, and its last push was on 2026-10-16. That is recent activity, although recent commits alone do not establish the maintenance status of every component. The listed releases are `Bench2024_MemoryCache` on 2024-09-16, `v7.3.2018.1023` on 2018-10-23, and `v9.6.2017.0830` on 2017-08-30. These names do not establish which NuGet version is current or how upgrade compatibility is tested. `ChangeLog.md` is the repository file to consult for release-specific changes.
The MIT license allows modification and redistribution without a requirement to declare origin. The README also describes private customization by replacing `NewLife` strings in source. That is a source-level distribution option, but renaming alone does not prove API or wire compatibility. A fork that changes namespaces, public contracts, or serialized formats needs its own compatibility checks. The repository publishes `newlife.snk` for strong-name support when independently compiling replacement assemblies, according to the README.
The main alternative is to build a service from narrower platform types or individual packages, adding only the logging, configuration, cache, and serialization components that the application uses. That approach produces a smaller dependency surface and keeps infrastructure choices separate, but the team must supply compatible interfaces, integration code, and lifecycle behavior. NewLife.Core offers the more consolidated option. The selective approach is easier to justify for a small application with only one or two infrastructure needs.
Editorial conclusion
NewLife.Core is a reasonable fit for a new C# service that needs several infrastructure components under one MIT-licensed package, especially when its NuGet template is acceptable as the starting point. It is less suitable for a small application that needs only one utility or for teams that cannot absorb a framework-sized dependency. Before adoption, verify the current `NewLife.Core` package target, inspect `Directory.Build.props` and `global.json`, and run the documented `dotnet new nconsole` template in a disposable project to confirm that its generated structure fits the application.
Frequently asked questions
How do I install NewLife.Core?
The README says to add the `NewLife.Core` package through the project's NuGet manager. It also documents `NewLife.Templates` and a `dotnet new nconsole` workflow for creating a first console project.
Which cache implementations does NewLife.Core provide?
The documented abstractions are `ICache` and `ICacheProvider`. `MemoryCache` covers single-process caching, while `NewLife.Redis` is identified as the distributed Redis implementation.
Does NewLife.Core support .NET 10?
The README states that the framework supports .NET versions from .NET 2.0 through .NET 10.0. It does not provide a package-by-package compatibility matrix.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/newlifex-x)Was this useful?