使用dll的三层架构 [英] three tier architecture using dll

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

问题描述

将三层体系结构实现为dll的示例

example for implement three tier architecture as a dll

推荐答案

您应为BAL,DAL(作为类库)和UI(作为Web项目)创建单独的项目并将您的BAL(DLL)引用到UI

http://www.dotnetfunda.com/articles/article71.aspx [
you should create separate projects for BAL, DAL (as Class Library) and UI (as Web project) and reference your BAL(DLL) into UI

http://www.dotnetfunda.com/articles/article71.aspx[^]


这里是一个示例.将一个或多个层组件放入类库.
Here''s an example. Put one or more of your tier components into a class library.




客户端和服务器权限之间存在三个层级.
您在问三个逻辑层架构,对吧,让我来解释一下

首先,您必须为每种逻辑创建dll

我为您提供了立即创建dll的步骤

创建项目->创建类->在该类中创建所需的代码->构建项目.

多数民众赞成在这里您的工作已完成,可以创建dll

通过为该类创建对象,将该dll导入到您的项目中,使用该类方法

这是创建dll的过程.

现在我们在主题三层中进行一些介绍,这意味着我们将工作任务划分为几个dll.

例如:
我们将数据库功能划分为一个dll,例如insert,select,update,openconnection到数据库,所有这些功能都写在一个dll下,我们称该dll为DBFunctions

与业务逻辑相同,我们为每个业务功能开发dll
现在我们看到它们如何在层之间进行通信

表示层(PL)->业务逻辑层(BLL)->数据访问层(DAL)

我们为数据库维护一个DAL.我们对所有表的所有插入语句进行了概括,我们只是调用了一种将数据插入到数据表中的方法.

DBfunction类包含以下方法


Hi,

Three tier means levels exists in between client and server right.
you are asking three logical layer architecture right letme explain you

frst you''ve to create dlls for each and every logic

I gave you steps to create dll now

create project->create class->write required code in that class->build project.

thats it your wrk is done here to creation of dll

thn import that dll into your project use that class methods by creating object for that class

this is the process of creating dll .

now we go some dipper in subject three tier means we divide working tasks into several dlls.

for e.g:
we divide database functions into one dll like insert,select,update,openconnection to database all these functionalities are write under one dll we call that dll as DBFunctions

same as business logic we develop dlls for each and every business functions
now we see how they communicate between layers

presentation layer(PL)->busines logic layer(BLL)->data Access Layer(DAL)

we maintain single DAL for database.we generalize all insertion statements for all tables we just call one method to insert data into data tables .

the DBfunction class contains following methods


//method can be used for executing insert,delete,update sql commands
  public bool exenonquerycmds(string query)
{
    bool exestatus;
    sqlcommand cmd=new sqlcommand(query,con);
    int re=cmd.executenonquery();
   if(re>0)
   {
     exestatus=true;
   }
   else
    {
    exestatus=false;
   }
   return exestatus;
  
}

//method can be used for retrieving data from table
public datatable gettabledata(string query)
{
    Datatable dt=new Datatable();
    sqldatadapter da=new SqlDataAdapter(query,con);
    da.Fill(dt);
    return dt;
}


这样,我们在BLL中编写了有关业务功能的所有方法

我们在PL中调用这些方法来实现三层层


Like this we write all methods regarding business functions in BLL

we call those methods in PL to implement Three tier Layer


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

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