问题标签 [three-tier]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
asp.net - 如何在业务层项目或数据访问层项目中启用跟踪?
我在一个解决方案中有 3 个项目,其中一个是数据访问层项目,另一个是报告项目和主项目。如何在 DAL 和报告项目中启用和查看跟踪?我能够看到在主项目中完成的跟踪。我可以在 dal 和报告项目中编写 trace.write,但看不到它们。有任何想法吗?
asp.net - 三层架构 Asp.Net 中的帮助文件
我有一个实施了三层的项目。现在我需要在这个项目中添加一些通用的帮助文件。
示例 - 发送邮件的类。
无论数据层或 BLogic 层如何,都将在整个项目中使用此帮助文件。现在我很困惑。我在哪里添加这个帮助文件?意味着我需要将它们包含在哪一层。
我也想实现一些接口。在这种情况下,我也很困惑,在哪里添加它们?
asp.net-mvc - asp.net mvc 中的三层架构
我想知道在asp.net mvc中实现三层架构是什么意思?
我看过很多关于这个的帖子,都是这样提到的。但我很困惑。是否将 MVC 模型分离到另一个称为业务层的解决方案,称为在 mvc 中实现三层架构?如果不是,在 mvc 中实现三层架构的正确方法是什么?
类型 1
表示层:来自 MVC 模式的“控制器和视图”。
业务层:来自 MVC 模式的“模型(数据)”。
数据访问层:原始数据访问层。
类型 2
表示层:MVC 中除模型之外的所有
内容 业务层:将模型分离出来
数据访问层:数据库本身
security - Using a Three-Tier Architecture with Sensitive Data
I have heard thoughts that using a three-tier architecture is the best practice for web applications that need to be secured.
My understanding of this architecture is as follows:
- Web Tier Servers - Field requests and communicate with a middle layer for database communication. The database is completely walled off from the web server environment.
- Middle Tier Servers - Expose an API that will handle the retrieval and storage of all information. The web server communicates to this server to handle data operations.
- Data Tier Servers - Stores all of the user data. Allows communication from the middle tier, but not from the web tier
The other option is direct communication from the web server to the database. This communication would be done as a specific user who only had access that the application needed (SELECT
, INSERT
, UPDATE
on the necessary tables). This user, for example, wouldn't be able to delete records from the user table or drop tables.
The logic behind the three-tier approach being more secure is that if your web server is compromised, the attacker would only be able to get data in the same way that you can use your API.
My question: Is this type of approach necessary for a web application where potentially sensitive data is stored? All incredibly sensitive data would be encrypted at rest, but other personally-identifiable information would be stored in plaintext to allow searching.
If it is necessary, what is the best way to secure such an approach? Should your API require a valid session token in order to get data for a particular user? My concern would be that an attacker could simply use the API to get the data they wanted if you didn't have another layer of security in it. How would you secure your API to prevent this?
javascript - 对于基于服务器的应用程序,我需要在浏览器客户端上使用 MVC 模型的原因是什么?
假设:
- 我有一个带有 Java 风格 Web 服务器的银行应用程序。
- 客户端是用 JS 编写的,带有骨干网和一些其他插件。(开发人员是 Angular 的粉丝,但他们没有使用它)。
我的 JavaScript 开发人员来找我说“X 是不可能的,因为我们在浏览器中执行 MVC 的方式。”
现在我可以在服务器端使用 MVC,而且我们已经有了。但是当 JavaScript 人员想要在客户端上拥有一个 MVC 时,感觉就像我们在两个不同的地方保持关于客户体验的状态。我认为将其保存在一个地方更简单。
我熟悉 90 年代的“三层”架构——一个数据库层、一个事务管理层和另一个客户交互层。我们远离了它,因为它太可怕了。
我也熟悉在 Node.js 中运行服务器端应用程序。对我来说 - 在这种情况下拥有服务器端 MVC 是有意义的。
我的问题是:对于基于服务器的应用程序,我需要在浏览器客户端上使用 MVC 模型的原因是什么?
c# - 三层应用模型设置
这可能是一个广泛的直接答案,但如果我能得到一些意见那就更好了,我们正在构建一个三层应用程序,数据层(数据库连接)将由 wcf 服务组成,这些服务将通过网站和外部调用移动应用程序。
它自己的项目将在 MVC 5 环境中构建,现在关于 MVC 模型,我不是 100% 了解我应该将它们通常保存在 MVC 应用程序中的位置,你有文件夹“模型”,但正如我有一个三层应用程序,应用程序将调用数据层从服务器返回数据并执行 CRUD 操作。
对我来说,将模型存储在数据层中似乎是正确的,从网站上我将添加对数据层的引用,这样我就可以使用模型并在需要时传递/检索它们你会说这是正确的做法?
c# - Three Tier Application
In a 1 tier application i.e Mvc, you get a folder called models and you build and store your classes in there, I'm aware when it comes to a three tier application from what I have read it seems correct to store the models inside the business layer (2nd tier), and from the UI (first tier) I would add a project reference to the 2nd tier which will allow me to use the models and make calls to methods.
From the second tiers perspective it would call the data layer (third tier) and perform crud operations against the database, but the data layer would require the models from the business layer so when I try to add a project reference from data layer to business layer i get the error
A Reference to "Business Layer" could not be added, adding this project as a reference would cause a circular dependency
Which I understand as a reference has already been made via business layer to data layer
How would I get around this? do I create additional models in the data layer and populate them with results from the database and pass that back to the business layer which then passes it back up to the UI? I'm slightly confused on this.
** Update **
From what I have read for the data layer to reference models inside the Business layer I would need to do model mapping, My model mapping will be quite large so I'm thinking of including a 4th tier which will be a shared library and that will consist of all the models that way the data layer and the business layer can access the models as and when is required.
c# - 检查用户名/密码是否存在于多个表中
我正在处理登录页面。我想检查数据库中是否存在用户名和密码。我有三个数据库表:Teams、Organizers、Admins,每个表中分别带有用户名和密码字段。我正在实现三层架构中的登录。
我相信我下面的SQL 语句有问题。我使用不同/有效的团队用户名和团队密码测试了我的 sql 查询。COUNT 查询返回多行,这是不正确的。
这是我的数据访问层代码:
至于业务逻辑层代码:
c# - 下拉列表数据源到值对象
我的应用程序是用三层架构构建的。但是,我希望下拉列表将数据源提供给 Value Object 类。目前,我正在从数据访问层 -> 业务逻辑层 -> 表示层获取下拉列表的数据。但我想从值对象中获取列表的数据源。因此,我想要的是来自数据访问层 -> 值对象 -> 业务逻辑层 -> 表示层(下拉菜单)。我试图将它数据源到值对象,但它给了我“无效数据源;必须是 IListSource、IEnumerable 或 IDataSource 类型”的错误。谢谢!
这是我的代码:
宗教VO
宗教道
宗教BLO
ASPX
这是错误消息的屏幕截图:
asp.net - Entity Framework 6.0 - 使用时间戳列实现乐观并发
背景: 我正在开发一个使用 EF 6.0 作为数据访问的 ASP.Net Web 表单应用程序。我 3 层.. 网站--> 业务--> 数据访问(此处为 EF 和 EDMX).. 我想在我的代码中处理数据库并发。
我的示例表看起来像, Table :EmployeeMaster Columns : EmpID, EMpName, Address, UpdatedBy, UpdatedOn (DataTime)
我尝试按照一些博客中的说明实现乐观并发,方法是在 DB 中使用数据类型为“timestamp”的列“ConcurrencyCheck”并将模型中的并发模式设置为“Fixed”。它运作良好。但是,我觉得在我的几乎所有表格中增加一列(我有大约 50 个表格)会有点奇怪。
问题: 有没有办法可以使用现有列进行并发检查并实现乐观并发?
我尝试将我的现有列“UpdatedOn”(日期时间列,不可为空)设置为“固定”并发模式。正在进行并发检查。但是,当我进行更新时,我无法将最新时间更新到该字段中,因为它具有用于执行并发检查的 previos 时间戳。
注意:我知道 EF 会将我标记为并发模式“固定”的列添加到其 where 子句并达到预期的结果。每次我们调用方法时,我都会创建数据库上下文。