All Projects → ChengLab → Aaframework

ChengLab / Aaframework

AA.Framework is built on the popular open source class library of NET Core

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Aaframework

Stove
Domain Driven Design oriented application framework, meets CRUD needs
Stars: ✭ 160 (+25%)
Mutual labels:  redis, rabbitmq, dapper, nlog
Ketchup
ketchup (番茄酱) 是一个基于dotnet core的微服务框架。
Stars: ✭ 170 (+32.81%)
Mutual labels:  redis, rabbitmq, dotnet-core
Bankflix
Aplicação que simula um banco digital, contendo a área do cliente e administrativa, permitindo depósitos e transferências entre contas do mesmo banco. | Application that simulates a digital bank, containing the customer and administrative areas, allowing deposits and transfers between accounts of the same bank.
Stars: ✭ 82 (-35.94%)
Mutual labels:  redis, rabbitmq, dotnet-core
Dotnetcore Microservices Poc
Very simplified insurance sales system made in a microservices architecture using .NET Core
Stars: ✭ 1,304 (+918.75%)
Mutual labels:  rabbitmq, dapper, dotnet-core
Surging
Surging is a micro-service engine that provides a lightweight, high-performance, modular RPC request pipeline. The service engine supports http, TCP, WS,Grpc, Thrift,Mqtt, UDP, and DNS protocols. It uses ZooKeeper and Consul as a registry, and integrates it. Hash, random, polling, Fair Polling as a load balancing algorithm, built-in service gove…
Stars: ✭ 3,088 (+2312.5%)
Mutual labels:  redis, rabbitmq, nlog
Meiam.system
.NET 5 / .NET Core 3.1 WebAPI + Vue 2.0 + RBAC 企业级前后端分离权限框架
Stars: ✭ 340 (+165.63%)
Mutual labels:  redis, rabbitmq, nlog
Admin.core
Admin后端,前后端分离的权限管理系统,集成统一认证授权,支持国内外主流数据库自由切换和动态高级查询,基于.Net开发的WebApi
Stars: ✭ 358 (+179.69%)
Mutual labels:  automapper, nlog, dotnet-core
Hzdtf.foundation.framework
基础框架系统,支持.NET和.NET Core平台,语言:C#,DB支持MySql和SqlServer,主要功能有抽象持久化、服务层,将业务基本的增删改查抽离复用;提供代码生成器从DB生成实体、持久化、服务以及MVC控制器,每层依赖接口,并需要在客户端将对应实现层用Autofac程序集依赖注入,用AOP提供日志跟踪、事务、模型验证等。对Autofac、Redis、RabbitMQ封装扩展;DB访问提供自动主从访问,Redis客户端分区。特别适合管理系统。
Stars: ✭ 22 (-82.81%)
Mutual labels:  redis, rabbitmq, nlog
Netpro
🌈An enhanced version of asp.netcore,Support for netcore3.1
Stars: ✭ 112 (-12.5%)
Mutual labels:  automapper, redis, dapper
Server
The backend server software layer which is the part of ONLYOFFICE Document Server and is the base for all other components
Stars: ✭ 104 (-18.75%)
Mutual labels:  redis, rabbitmq
Rabbitmq Dotnet Client
RabbitMQ .NET client for .NET Standard 2.0+ and .NET 4.6.1+
Stars: ✭ 1,580 (+1134.38%)
Mutual labels:  rabbitmq, dotnet-core
Sensu Ansible
An Ansible role to deploy a fully dynamic Sensu stack!
Stars: ✭ 126 (-1.56%)
Mutual labels:  redis, rabbitmq
Brighter
Command Dispatcher, Processor, and Distributed Task Queue
Stars: ✭ 1,393 (+988.28%)
Mutual labels:  rabbitmq, dotnet-core
Seckill
Spring Boot+MySQL+Redis+RabbitMQ的高性能高并发商品秒杀系统设计与优化
Stars: ✭ 103 (-19.53%)
Mutual labels:  redis, rabbitmq
Superman
Superman是什么:构建Java 高级开发技术的知识体系,从基础不断打怪升级成为超人之路(更新中.......)
Stars: ✭ 106 (-17.19%)
Mutual labels:  redis, rabbitmq
Springboot Templates
springboot和dubbo、netty的集成,redis mongodb的nosql模板, kafka rocketmq rabbit的MQ模板, solr solrcloud elasticsearch查询引擎
Stars: ✭ 100 (-21.87%)
Mutual labels:  redis, rabbitmq
Mall
mall项目是一套电商系统,包括前台商城系统及后台管理系统,基于SpringBoot+MyBatis实现,采用Docker容器化部署。 前台商城系统包含首页门户、商品推荐、商品搜索、商品展示、购物车、订单流程、会员中心、客户服务、帮助中心等模块。 后台管理系统包含商品管理、订单管理、会员管理、促销管理、运营管理、内容管理、统计报表、财务管理、权限管理、设置等模块。
Stars: ✭ 54,797 (+42710.16%)
Mutual labels:  redis, rabbitmq
Dotnet Istanbul Microservices Demo
This is the demo application that i created for my talk 'Microservice Architecture & Implementation with Asp.Net Core' at Dotnet İstanbul Meetup Group.
Stars: ✭ 109 (-14.84%)
Mutual labels:  rabbitmq, dotnet-core
Flink Learning
flink learning blog. http://www.54tianzhisheng.cn/ 含 Flink 入门、概念、原理、实战、性能调优、源码解析等内容。涉及 Flink Connector、Metrics、Library、DataStream API、Table API & SQL 等内容的学习案例,还有 Flink 落地应用的大型项目案例(PVUV、日志存储、百亿数据实时去重、监控告警)分享。欢迎大家支持我的专栏《大数据实时计算引擎 Flink 实战与性能优化》
Stars: ✭ 11,378 (+8789.06%)
Mutual labels:  redis, rabbitmq
Spring Boot Examples
🥗​ Spring/SpringBoot/SpringCloud 实践学习案例,从入门到精通,持续更新中,欢迎交流学习🍺 !
Stars: ✭ 110 (-14.06%)
Mutual labels:  redis, rabbitmq

