带有mvvm的3层架构 [英] 3 tier architecture with mvvm

查看:93
本文介绍了带有mvvm的3层架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要做一个3层的项目



,因为我理解3层架构的工作原理如下:



我有视图 - 用户的UI,我有BLL有业务逻辑和DAL +模型 - (我想在实体框架中使用) - 这三个是同一个不同的项目解决方案并在3台不同的计算机上使用



视图引用了BLL项目,BLL引用了实体框架项目



而且视图无法访问数据库



如果我不正确我会很高兴如果你修复我



我的问题是:



我需要在这个项目中使用mvvm吗?



,如果答案是是,我应该把它放在哪里 - 用bll或者查看?



我想要那个该程序将在内部网络中工作 - 所以在我完成这个项目之后如何将它分成三台计算机(在c是的,他们已经在同一个网络上了)?



我看到有人写道他在3层架构中使用wcf - 我是否也需要使用它?





提前感谢您的帮助

I need to do a project with 3-tier

as I understand the 3 tier architecture work like that:

I have the view-the UI of the user,I have the BLL that have the business logic and the DAL+Model-(I want to use in entity framework)-these three are different projects on the same solution and for using it on 3 different computers

the view have reference to the BLL project and the BLL have reference to the entity framework project

moreover the view cant have access to database

if i didn't correct i will be glad if you fix me

my questions are:

do I need use mvvm in this project?

in case that the answer is "yes" where should i put it-with the bll or with the view?

I want that the program will work in inner network-so after i finish this project how can I separate it to three computers (in case that they are already on the same network)?

I saw some one that wrote that he is using wcf in 3 tier architecture-do I need to use it too?


thank you in advance for your help

推荐答案

MVVM是UI层模式显然必须在UI层中使用。由于您也有BL和DL层,在MVVM的ViewModel类中,您应该使用现有的模型和BL代码。并且每3层架构BL将使用DL。



欲了解更多信息,请查看 https://en.wikipedia。 org / wiki / Model_View_ViewModel [ ^ ]。



但首先要理性,如果你真的需要MVVM,下面的页面会帮助你: http://stackoverflow.com/questions/2653096/why-use-mvvm [ ^ ]



然后同样的 MVVM与3层架构也会在下面的页面中讨论,希望这些也会对你有所帮助:

http://stackoverflow.com/questions/5141717/compare-between-3-layer-pattern-and-mvvm [ ^ ]

http://stackoverflow.com/questions/13840670/mvvm-wpf-application-in-3-tier-architecture [ ^ ]



如果您有任何具体问题我们可以讨论。谢谢。
MVVM is a UI layer pattern so obviously must be used in UI layer. As you have BL and DL layer too, In your ViewModel classes of MVVM, you should be using your exiting Models and BL code. And per 3 layer architecture BL would be using DL.

For more have a look on https://en.wikipedia.org/wiki/Model_View_ViewModel[^].

But first be rational if you really need to have MVVM, and below page will help you: http://stackoverflow.com/questions/2653096/why-use-mvvm[^]

Then same issue of MVVM with 3-layers architecture is discussed on below pages also and hope those will help you too:
http://stackoverflow.com/questions/5141717/compare-between-3-layer-pattern-and-mvvm[^]
http://stackoverflow.com/questions/13840670/mvvm-wpf-application-in-3-tier-architecture[^]

We can discuss over further specific questions if you have any. Thanks.


我们不能正确回答你的问题,它太模糊了。



你可能需要遵循几个教程WPF,WCF,MVVM与否,以便更加了解您将需要什么,以及哪种工具对您最有用。我们不能为您做到这一点,决定您将使用哪种技术实现您的项目。唯一具备这种能力的就是你自己。



这实际上意味着很多工作,是的,但是如果没有努力就没有宝贵的知识。
We cannot decently answer to your question, it is too vague.

You may need to follow several tutorials around WPF, WCF, MVVM or not, to get a closer idea of what you are going to need, and which tool will be the most useful for you. We cannot do that for you, deciding with which technology you will realize your project. The only one that has this ability is yourself.

That actually means a lot of work, yes, but there is no valuable knowledge without effort.


这篇关于带有mvvm的3层架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