当前位置:网站首页>Introduction to prism framework - Modular introduction
Introduction to prism framework - Modular introduction
2022-06-12 01:30:00 【Tsim Sha Tsui Duan Kun 415】
In actual work, we will divide the functions into multiple modules for development
- Onion structure —— Separation is for better union
In order to make the software easy to maintain , test , And flexible enough , So there is the onion structure , It is a good choice to develop any software
Code dependencies are from the outside in , The code in the inner ring should not know anything about the outer ring .
The outer layer depends on the inner layer , The inner layer has no perception of the outer layer
2008 year Jeffrey Palermo Proposed onion architecture
Key principles of onion Architecture :
- Build applications around independent object models
- The inner layer defines the interface , The outer layer implements the interface
- The direction of dependence points to the center of the circle
- All application code can be compiled and run independently of the infrastructure
—— Jeffrey Palermo 2008, The Onion Architecture: part 3

prism Examples of modular functions
Create two new projects , Then attribute - change WPF The application is a class library

Add... To the two class libraries respectively Views Folder - Then add a paragraph of text to show

viewa and viewb

A program is recognized as a module because it has certain characteristics
Then create a new class ModuleAProfile
And then manage nuget Add... To the package Prism.Dryloc My bag
Turn it out and implement it in the class IModule This interface
( Then we realized that we can not implement this method , Then delete the method )
public class MouleAProfile : IModule
{
public void OnInitialized(IContainerProvider containerProvider)
{
}
public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<viewA>();// Register here ViewA, Remember to add views Declaration space for
}
}And then the same thing ,ModuleB It's the same operation
Add... To the solution ModuleA and ModuleB Project references for ![]()
Then add the method
protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
{
moduleCatalog.AddModule<ModuleAProfile>();
moduleCatalog.AddModule<ModuleBProfile>();
base.ConfigureModuleCatalog(moduleCatalog);
}You can achieve cross region search

But this is a strong reference method , There's another way
First, remove the strong reference to , Then delete the calling and reference projects
find ModuleA and ModuleB Of bin/Debug Inside dll Suffix program
Create a new folder in the same location as the folder in the main application , It contains the required assemblies 
Then set the folder name
Used to find
public class Xin
{
public partial class App : PrismApplication
{
protected override Window CreateShell()
{
return Container.Resolve<Mainview>();
}
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
}
protected override IModuleCatalog CreateModuleCatalog()
{// You can directly return the specified module address In this way, the coupling relationship is greatly reduced
return new DirectoryModuleCatalog() { ModulePath = @".\Modules" };
}
}
}return new DirectoryModuleCatalog() { ModulePath = @".\Modules" };
When this method is started, it will be loaded when it meets the contract


7-Modules-AppConfig
7-Modules-LoadManual
7-Modules-Xaml
Are used to load modular
Github Of prism Module call cases
The general method is : Set up a way to find modularity - Then define a required module - Hit a corresponding container - After startup, the automatic matching search is loaded
边栏推荐
- websocket服务器实战
- Elementary OJ problem of binary tree
- Vscode - the problem of saving a file and automatically formatting the single quotation mark 'into a double quotation mark'
- JMeter operation process that can be understood at a glance
- Peewee module basic use -orm
- Common assertions for JMeter interface testing
- Industry competition analysis and investment scale research report of global and Chinese micro potato industry 2022-2028
- Simulated 100 questions and simulated examination for safety management personnel of metal and nonmetal mines (small open pit quarries) in 2022
- Pytorch model loading and saving, and training based on the saved model
- 2022工具钳工(高级)复训题库及在线模拟考试题库来源:安全生产模拟考试一点通公众号
猜你喜欢

西南林业大学“西林链”通过工信部电子标准院功能测试 | FISCO BCOS案例
![2022-06-11: note that in this document, graph is not the meaning of adjacency matrix, but a bipartite graph. In the adjacency matrix with length N, there are n points. Matrix[i][j] represents the dist](/img/ab/b3044472561ac366f2cbd878268132.png)
2022-06-11: note that in this document, graph is not the meaning of adjacency matrix, but a bipartite graph. In the adjacency matrix with length N, there are n points. Matrix[i][j] represents the dist
![[n32g457] remote monitoring of graffiti cloud based on RT thread and n32g457](/img/c3/5c9970d7e77afce925814d0ecd3b96.jpg)
[n32g457] remote monitoring of graffiti cloud based on RT thread and n32g457

感知机从0到1

New knowledge: monkey improved app crawler

The annual salary of testers in large factories ranges from 300000 to 8K a month. Roast complained that the salary was too low, but he was ridiculed by netizens?

Kill, pkill, killall, next, what I brought to you in the last issue is how to end the process number and rush!

Jvm: thread context classloader

Online Fox game server - room configuration wizard - component attribute and basic configuration assignment

JMeter operation process that can be understood at a glance
随机推荐
【项目实训】校验注解
Streaming data warehouse storage: requirements and architecture
Analysis report on operation trends and development strategies of global and Chinese plastic adhesive industry 2022-2028
Vue3+ts+node creates personal blog (database design)
[project training] JWT
Agile v.s. Waterfall
Sharing of Manta network parallel chain solutions by Hufu Research Institute
Henan Zhongchuang - from cloud to edge, how edge computing enables data centers
Go language learning summary (7) -- Dachang go programming specification summary
Article 8: Design of multi-functional intelligent trunk following control system | undergraduate graduation project - [reply and Q & a record of design completion]
Online Fox game server - room configuration wizard - component attribute and basic configuration assignment
Three line code solution - Maximum sub segment and - DP
Practice of Flink CDC + Hudi massive data entering the lake in SF
Operation of simulated examination platform of diazotization process examination question bank in 2022
Websocket server practice
Colorize Voronoi Diagram Template
Crawler small case 04 - use beautiful soup to batch obtain pictures
The road of global evolution of vivo global mall -- multilingual solution
Article 6: Design of multi-functional intelligent trunk following control system | undergraduate graduation design - [Key Technology - positioning technology related data (UWB WiFi Bluetooth)]
打造Flutter高性能富文本编辑器——渲染篇