AA.FrameWork

AA.Framework is built on the popular open source class library of NET Core

Completed list

  • [ ] log:Log4net
  • [ ] object mapper:automapper
  • [ ] orm:dapper(Dapper-FluentMap,Dommel)
  • [ ] MQ:RabbitMQ.Client
  • [ ] Redis:StackExchange.Redis
  • [ ] message bus:MassTransit
  • [x] more.....

Nuget Packages

Package nuget description
AA.Dapper nuget 基于dapper,Dapper-FluentMap 开发 , 支持工作单元、仓储模式和原生dapper的操作
AA.Log4Net nuget 基于Log4net开发,提供常用的日志操作类
AA.FrameWork nuget 基础框架
AA.Redis nuget 基于StackExchange.Redis开发,提供各种redis操作和基于redis的分布式锁
AA.AutoMapper nuget 基于AutoMapper开发,对象映射
AA.ServiceBus nuget 基于MassTransit开发的服务总线 ;很方便的应用在event bus 和 publish/subscribe 场景
AA.AspNetCore nuget aspnetcore常用类集合

AA.Dapper用法

实体映射配置

使用DommelEntityMap类映射属性名称。创建一个派生类,在构造函数中设置Map方法,可指定某个属性映射到数据库列名

   public class UserInfoMap : DommelEntityMap<UserInfo>
    {
        public UserInfoMap()
        {
            ToTable("Sys_UserInfo");//映射具体的表名
            Map(p => p.SysNo).IsKey();//指定主键 ,IsIdentity是否自增
            Map(p=>p.GmtCreate).ToColumn("GmtCreateDate"); //属性名和数据库列名 可以不同
            Map(p=>p.LastLoginDate).Ignore();//一些计算属性,可以忽略不需要跟数据库列进行映射
        }
    }

