LinFx

一个基于 .NET Core 2.0 开发的简单易用的快速开发框架,遵循领域驱动设计(DDD)规范约束,提供实现事件驱动、事件回溯、响应式等特性的基础设施。让开发者享受到正真意义的面向对象设计模式来带的美感。

LinFx.Extensions

Caching、DapperExtensions、Elasticsearch、EventBus、Metrics、Mongo、RabbitMQ

特性

  1. 领域驱动设计(DDD)
  2. 事件驱动架构 (EDA)
  3. 事件回溯 (ES)
  4. 最终一致性 (Eventually Consistent)
  5. 框架中每个组件都有基础实现,最简单时只需一个核心类库就能跑起来
  6. 遵循端口与适配器模式,框架组件适配多种第三方组件实现,可从单体架构到面向服务架构按需扩展

设计规范

  1. 尽量使用.NET Standard和官方提供的类库,第三方类库设计成组件利用DI来按需组合。

安装Nuget包

PM> Install-Package LinFx

开发环境

  1. Visual Studio 15.3+
  2. .NET Core SDK 2.2+

Samples

public void ConfigureServices(IServiceCollection services)
{
services.AddLinFx()
.AddDistributedRedisCache(options =>
{
options.Configuration = configuration.GetConnectionString("ReidsConnection");
})
.AddMongoDBContext(options =>
{
options.Name = "default";
options.Configuration = configuration.GetConnectionString("MongoConnection");
})
.AddElasticsearch(options =>
{
options.DefaultIndex = "default";
options.Host = "http://10.0.1.112:9200";
});
}

EventBus

using LinFx.Extensions.EventBus.Abstractions;
using LinFx.Test.Extensions.EventBus.Events;
using LinFx.Utils;
using LinFx.Extensions.EventBus.RabbitMQ;
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;
using Xunit;
using LinFx.Test.Extensions.EventBus.EventHandling;
using System.Collections.Generic;
using System; namespace LinFx.Test.Extensions.EventBus
{
public class EventBusRabbitMQTest
{
private readonly IEventBus _eventBus; public EventBusRabbitMQTest()
{
var services = new ServiceCollection(); services.AddLinFx()
.AddEventBus(options =>
{
options.Durable = true;
options.BrokerName = "tc_cloud_event_bus";
options.QueueName = "tc_cloud_process_queue";
options.ConfigureEventBus = (fx, builder) => builder.UseRabbitMQ(fx, x =>
{
x.Host = "14.21.34.85";
x.UserName = "admin";
x.Password = "admin.123456";
});
}); //services
services.AddTransient<OrderStatusChangedToAwaitingValidationIntegrationEventHandler>();
//services.AddTransient<OrderStatusChangedToPaidIntegrationEventHandler>(); var applicationServices = services.BuildServiceProvider(); //ConfigureEventBus
_eventBus = applicationServices.GetRequiredService<IEventBus>();
_eventBus.Subscribe<OrderStatusChangedToAwaitingValidationIntegrationEvent, OrderStatusChangedToAwaitingValidationIntegrationEventHandler>();
//eventBus.Subscribe<OrderStatusChangedToPaidIntegrationEvent, OrderStatusChangedToPaidIntegrationEventHandler>();
} [Fact]
public async Task Should_Call_Handler_On_Event_With_Correct_SourceAsync()
{
var orderId = Guid.NewGuid().GetHashCode() & ushort.MaxValue;
var evt = new OrderStatusChangedToAwaitingValidationIntegrationEvent(orderId, new List<OrderStockItem>
{
});
await _eventBus.PublishAsync(evt); //for (int i = 0; i < 2; i++)
//{
// await _eventBus.PublishAsync(new ClientCreateIntergrationEvent
// {
// ClientId = IDUtils.CreateNewId().ToString(),
// ClientSecrets = new[] { "191d437f0cc3463b85669f2b570cdc21" },
// AllowedGrantTypes = new[] { "client_credentials" },
// AllowedScopes = new[] { "api3.device" }
// });
//}
}
}
}

送上 github

https://github.com/linfx/LinFx

