Skip to content

Commit

Permalink
对象生成
Browse files Browse the repository at this point in the history
  • Loading branch information
tangxiaojun committed Jun 2, 2016
1 parent 419ec3b commit a6adcb1
Show file tree
Hide file tree
Showing 16 changed files with 1,323 additions and 53 deletions.
7 changes: 6 additions & 1 deletion EF.Web/EF.Bll/Implements/TestBll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ public T_Test Add(T_Test model)


var ss = service.Delete(p => p.Name.Trim() == "ddd");
var s = service.FindList(p => p.Name.Equals("ddd")).ToList<T_Test>();



var s = service.FindList(p => p.Name.Equals("ddd")&&p.ID==1).ToList<T_Test>();


return service.AddEntity(model);
}
}
Expand Down
36 changes: 36 additions & 0 deletions EF.Web/EF.T4/EF.T4.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,42 @@
<DesignTime>True</DesignTime>
<DependentUpon>Action.tt</DependentUpon>
</Compile>
<Compile Include="T4\业务逻辑\HW_BankDal.cs">
<DependentUpon>Action.tt</DependentUpon>
</Compile>
<Compile Include="T4\业务逻辑\HW_CategoryQuestionDal.cs">
<DependentUpon>Action.tt</DependentUpon>
</Compile>
<Compile Include="T4\业务逻辑\HW_NodeCategoryDal.cs">
<DependentUpon>Action.tt</DependentUpon>
</Compile>
<Compile Include="T4\业务逻辑\HW_NodeCategoryTjDal.cs">
<DependentUpon>Action.tt</DependentUpon>
</Compile>
<Compile Include="T4\业务逻辑\HW_ZujuanNodesDal.cs">
<DependentUpon>Action.tt</DependentUpon>
</Compile>
<Compile Include="T4\业务逻辑\TX_AnswerDal.cs">
<DependentUpon>Action.tt</DependentUpon>
</Compile>
<Compile Include="T4\业务逻辑\TX_HomeWorkDal.cs">
<DependentUpon>Action.tt</DependentUpon>
</Compile>
<Compile Include="T4\业务逻辑\TX_HomeworkQuestionDal.cs">
<DependentUpon>Action.tt</DependentUpon>
</Compile>
<Compile Include="T4\业务逻辑\TX_HomeWorkUserDal.cs">
<DependentUpon>Action.tt</DependentUpon>
</Compile>
<Compile Include="T4\业务逻辑\TX_PullingWrongDal.cs">
<DependentUpon>Action.tt</DependentUpon>
</Compile>
<Compile Include="T4\业务逻辑\TX_TencentMataDal.cs">
<DependentUpon>Action.tt</DependentUpon>
</Compile>
<Compile Include="T4\业务逻辑\T_TestDal.cs">
<DependentUpon>Action.tt</DependentUpon>
</Compile>
<Compile Include="T4\实体\Entity.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
Expand Down
101 changes: 101 additions & 0 deletions EF.Web/EF.T4/T4/业务逻辑/HW_BankDal.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@


using System;
using System.Collections.Generic;
using MY.Model;
namespace MY.BLL
{

/// <summary>
/// HW_Bank 操作类
/// </summary>
public partial class HW_BankDal
{


public static HW_Bank Select()
{
using(var context = db.Context())
{
return context.Sql(" SELECT * FROM HW_Bank WHERE ")
.QuerySingle<HW_Bank>();
}
}

public static List<HW_Bank> SelectAll()
{
return SelectAll(string.Empty);
}

public static List<HW_Bank> SelectAll(string sortExpression)
{
return SelectAll(0, 0, sortExpression);
}

public static List<HW_Bank> SelectAll(int startRowIndex, int maximumRows, string sortExpression)
{
using (var context = db.Context())
{
var select = context.Select<HW_Bank>(" * ")
.From(" HW_Bank ");

if (maximumRows > 0)
{
if (startRowIndex == 0)
startRowIndex = 1;

select.Paging(startRowIndex, maximumRows);
}

if (!string.IsNullOrEmpty(sortExpression))
select.OrderBy(sortExpression);

return select.QueryMany();
}
}

public static int CountAll()
{
using (var context = db.Context())
{
return context.Sql(" SELECT COUNT(*) FROM HW_Bank ")
.QuerySingle<int>();
}
}


public static bool Insert(HW_Bank hW_Bank)
{
using (var context =db.Context())
{
return context.Insert<HW_Bank>("HW_Bank", hW_Bank)
.Execute() > 0;
}
}
public static bool Update(HW_Bank hW_Bank)
{
using (var context = db.Context())
{
return context.Update<HW_Bank>("HW_Bank", hW_Bank)
.AutoMap(x => )
.Execute() > 0;
}
}

public static bool Delete(HW_Bank hW_Bank)
{
return Delete();
}

public static bool Delete()
{
using (var context = db.Context())
{
return context.Sql(" DELETE FROM Product WHERE ")
.Execute() > 0;
}
}
}

}