使用MapConfiguration.Init方法,把映射类初始化,后续就可以使用了

 public static void InitMapCfgs()
        {
            var fluentMapconfig = new List<Action<FluentMapConfiguration>>();
            fluentMapconfig.Add(cfg =>
            {
                cfg.AddMap(new UserInfoMap());
            });
            MapConfiguration.Init(fluentMapconfig);
        }

开始使用AA.Dapper

使用DapperContext设置数据库连接和数据库类型是sqlserver还是mysql
    public class AADapperContext : DapperContext
    {
        public AADapperContext() : base(new NameValueCollection()
        {
            ["aa.dataSource.AaCenter.connectionString"] = "Data Source =.; Initial Catalog = AaCenter;User ID = sa; Password = 123;",
            ["aa.dataSource.AaCenter.provider"] = "SqlServer"
        })
        { }
    }
仓储包含了大部分的操作,同时支持Async操作
IDapperRepository<UserInfo> userInfoRepository = new DapperRepository<UserInfo>();
插入实体
 var user = new UserInfo()
            {
                UserName = "chengTian",
                RealName = "成天",
                GmtCreate = DateTime.Now,
                GmtModified = DateTime.Now
            };
  var result = userInfoRepository.Insert(user);
修改实体
 var user = userInfoRepository.Get(1);
            user.GmtModified = DateTime.Now;
 var result = userInfoRepository.Update(user);
获取实体
   var user = userInfoRepository.Get(1);//By 主键
   var users = userInfoRepository.GetAll();//所有
   var users = userInfoRepository.Select(p => p.UserName == "chengTian");//谓词
删除实体
   var user = userInfoRepository.Get(1);
   var result = userInfoRepository.Delete(user);
分页
var result = _userRepository.From(sql =>  
            {  
                sql.Select()  
                   .Where(x=>x.UserName==input.UserName)  
                   .Page(input.PageIndex, input.PageSize);  
            });  
事务
using (var dbTransaction = dapperContext.BeginTransaction())  
 {  
     try  
     {  
         var user = new UserInfo()  
         {  
             UserName = "chengTian",  
             RealName = "成天",  
             GmtCreate = DateTime.Now,  
             GmtModified = DateTime.Now,  
             LastLoginDate = DateTime.Now  
         };  
         userInfoRepository.Insert(user);  
         userAlbumRepository.Insert(new UserAlbum  
         {  
             Pic = "image/one.jgp"  
         });  
         dapperContext.Commit();  
     }  
     catch (Exception ex)  
     {  
         dbTransaction.Rollback();  
     }  
 }  
 
动态Expression
var where = DynamicWhereExpression.Init<User>();  
if (input.RealName != "")  
{  
   where = where.And(x => x.RealName.Contains(input.RealName));  
}  
if (input.SysNo!=Guid.Empty)   
{  
    where = where.And(x=>x.SysNo==input.SysNo);  
}  
if (input.SysNos.Any())   
{  
    where = where.And(x=>input.SysNos.Contains(x.SysNo));  
}  
var result = _userRepository.From(sql =>  
{  
    sql.Select()  
       .Where(where)  
       .Page(input.PageIndex, input.PageSize);  
});  
支持Dapper原生操作

操作基本的封装都是单表的操作,可以满足一部分业务开发,有些业务场景编写sql还是比较合适的比如报表和一些复杂的查询,推荐使用原生dapper的操作

public class UserInfoRepository : DapperRepository<UserInfo>, IUserInfoRepository
    {
      
        public IEnumerable<UserInfo> QueryAll()
        {
            var result = DapperContext.Current.DataBase.Query<UserInfo>("SELECT * from  [Sys_UserInfo]");//实例
            return result;
        }
    }

