資源簡介
1.新建一個空白解決方案名稱為Company
2.在該解決方案下,新建解決方案文件夾(UI,BLL,DAL,Model) 當然還可以加上common
3.分別在BLL,DAL,Model 解決方案文件夾下創建類庫項目
(1).BLL解決方案文件夾: Company.BLL、Company.IBLL、Company.BLLContainer
(2).DAL解決方案文件夾: Company.DAL、Company.IDAL、Company.DALContainer
(3).Model解決方案文件夾:Company.Model
4.在UI 解決方案文件夾下添加一個ASP.NET Web應用程序,名稱為Company.UI,選擇我們的Mvc模板.
代碼片段和文件信息
using?DAL;
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Linq.expressions;
using?System.Text;
using?System.Threading.Tasks;
namespace?BLL
{
????public?abstract?class?baseService?where?T?:?class
????{
????????protected?baseRepository?CurrentRepository?{?get;?set;?}
????????public?baseService(baseRepository?currentRepository)?{?CurrentRepository?=?currentRepository;?}
????????///?
????????///?釋放
????????///?
????????public?void?Dispose()?{?CurrentRepository.Dispose();?}
????????///?
????????///?根據條件判斷個數
????????///?
????????///?
????????///?
????????public?int?Count(expression>?predicate)?{?return?CurrentRepository.Count(predicate);?}
????????///?
????????///?根據條件判斷是否存在
????????///?
????????///?
????????///?
????????public?bool?Exist(expression>?anyLambda)?{?return?CurrentRepository.Exist(anyLambda);?}
????????///?
????????///?獲取所有列表
????????///?
????????///?
????????public?List?GetListAll()?{?return?CurrentRepository.GetAll();?}
????????///?
????????///?根據主鍵獲取單個實體對象
????????///?
????????///?
????????///?
????????public?T?GetEntity(object?id)?{?return?CurrentRepository.Find(id);?}
????????///?
????????///?添加實體對象
????????///?
????????///?
????????///?
????????public?T?Add(T?entity)?{?return?CurrentRepository.Add(entity);?}
????????///?
????????///?添加實體對象
????????///?
????????///?
????????///?返回bool
????????public?bool?Create(T?entity)?{?return?CurrentRepository.Create(entity);?}
????????///?
????????///?更新實體對象
????????///?
????????///?
????????///?
????????public?bool?Update(T?entity)?{?return?CurrentRepository.Update(entity);?}
????????///?
????????///?根據條件批量修改
????????///?
????????///?
????????///?pression“>
????????///?
????????public?bool?UpdateWhere(expression>?whereLamdba?expression>?updateexpression)?{?return?CurrentRepository.UpdateWhere(whereLamdba?updateexpression);?}
????????///?
????????///?刪除實體對象(假刪除)
????????///?
????????///?必須有ShanChuBiaoJi和ID字段
????????///?
????????public?bool?Delete(T?entity)?{?return?CurrentRepository.Delete(entity);?}
????????///?
????????///?刪除實體對象(假刪除)
????????///?
????????///?對象
????????///?主鍵ID值
????????///?
????????public
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-11-29?11:24??Example\
?????目錄???????????0??2016-11-29?11:25??Example\.vs\
?????目錄???????????0??2016-11-29?11:25??Example\.vs\config\
?????文件???????83460??2016-11-29?11:25??Example\.vs\config\applicationhost.config
?????目錄???????????0??2016-11-29?11:24??Example\.vs\Example\
?????目錄???????????0??2016-11-29?11:24??Example\.vs\Example\v14\
?????文件??????126464??2016-11-29?11:41??Example\.vs\Example\v14\.suo
?????目錄???????????0??2016-11-17?12:58??Example\BLL\
?????文件????????8030??2016-11-17?12:58??Example\BLL\ba
?????目錄???????????0??2016-11-17?10:40??Example\BLL\bin\
?????目錄???????????0??2016-11-17?13:11??Example\BLL\bin\Debug\
?????文件????????7168??2016-11-29?12:06??Example\BLL\bin\Debug\BLL.dll
?????文件???????26112??2016-11-29?12:06??Example\BLL\bin\Debug\BLL.pdb
?????文件???????12800??2016-11-29?12:06??Example\BLL\bin\Debug\DAL.dll
?????文件???????36352??2016-11-29?12:06??Example\BLL\bin\Debug\DAL.pdb
?????文件?????5196496??2016-11-17?10:36??Example\BLL\bin\Debug\Entityfr
?????文件??????177664??2016-11-17?11:18??Example\BLL\bin\Debug\Entityfr
?????文件??????223368??2016-11-17?11:18??Example\BLL\bin\Debug\Entityfr
?????文件?????3652961??2016-11-17?10:36??Example\BLL\bin\Debug\Entityfr
?????文件????????5632??2016-11-29?12:06??Example\BLL\bin\Debug\MODEL.dll
?????文件???????13824??2016-11-29?12:06??Example\BLL\bin\Debug\MODEL.pdb
?????目錄???????????0??2016-11-17?10:40??Example\BLL\bin\Release\
?????文件????????2875??2016-11-17?13:02??Example\BLL\BLL.csproj
?????目錄???????????0??2016-11-17?10:40??Example\BLL\obj\
?????目錄???????????0??2016-11-29?12:06??Example\BLL\obj\Debug\
?????文件????????1260??2016-11-17?13:11??Example\BLL\obj\Debug\BLL.csproj.FileListAbsolute.txt
?????文件???????27480??2016-11-29?12:06??Example\BLL\obj\Debug\BLL.csprojResolveAssemblyReference.cache
?????文件????????7168??2016-11-29?12:06??Example\BLL\obj\Debug\BLL.dll
?????文件???????26112??2016-11-29?12:06??Example\BLL\obj\Debug\BLL.pdb
?????文件????????6798??2016-11-29?11:25??Example\BLL\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件???????????0??2016-11-17?10:40??Example\BLL\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
............此處省略719個文件信息
評論
共有 條評論