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. 怎样使用charles抓包

    本人因为是做前端的工作,需要后台写的一些数据,所以我需要一个神器能够抓到pc端或是移动端的后台数据,近期我发现一个神器“Charles”抓包神器. 需要操作的步骤如下: 1.先在网上下载Charles ...

  2. Bash读取/etc/passwd的特殊技巧

    在twitter上看到的,记录一下: 可以bypass基于正则的规则,这里还可以引申出其他的bypass方法,

  3. openstack 租户ip 手动配置 openstack静态租户ip

    作者:[吴业亮]云计算开发工程师 博客:http://blog.csdn.net/wylfengyujiancheng 1.综述: 在日常开发和生产环境中经常需要将OpenStack虚拟机配置一个静态 ...

  4. javascript中的垃圾回收

    1引用计数垃圾回收 核心:跟踪记录对象被引用的次数.思路是如果一个对象A被赋值给了一个变量v,则该对象A的引用计数值加1,如果变量v又被赋予其他值了,比如a="str",则该对象A ...

  5. leetcode888

    class Solution { public: int Binary_Search(vector<int> x, int N, int keyword) { , high = N - , ...

  6. 「小程序JAVA实战」 小程序默认加载的页面和生命周期(八)

    转自:https://idig8.com/2018/08/09/xiaochengxu-chuji-08/ 小程序如何加载的呢?生命周期!源码:https://github.com/limingios ...

  7. Ant之build.xml详解---可用

    Ant的概念 :在Eclipse中使用Ant Ant是Java平台下非常棒的批处理命令执行程序,能非常方便地自动完成编译,测试,打包,部署等等一系列任务,大大提高开发效率. Ant和make命令很像. ...

  8. 在页面完成读取EXCEL

    protected void btnUpload_Click(object sender, EventArgs e) { if (Page.IsValid) { string sFILENAME = ...

  9. 项目代码:js

    1 //获取发文时间 function selectWriteTime(){ $("#writing_time_index").on("click"," ...

  10. 665. Non-decreasing Array只允许修改一位数的非递减数组

    [抄题]: Given an array with n integers, your task is to check if it could become non-decreasing by mod ...