101 changes: 101 additions & 0 deletions EF.Web/EF.T4/T4/业务逻辑/HW_CategoryQuestionDal.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@


using System;
using System.Collections.Generic;
using MY.Model;
namespace MY.BLL
{

/// <summary>
/// HW_CategoryQuestion 操作类
/// </summary>
public partial class HW_CategoryQuestionDal
{


public static HW_CategoryQuestion Select()
{
using(var context = db.Context())
{
return context.Sql(" SELECT * FROM HW_CategoryQuestion WHERE ")
.QuerySingle<HW_CategoryQuestion>();
}
}

public static List<HW_CategoryQuestion> SelectAll()
{
return SelectAll(string.Empty);
}

public static List<HW_CategoryQuestion> SelectAll(string sortExpression)
{
return SelectAll(0, 0, sortExpression);
}

public static List<HW_CategoryQuestion> SelectAll(int startRowIndex, int maximumRows, string sortExpression)
{
using (var context = db.Context())
{
var select = context.Select<HW_CategoryQuestion>(" * ")
.From(" HW_CategoryQuestion ");

if (maximumRows > 0)
{
if (startRowIndex == 0)
startRowIndex = 1;

select.Paging(startRowIndex, maximumRows);
}

if (!string.IsNullOrEmpty(sortExpression))
select.OrderBy(sortExpression);

return select.QueryMany();
}
}

public static int CountAll()
{
using (var context = db.Context())
{
return context.Sql(" SELECT COUNT(*) FROM HW_CategoryQuestion ")
.QuerySingle<int>();
}
}


public static bool Insert(HW_CategoryQuestion hW_CategoryQuestion)
{
using (var context =db.Context())
{
return context.Insert<HW_CategoryQuestion>("HW_CategoryQuestion", hW_CategoryQuestion)
.Execute() > 0;
}
}
public static bool Update(HW_CategoryQuestion hW_CategoryQuestion)
{
using (var context = db.Context())
{
return context.Update<HW_CategoryQuestion>("HW_CategoryQuestion", hW_CategoryQuestion)
.AutoMap(x => )
.Execute() > 0;
}
}

public static bool Delete(HW_CategoryQuestion hW_CategoryQuestion)
{
return Delete();
}

public static bool Delete()
{
using (var context = db.Context())
{
return context.Sql(" DELETE FROM Product WHERE ")
.Execute() > 0;
}
}
}

}

101 changes: 101 additions & 0 deletions EF.Web/EF.T4/T4/业务逻辑/HW_NodeCategoryDal.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@


using System;
using System.Collections.Generic;
using MY.Model;
namespace MY.BLL
{

/// <summary>
/// HW_NodeCategory 操作类
/// </summary>
public partial class HW_NodeCategoryDal
{


public static HW_NodeCategory Select()
{
using(var context = db.Context())
{
return context.Sql(" SELECT * FROM HW_NodeCategory WHERE ")
.QuerySingle<HW_NodeCategory>();
}
}

public static List<HW_NodeCategory> SelectAll()
{
return SelectAll(string.Empty);
}

public static List<HW_NodeCategory> SelectAll(string sortExpression)
{
return SelectAll(0, 0, sortExpression);
}

public static List<HW_NodeCategory> SelectAll(int startRowIndex, int maximumRows, string sortExpression)
{
using (var context = db.Context())
{
var select = context.Select<HW_NodeCategory>(" * ")
.From(" HW_NodeCategory ");

if (maximumRows > 0)
{
if (startRowIndex == 0)
startRowIndex = 1;

select.Paging(startRowIndex, maximumRows);
}

if (!string.IsNullOrEmpty(sortExpression))
select.OrderBy(sortExpression);

return select.QueryMany();
}
}

public static int CountAll()
{
using (var context = db.Context())
{
return context.Sql(" SELECT COUNT(*) FROM HW_NodeCategory ")
.QuerySingle<int>();
}
}


public static bool Insert(HW_NodeCategory hW_NodeCategory)
{
using (var context =db.Context())
{
return context.Insert<HW_NodeCategory>("HW_NodeCategory", hW_NodeCategory)
.Execute() > 0;
}
}
public static bool Update(HW_NodeCategory hW_NodeCategory)
{
using (var context = db.Context())
{
return context.Update<HW_NodeCategory>("HW_NodeCategory", hW_NodeCategory)
.AutoMap(x => )
.Execute() > 0;
}
}

public static bool Delete(HW_NodeCategory hW_NodeCategory)
{
return Delete();
}

public static bool Delete()
{
using (var context = db.Context())
{
return context.Sql(" DELETE FROM Product WHERE ")
.Execute() > 0;
}
}
}

}

Loading

0 comments on commit a6adcb1

Please sign in to comment.