[x] Each module unit test writing
Di United FrontThe Linddotnet framework also uses a global DI injection to use module objects, a loosely coupled design for unit testing
is very convenient for people.
services.AddLog4Logger(o =>{o.Log4ConfigFileName = "log4.config";o.ProjectName = "test";});services.UseDapper(o =>{o.ConnString = $"Data Source=/Data/intergratetest.db";o.DbType = Lind.DotNetCore.Repository.DbType.SqlLite;});
Message QueuingMessage Queuing is primarily implemented with ' Rabbitmq,kafka ' to decouple projects, handle high concurrency tasks and time-consuming tasks, and producers
There is no need to care who wants to consume, it sends the message to the queue, and the consumer does not care about how the message is generated, just the consumption by
Business logic to get rid of it!
services.AddRabbitMQ(o =>{o.ExchangeName = "Piliapa.zzl";o.MqServerHost = "192.168.200.214";o.VirtualHost = "/";o.ExchangeType = "topic";});
NosqlThe current structure of the NoSQL part consists of redis和mongodb
all the choices of the two frameworks the biggest reason is that they cover the
All NoSQL usage scenarios, like Redis used to store k/v key-value pairs, support 5 large data structures, and MongoDB is used to store documents
Data, support complex queries, nested queries, and more.
services.AddRedis(o =>{o.Host = "localhost:6379";o.AuthPassword = "";o.IsSentinel = 1;o.ServiceName = "mymaster";o.Proxy = 0;});
CachingData caching is an important part to store some hot data, and the current distributed environment uses Redis, which can be used directly
Run-time caching.
services.AddRuntimeCache(o =>{o.CacheKey = "lindCache";o.ExpireMinutes = 5;});
WarehousingWarehousing mainly simplifies the operation of data persistence, provide a simple curd interface, the user can directly call, do not need to intervene in SQL statements,
In this regard, the efficiency of development has indeed improved a lot. At present the Uncle Frame integrates ef,dapper,mongodb,redis,elastic
such warehousing, which
EF and dapper can manipulate databases such as Sqlserver,mysql,sqllite.
services.UseDapper(o =>{o.ConnString = $"Data Source={Directory.GetCurrentDirectory()}/intergratetest.db";o.DbType = Lind.DotNetCore.Repository.DbType.SqlLite;});
Service BusService bus is primarily used to decouple the calls between layers of the project and the programmer to put the focus on the business, the current framework provides an IOC-mode event,
Events that are stored based on simple memory dictionaries.
services.AddIocBus();services.AddInMemoryBus();
SolrSOLR was Lucene
developed prior to the foundation, written in Java, typically deployed on Tomcat, with its own image management interface that can be used to manage the core,
In general, when designing a core, we need to create a corresponding entity for it, corresponding to its attributes in the core; SOLR has a rich set of plugins, like some
Chinese word breaker, index package, etc.
services.AddSolrNet(o =>{o.ServerUrl = "http://192.168.200.214:8081/solr/system_companysubject";o.UserName = "sa";o.Password = "sa";});
Dispatch ServiceThe dispatch service is based on the quartz
core and encapsulates its functionality to support the task of adding in real time, which uses the Windows/linux directory monitoring event
, also. Netcore help us achieve, we just need to subscribe to relevant events.
var watcher = new FileSystemWatcher{Path = AppDomain.CurrentDomain.BaseDirectory,NotifyFilter = NotifyFilters.Attributes | NotifyFilters.CreationTime | NotifyFilters.DirectoryName | NotifyFilters.FileName | NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.Security | NotifyFilters.Size,Filter = "*.dll"};// quartz运行时,可以添加新job,但不能覆盖,删除等watcher.Created += new FileSystemEventHandler((o, e) =>{foreach (var module in Assembly.LoadFile(e.FullPath).GetModules()){ foreach (var type in module.GetTypes().Where(i => typeof(ISchedulingJob).IsAssignableFrom(i))) { JoinToQuartz(type, DateTimeOffset.Now); }}});//Start monitoring.watcher.EnableRaisingEvents = true;
LogThe log frame differs from the previous Lind framework in that it only moves the object's life cycle to the DI container for unified management, using a single-case approach, and the current log framework provides
Support for log4net, while lightweight logs can be implemented using Lindlogger.
services.AddLog4Logger(o =>{o.Log4ConfigFileName = "log4.config";o.ProjectName = "test";});
Asspect Intercept ComponentsMethod interception is widely used in Microsoft framework, it mvc,api
can dynamically add all logic before and after the execution of the method, without paying attention to the details of the method and implementing the interception behavior.
Developers do not need to focus on the details of the method, which takes advantage of the object-oriented encapsulation feature, but also conforms to the open and closed principle, because you can not modify the original code in the case of dynamic
Add behavior to it.
[Fact]public void FuncInvoke(){var obj = ProxyFactory.CreateProxy<AspectTest, AspectTest>();Assert.Equal("OK", obj.GetHello());}[Fact]public void ActionInvoke(){var obj = ProxyFactory.CreateProxy<AspectTest, AspectTest>();obj.SetHello();Assert.Equal(1, 1);}
Cond...
Back to Catalog