一个基于 .NET Core 2.0 开发的简单易用的快速开发框架 - LinFx的更多相关文章

  1. 分享一个基于Net Core 3.1开发的模块化的项目

    先简单介绍下项目(由于重新基于模块化设计了整个项目,所以目前整个项目功能不多) 1.Asp.Net Core 3.1.2+MSSQL2019(LINUX版) 2.中间件涉及Redis.RabbitMQ ...

  2. 如何创建一个基于 .NET Core 3 的 WPF 项目

    在 Connect(); 2018 大会上,微软发布了 .NET Core 3 Preview,以及基于 .NET Core 3 的 WPF:同时还发布了 Visual Studio 2019 预览版 ...

  3. Swift:一个基于.NET Core的分布式批处理框架

    Swift是什么 从文章的标题可知:此Swift非Apple那个Swift,只是考虑这个词的含义比较适合. Swift是一个基于.NET Core的分布式批处理框架,支持将作业分割后分发到多台服务器并 ...

  4. ASP.NET Core 1.0 开发记录

    官方资料: https://github.com/dotnet/core https://docs.microsoft.com/en-us/aspnet/core https://docs.micro ...

  5. 基于.net core 2.0+mysql+AceAdmin搭建一套快速开发框架

    前言 .net core已经出来一段时间了,相信大家对.net core的概念已经很清楚了,这里就不再赘述.笔者目前也用.net core做过一些项目,并且将以前framework下的一些经验移植到了 ...

  6. 基于ASP.NET 4.0开发的微商城系统OdnShop,开源发布

    基于ASP.NET 4.0开发的开源微商城系统,我们的目标是构建一个核心完善而又轻量级的微商城平台,目前基本的核心功能,包括微信登陆/支付,产品管理,购物车与订单管理等,轻量级是为了更加便于理解源码和 ...

  7. 转: Orz是一个基于Ogre思想的游戏开发架构

    Orz是一个基于Ogre思想的游戏开发架构,好的结构可以带来更多的功能.Orz和其他的商业以及非商业游戏开发架构不同.Orz更专著于开发者的感受,简化开发者工作.Orz可以用于集成其他Ogre3D之外 ...

  8. 分享一个基于 ABP(.NET 5.0) + vue-element-admin 管理后台

    1.前言 分享一个基于ABP(.NET 5.0) + vue-element-admin项目.希望可以降低新手对于ABP框架的学习成本,感兴趣的同学可以下载项目启动运行一下.对于想选型采用ABP框架的 ...

  9. SaltStack介绍——SaltStack是一种新的基础设施管理方法开发软件,简单易部署,可伸缩的足以管理成千上万的服务器,和足够快的速度控制,与他们交流

    SaltStack介绍和架构解析 简介 SaltStack是一种新的基础设施管理方法开发软件,简单易部署,可伸缩的足以管理成千上万的服务器,和足够快的速度控制,与他们交流,以毫秒为单位.SaltSta ...

随机推荐

  1. sql注入笔记

    来源:https://blog.csdn.net/u011781521/article/details/57083482 这个工作上遇到了个实例: 在input框里 输入 kear'  页面 报错,出 ...

  2. HTML简历

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. Spring MVC启动时初始化的几个常用方法

    Spring-MVC的应用中,要实现类似的功能,主要是通过实现下面这些接口(任选一,至少一个即可) 一.ApplicationContextAware接口 +? 1 2 3 4 5 6 7 8 9 p ...

  4. platform驱动之probe函数

    驱动注册的probe函数 probe函数在设备驱动注册最后收尾工作,当设备的device 和其对应的driver 在总线上完成配对之后,系统就调用platform设备的probe函数完成驱动注册最后工 ...

  5. 使用springboot写一个简单的测试用例

    使用springboot写一个简单的测试用例 目录结构 pom <?xml version="1.0" encoding="UTF-8"?> < ...

  6. 转摘:ashx+jquery-autocomplete文本框输入提示功能Asp.net

    引入所需文件 <script type="text/javascript" src="JS/jquery-1.8.2.min.js"></sc ...

  7. 【基础巩固】文件流读写、大文件移动 FileStream StreamWriter File Path Directory/ ,m资料管理器(递归)

    C#获取文件名 扩展名 string fullPath = @"d:\test\default.avi"; string filename = Path.GetFileName(f ...

  8. 通过模板判断Value是否为指针

    有个参数,需要判断其Value是否为指针,如果是做相应的处理. 代码示例如下,后来发现is_pointer在std空间中. #include <stdio.h> #include<i ...

  9. 嵌入式&nbsp;Linux&nbsp;与linux启…

    一.在ARM linux 下,一般而言,产品在启动的过程中应该加载模块,最简单的方法是修改启动过程的rc脚本(/etc/init.d/rcS),增加ismod /../xxx.ko这个命令.例如:加载 ...

  10. zookeeper java api(使用java代码操作zookeeper)

    1 导入相关的pom依赖 <dependency> <groupId>org.apache.zookeeper</groupId> <artifactId&g ...