简体   繁体   English

.net中集中式数据库应用程序的设计/架构建议

[英]recommendation on design/architecture for centralized DB application in .net

I am a junior .NET programmer. 我是初级.NET程序员。 I have to develop an applicaion that handles sales, customers and providers (among another very large number of things) on a local environment for a small number of users (around 8). 我必须开发一种应用程序,该应用程序可以在本地环境中为少数用户(大约8个)处理销售,客户和提供者(还有很多其他事情)。 The whole thing should be created for local use with a centralized database. 应该创建一个完整的东西,以便使用集中式数据库在本地使用。 My architecture would be something like this from top to bottom: 我的架构从上到下都是这样的:

1.UI on windows forms. 1.Windows窗体上的UI。

2.Controller for handling user requests 2.用于处理用户请求的控制器

3.Bussines objects that are Entity Framework generated objects 3.Bussines对象是Entity Framework生成的对象

4.SQL Database. 4.SQL数据库

Obviously I already know that is not the best approach for architecture, yet I want to keep it as simple as possible. 显然,我已经知道这不是架构的最佳方法,但我想使其尽可能简单。 I've done a lot of research but the number of questions seems to widen so I was looking for some guidance for this particular problem so I can focus in researching after having a recommended architecture I feel comfortable with. 我已经做了很多研究,但是问题的数量似乎正在扩大,因此我一直在寻找有关此特定问题的指导,以便在拥有自己喜欢的推荐体系结构后可以专注于研究。 Sorry about uberasking this question I'm just overwhelmed with the options. 抱歉,我对这个问题不知所措。

Tnx for helping a newb. Tnx帮助新手。

What you've described seems like a good approach coming form a junior developer level. 您所描述的内容似乎是初级开发人员级别的一种好方法。

There are many factors that affect what architecture is appropriate for a project. 有许多因素会影响哪种架构适合项目。 Time, schedule, money, simplicity or complexity, maintainability and future development expansion versus a one-and-done application. 与一劳永逸的应用程序相比,时间,进度,金钱,简单性或复杂性,可维护性和将来的开发扩展。 Will likely future versions require a massive rewrite anyway due to the data model or integration with some unknown system? 由于数据模型或与某些未知系统的集成,将来的将来版本是否可能需要大量重写?

No application is ever perfect after the first iteration. 第一次迭代后,没有应用程序是完美的。 Any good developer will find a myriad of ways to improve a project after it is finished as their technical skills and knowledge grow. 任何优秀的开发人员都会随着技术技能和知识的增长而找到无数种改善项目的方法。

That being said, the Database and Entity Framework side of things is perfectly fine. 话虽这么说,数据库和实体框架方面的工作还是很不错的。 EF will get you focusing on features quickly instead of infrastructure. EF将使您快速专注于功能而不是基础架构。 You may have already weighed EF against other object model suites, or a traditional stored procedure based approach. 您可能已经将EF与其他对象模型套件或基于传统存储过程的方法进行了权衡。

The UI is probably dictated by the client or a business need. UI可能由客户或业务需求决定。 The only other big decision here would maybe be an intranet web application so you don't have to worry about installing software on users' machines. 唯一的重大决定可能是Intranet Web应用程序,因此您不必担心在用户计算机上安装软件。

The controller / class library / business layer makes sense so you don't have to be writing queries against EF directly in your winforms code. 控制器/类库/业务层很有意义,因此您不必直接在Winforms代码中针对EF编写查询。 This allows you to more easily rip out the UI and replace it with something else down the line. 这使您可以更轻松地提取UI并用其他方式替换。

Nothing you've outlined throws up any red flags without knowing the exact situation. 您所概述的所有内容都会在不知道确切情况的情况下引发任何危险信号。 Move forward with that approach, and see how it goes. 继续采用这种方法,看看它如何发展。 When you're done, think about what aspects of the architecture were challenging to deal with, were redundant, or otherwise troublesome. 完成后,请考虑该架构的哪些方面面临挑战,冗余或其他麻烦。

Since as you said the Entity Framework objects are generated, you may want to have one or more Model levels between the Controller and the Entity objects. 如前所述,由于已生成实体框架对象,因此您可能希望在Controller和Entity对象之间具有一个或多个Model级别。 It is quite often that a specific View has data coming from more than one Entity. 通常,一个特定的视图具有来自多个实体的数据。 If you do not have another level of Models that the Controllers can access, what generally happens is that the Business Logic migrates to the Controllers. 如果您没有控制器可以访问的另一级模型,通常会发生的是将业务逻辑迁移到控制器。

In other words, the Controller would create the Model, and the Model would know how to interact with the Entities. 换句话说,控制器将创建模型,并且模型将知道如何与实体进行交互。

Note that I am assuming you are using an MVC pattern since your reference of Controllers in #2. 请注意,由于您在#2中引用了Controllers,因此我假设您正在使用MVC模式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM