zijian666.Core.Abstractions 2.0.2

dotnet add package zijian666.Core.Abstractions --version 2.0.2                
NuGet\Install-Package zijian666.Core.Abstractions -Version 2.0.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="zijian666.Core.Abstractions" Version="2.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add zijian666.Core.Abstractions --version 2.0.2                
#r "nuget: zijian666.Core.Abstractions, 2.0.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.
// Install zijian666.Core.Abstractions as a Cake Addin
#addin nuget:?package=zijian666.Core.Abstractions&version=2.0.2

// Install zijian666.Core.Abstractions as a Cake Tool
#tool nuget:?package=zijian666.Core.Abstractions&version=2.0.2                

zijian666.Core.Abstractions

zijian666 系列组件的基础抽象定义

介绍

组件核心库

更新日志

点击查看

项目示例

点击查看

安装教程

nuget - zijian666.Core.Abstractions

示例项目

点击查看

使用说明

1. FeatureManager (功能组件)

简易版 IoC
主要是用来管理所有 zijian666 相关的功能

定义组件
class Calc : IFeature{
	public int Add(int a,int b) => a + b;
}
使用组件

// 直接获取
var calc = FeatureManager.Get<Calc>();
Console.WriteLine(calc.Add(1, 1));


// 手动注入
class Features : ISlot<Calc>
{
    public Calc Calc;
    public void Set(Calc feature) => Calc = feature;
}

var features = new Features();
FeatureManager.Wired(features);
Console.WriteLine(features.Calc.Add(1, 1));

// 组件注入
class Features : ISlot<Calc>, IFeature
{
    public Calc Calc;
    public void Set(Calc feature) => Calc = feature;
}
var features = FeatureManager.Get<Features>();
Console.WriteLine(features.Calc.Add(1, 1));

// 自动刷新
class Features : IAutoRefreshMultiSlot<IFeature>, IFeature
{
    public List<TestFeature> Items { get; private set; }

    public void MultiSet(IEnumerable<IFeature> features)
    {
        Items = features.ToList();
    }
}
var features = FeatureManager.Get<Features>();
Console.WriteLine(features.Items.Count); // 0

FeatureManager.Register(new MyFeature());
Console.WriteLine(features.Items.Count); // 1
2. ErrorReporter(异常报告)

简易版订阅发布应用
只关注异常的

报告异常
ErrorReporter.OutChannels = OutChannels.Console | OutChannels.Trace;
try
{
    var i = 0;
    Console.WriteLine(i / i);
}
catch (Exception e)
{
    ErrorReporter.Report(e);
}
订阅异常

实现IErrorObserver会自动订阅上报的异常

class ErrorConsole : IErrorObserver
{
    public void OnCompleted()
    {
    }

    public void OnError(Exception error)
    {
        Console.WriteLine("error:" + error);
    }

    public void OnNext(ErrorInfo value)
    {
        Console.WriteLine(value.ToString());
    }
}

struct ErrorInfo
{
    /// <summary>
    /// 异常对象
    /// </summary>
    public readonly Exception Exception;
    /// <summary>
    /// 异常产生类
    /// </summary>
    public readonly Type Owner;
    /// <summary>
    /// 上下文参数
    /// </summary>
    public readonly object Context;
    /// <summary>
    /// 异常类成员
    /// </summary>
    public readonly string MemberName;
    /// <summary>
    /// 异常源码文件名
    /// </summary>
    public readonly string FilePath;
    /// <summary>
    /// 异常类源码文件行号
    /// </summary>
    public readonly int LineNumber;
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on zijian666.Core.Abstractions:

Package Downloads
zijian666.Converts

可以实现任意类型之间的转换

zijian666.DI

Microsoft.Extensions.DependencyInjection的功能拓展

zijian666.DI.NamedService

NamedService命名服务

zijian666.HttpClientExtensions.Convert

为 zijian666.HttpClientExtensions 扩展 json和动态类型支持

zijian666.WebApiExtensions

用于快速创建简单易用的标准化WebApi项目

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.2 7,014 11/12/2022
2.0.0 4,375 11/5/2022
1.2.0 893 11/2/2022
1.1.0 3,805 6/11/2022
1.0.15-beta 940 6/9/2022
1.0.14-beta 197 4/15/2022
1.0.13-beta 445 9/29/2021
1.0.12-beta 727 9/28/2021
1.0.8-beta 226 9/18/2021
1.0.7-beta 268 9/8/2021
1.0.6-beta 266 8/10/2021
1.0.5 2,208 3/19/2021
1.0.4 1,316 9/23/2020
1.0.1 2,438 9/20/2020
1.0.0 1,360 9/7/2020