多层多数据库模式开发的实验(三)接口

    在分层架构中,接口决定了各层中的各个操作类需要实现何种操作。接口也是系统实现多数据库不可缺少的部分。同时,为保证面向对象的特性,接口之间的数据传递主要靠实体类或实体类集合。

    这里需要注意的是记得在引用中添加MWC.Entity工程,并且在代码中加上“using MWC.Entity”。

用户对象User接口

ContractedBlock.gifExpandedBlockStart.gif Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using MWC.Entity;
using System.Data;

namespace MWC.Interface
ExpandedBlockStart.gifContractedBlock.gif
{
    
public interface IUser
ExpandedSubBlockStart.gifContractedSubBlock.gif    
{
        
//插入
        void Insert(Entity.User user);

        
//获得列表
        DataSet GetList();
        
//以ID获得user
        DataSet GetUserFromID(Guid userID);
        
//以名称获得user
        DataSet GetUserFromName(string userName);
    }

}

 

部门、群组对象Group接口

ContractedBlock.gif ExpandedBlockStart.gif Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using MWC.Entity;
using System.Data;

namespace MWC.Interface
ExpandedBlockStart.gifContractedBlock.gif
{
    
public interface IGroup
ExpandedSubBlockStart.gifContractedSubBlock.gif    
{
        
//插入
        void Insert(Entity.Group group);
        
        
//获得列表
        DataSet GetList();
        
//以ID获得Group
        DataSet GetGroupFromID(Guid groupID);
        
//以名称获得Group
        DataSet GetGroupFromName(string userName);

        
//获取Group的User
        DataSet GetGroupOfUser(Guid groupID);
        
//加User到Group
        void InsertUserToGroup(Guid groupID, Guid userID);
    }

}

 

接口类将放在MWC.Interface工程下。

注:本实验为了突出重点,相对简化了接口的设计:在实际操作中,业务逻辑层也需要设计接口来统一操作。本实验仅仅针对数据层进行了接口设计。

转载于:https://www.cnblogs.com/squabbyfish/archive/2008/11/06/1327430.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值