ZAnalyzers.Core 0.1.2

dotnet add package ZAnalyzers.Core --version 0.1.2
                    
NuGet\Install-Package ZAnalyzers.Core -Version 0.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZAnalyzers.Core" Version="0.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZAnalyzers.Core" Version="0.1.2" />
                    
Directory.Packages.props
<PackageReference Include="ZAnalyzers.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZAnalyzers.Core --version 0.1.2
                    
#r "nuget: ZAnalyzers.Core, 0.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ZAnalyzers.Core@0.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZAnalyzers.Core&version=0.1.2
                    
Install as a Cake Addin
#tool nuget:?package=ZAnalyzers.Core&version=0.1.2
                    
Install as a Cake Tool

ZAnalyzers.Core

项目概述

ZAnalyzers.Core是ZAnalyzers系列的核心基础库,提供了基础类型和接口定义,用于支持其他ZAnalyzers组件(如ZAnalyzers.MinimalApiSG)的功能实现。

核心组件

FantasyApi

FantasyApi是一个抽象基类,作为ZAnalyzers.MinimalApiSG代码生成器的基础标记类型。通过继承此类,您的服务类会被自动识别并处理为Minimal API端点。

namespace ZAnalyzers.Core
{
    public abstract class FantasyApi
    {
    }
}

使用方法

ZAnalyzers.Core通常不需要单独使用,它主要作为ZAnalyzers其他组件的依赖项存在。在使用ZAnalyzers.MinimalApiSG或其他ZAnalyzers组件时,您需要同时引用ZAnalyzers.Core包。

安装

<PackageReference Include="ZAnalyzers.Core" Version="x.x.x" />

示例用法

创建继承自FantasyApi的服务类:

using ZAnalyzers.Core;

namespace YourNamespace
{
    public class UserService : FantasyApi
    {
        public async Task<User> GetUser(int id)
        {
            // 实现逻辑
            return await Task.FromResult(new User { Id = id, Name = "Test User" });
        }
    }
}

与ZAnalyzers.MinimalApiSG的关系

  • ZAnalyzers.Core提供基础类型定义
  • ZAnalyzers.MinimalApiSG依赖ZAnalyzers.Core,并使用其中的类型进行代码生成
  • 使用ZAnalyzers.MinimalApiSG时,必须同时引用ZAnalyzers.Core

详细的API使用说明,请参考ZAnalyzers.MinimalApiSG文档

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.2 159 5/8/2025
0.1.1 162 4/28/2025
0.1.0 153 4/28/2025