v3.0.0
v3.0.0
This commit is contained in:
32
CC.Yi/CC.Yi.IBLL/CC.Yi.IBLL.csproj
Normal file
32
CC.Yi/CC.Yi.IBLL/CC.Yi.IBLL.csproj
Normal file
@@ -0,0 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CC.Yi.Common\CC.Yi.Common.csproj" />
|
||||
<ProjectReference Include="..\CC.Yi.Model\CC.Yi.Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="T4IBLL.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>T4IBLL.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="T4IBLL.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>T4IBLL.tt</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
76
CC.Yi/CC.Yi.IBLL/IBaseBll.cs
Normal file
76
CC.Yi/CC.Yi.IBLL/IBaseBll.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using Autofac.Extras.DynamicProxy;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace CC.Yi.IBLL
|
||||
{
|
||||
public interface IBaseBll<T> where T : class, new()
|
||||
{
|
||||
#region
|
||||
//得到全部实体
|
||||
#endregion
|
||||
IQueryable<T> GetAllEntities();
|
||||
|
||||
#region
|
||||
//通过表达式得到实体
|
||||
#endregion
|
||||
IQueryable<T> GetEntities(Expression<Func<T, bool>> whereLambda);
|
||||
|
||||
#region
|
||||
//通过表达式得到实体,分页版本
|
||||
#endregion
|
||||
IQueryable<T> GetPageEntities<S>(int pageSize, int pageIndex, out int total, Expression<Func<T, bool>> whereLambda, Expression<Func<T, S>> orderByLambda, bool isAsc);
|
||||
|
||||
#region
|
||||
//通过表达式统计数量
|
||||
#endregion
|
||||
int GetCount(Expression<Func<T, bool>> whereLambda);
|
||||
|
||||
#region
|
||||
//通过表达式分组
|
||||
#endregion
|
||||
IQueryable<IGrouping<S, T>> GetGroup<S>(Expression<Func<T, bool>> whereLambda, Expression<Func<T, S>> groupByLambda);
|
||||
|
||||
#region
|
||||
//添加实体
|
||||
#endregion
|
||||
T Add(T entity);
|
||||
|
||||
#region
|
||||
//添加多个实体
|
||||
#endregion
|
||||
bool Add(IEnumerable<T> entities);
|
||||
|
||||
#region
|
||||
//更新实体
|
||||
#endregion
|
||||
bool Update(T entity);
|
||||
|
||||
#region
|
||||
//更新实体部分属性
|
||||
#endregion
|
||||
bool Update(T entity, params string[] propertyNames);
|
||||
|
||||
#region
|
||||
//删除实体
|
||||
#endregion
|
||||
bool Delete(T entity);
|
||||
|
||||
#region
|
||||
//通过id删除实体
|
||||
#endregion
|
||||
bool Delete(int id);
|
||||
|
||||
#region
|
||||
//通过id列表删除多个实体
|
||||
#endregion
|
||||
bool Delete(IEnumerable<int> ids);
|
||||
|
||||
#region
|
||||
//通过表达式删除实体
|
||||
#endregion
|
||||
bool Delete(Expression<Func<T, bool>> where);
|
||||
}
|
||||
}
|
||||
14
CC.Yi/CC.Yi.IBLL/T4IBLL.cs
Normal file
14
CC.Yi/CC.Yi.IBLL/T4IBLL.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using CC.Yi.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CC.Yi.IBLL
|
||||
{
|
||||
public partial interface IstudentBll : IBaseBll<student>
|
||||
{
|
||||
}
|
||||
public partial interface IpropBll : IBaseBll<prop>
|
||||
{
|
||||
}
|
||||
}
|
||||
29
CC.Yi/CC.Yi.IBLL/T4IBLL.tt
Normal file
29
CC.Yi/CC.Yi.IBLL/T4IBLL.tt
Normal file
@@ -0,0 +1,29 @@
|
||||
<#@ template debug="false" hostspecific="true" language="C#" #>
|
||||
<#@ assembly name="System.Core" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Text" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ import namespace="System.IO" #>
|
||||
<#@ output extension=".cs" #>
|
||||
<#
|
||||
string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径
|
||||
string txt;
|
||||
StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt");
|
||||
txt=sr.ReadToEnd();
|
||||
sr.Close();
|
||||
string[] ModelData= txt.Split(',');
|
||||
#>
|
||||
using CC.Yi.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CC.Yi.IBLL
|
||||
{
|
||||
<# foreach(string k in ModelData){
|
||||
#>
|
||||
public partial interface I<#=k #>Bll : IBaseBll<<#=k #>>
|
||||
{
|
||||
}
|
||||
<# } #>
|
||||
}
|
||||
Reference in New Issue
Block a user