AA.Log4Net 用法

  1. log4net.config 配置,并将log4net.config的属性->复制到输出目录->设置为->始终复制
  2. Log4NetLogger.Use("配置文件名或者路径+配置文件名"); 例如:log4net.config文件在根目录下,Log4NetLogger.Use("log4net.config");如果在自定义文件中;例如config/log4net.config 则Log4NetLogger.Use("config/log4net.config")
  3. ILog log= Logger.Get(typeof(类)); log.Debug("example");

AA.ServiceBus 用法

生产者(事件和命令两种类型)

实例化bus

 //事件
 IBusControl busControl = ServiceBusManager.Instance.UseRabbitMq(rabbitMqUri, rabbitMqUserName, rabbitMqPassword)
                         .BuildEventProducer();
 //命令
 ISendEndpoint busControl = ServiceBusManager.Instance.UseRabbitMq(rabbitMqUri, rabbitMqUserName, rabbitMqPassword)
                         .BuildCommandProducer(queueName);

实例化bus之后可以使用发送和发布两个方法

  //命令
  TaskUtil.Await(busControl.Send<SubmitOrder>(new
            {
                Id = 10
            }));
   //事件          
   TaskUtil.Await(busControl.Publish<OrderSubmitted>(new
            {
                Id = 1
            }));
消费者
  [Fact]
        public void TestConsumer()
        {
            Log4NetLogger.Use("Log4Net/log4net.config");
            string rabbitMqUri = "rabbitmq://localhost:5672";
            string rabbitMqUserName = "";
            string rabbitMqPassword = "";
            string queueName = "order.queue";

            var busControl = ServiceBusManager.Instance.UseRabbitMq(rabbitMqUri, rabbitMqUserName, rabbitMqPassword)
             .RegisterConsumer<SubmitOrderCommandConsumer>(queueName)//注册命令消费者
             .RegisterConsumer<OrderSubmittedEventConsumer>(null)//注册事件消费者
             .Build();
            busControl.Start();

        }

定义消费者需要实现接口IConsumer

public class OrderSubmittedEventConsumer : IConsumer<OrderSubmitted>
    {
        public async Task Consume(ConsumeContext<OrderSubmitted> context)
        {
            var @event = context.Message;

            var result = $"OrderSubmittedEvent {@event.Id.ToString()}";
            ILog log = Logger.Get(typeof(OrderSubmittedEventConsumer));
            log.Debug(result);
            //do somethings...
        }
    }


    public class SubmitOrderCommandConsumer : IConsumer<SubmitOrder>
    {
        public async Task Consume(ConsumeContext<SubmitOrder> context)
        {
            var command = context.Message;

            var result = $"CreateFooCommand {command.Id.ToString()}";
            ILog log = Logger.Get(typeof(SubmitOrderCommandConsumer));
            log.Debug(result);
            //do somethings...
        }
    }

AA.AutoMapper用法

实现IMapperConfiguration接口,创建映射规则配置
 public class WebMapperConfigurations : IMapperConfiguration
    {
        public int Order { get { return 0; } }

        public Action<IMapperConfigurationExpression>  GetConfiguration()
        {
            Action<IMapperConfigurationExpression> action = cfg =>
            {
                cfg.CreateMap<UserVm, UserInput>();
            };
            return action;
        }
    }
在程序startup调用配置
     var mapperConfig = new WebMapperConfigurations();
     AutoMapperConfiguration.Init(new List<Action<IMapperConfigurationExpression>> { mapperConfig.GetConfiguration() });
     ObjectMapping.ObjectMapManager.ObjectMapper = new AutoMapperObjectMapper();
利用扩展方法MapTo执行映射
 [Fact]
        public void TestMap()
        {
            //init
            Init();
            UserVm userVm = new UserVm { Id = 1, Name = "成天" ,Remark="微信公众号:dotNet知音"};
            var userDto = userVm.MapTo<UserInput>();
            //var userDto2 = userVm.MapTo<UserVm,UserInput>();

        }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].