如何在MVC应用程序中创建具有安全性的dataaccess层 [英] How to create a dataaccess layer with security in MVC application
本文介绍了如何在MVC应用程序中创建具有安全性的dataaccess层的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将创建一个新的MVC应用程序。因为我需要创建一个具有适当安全实现的数据访问层和业务逻辑层(3层架构)。
我尝试过:
我要创建一个新的MVC Application.For我需要创建一个数据访问层和具有适当安全性实现的业务逻辑层(3层体系结构)。
I going to create a New MVC Application.For that i need to create a Data Access Layer and Business logic Layer with Proper security Implementation(3 tier Architecture).
What I have tried:
I going to create a New MVC Application.For that i need to create a Data Access Layer and Business logic Layer with Proper security Implementation(3 tier Architecture).
推荐答案
首先在Model文件夹中创建一个包含属性的.cs文件。
就像命名它... ModelProperty.cs并在该文件中定义属性。
namespace application / project姓名
{
公共类ModelProperty
{
[Key]
public int Id {get;组; }
public string Title {get;组; }
。
。
。等等...
}
}
比在Model文件夹下添加另一个.cs文件,在实体框架的帮助下,它将包含数据访问逻辑。
并在控制器中调用这两个文件。
First create one .cs file in Model folder which contain property.
Like named it something like... ModelProperty.cs and define property in that file.
namespace application/project name
{
public class ModelProperty
{
[Key]
public int Id { get; set; }
public string Title { get; set; }
.
.
. and so on...
}
}
than add another .cs file under Model folder which will contain data access logic in it with the help of entity framework.
and call this both file in controller.
这篇关于如何在MVC应用程序中创建具有安全性的dataaccess层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文