删除workflowengine.net

This commit is contained in:
yubaolee
2017-01-20 17:49:45 +08:00
parent b46729b31d
commit b9a849e3ea
33 changed files with 204 additions and 1427 deletions

View File

@@ -1,62 +0,0 @@
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a CodeSmith Template.
//
// DO NOT MODIFY contents of this file. Changes to this
// file will be lost if the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
using System.ComponentModel.DataAnnotations.Schema;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public partial class ApplyTransitionHistoryMap
: System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<ApplyTransitionHistory>
{
public ApplyTransitionHistoryMap()
{
// table
ToTable("ApplyTransitionHistory", "dbo");
// keys
HasKey(t => t.Id);
// Properties
Property(t => t.Id)
.HasColumnName("Id")
.IsRequired();
Property(t => t.ApplyId)
.HasColumnName("ApplyId")
.IsRequired();
Property(t => t.UserId)
.HasColumnName("UserId")
.IsOptional();
Property(t => t.AllowedToUserNames)
.HasColumnName("AllowedToUserNames")
.IsRequired();
Property(t => t.TransitionTime)
.HasColumnName("TransitionTime")
.IsOptional();
Property(t => t.Order)
.HasColumnName("Order")
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
.IsRequired();
Property(t => t.InitialState)
.HasColumnName("InitialState")
.HasMaxLength(1024)
.IsRequired();
Property(t => t.DestinationState)
.HasColumnName("DestinationState")
.HasMaxLength(1024)
.IsRequired();
Property(t => t.Command)
.HasColumnName("Command")
.HasMaxLength(1024)
.IsRequired();
// Relationships
}
}
}

View File

@@ -27,7 +27,6 @@ namespace OpenAuth.Repository.Models
: base(nameOrConnectionString)
{ }
public System.Data.Entity.DbSet<ApplyTransitionHistory> ApplyTransitionHistories { get; set; }
public System.Data.Entity.DbSet<Category> Categories { get; set; }
public System.Data.Entity.DbSet<DicDetail> DicDetails { get; set; }
public System.Data.Entity.DbSet<DicIndex> DicIndices { get; set; }
@@ -49,7 +48,6 @@ namespace OpenAuth.Repository.Models
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new ApplyTransitionHistoryMap());
modelBuilder.Configurations.Add(new CategoryMap());
modelBuilder.Configurations.Add(new DicDetailMap());
modelBuilder.Configurations.Add(new DicIndexMap());

View File

@@ -55,8 +55,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Models\Mapping\ApplyTransitionHistoryMap.cs" />
<Compile Include="Models\Mapping\CommonApplyMap.cs" />
<Compile Include="Models\Mapping\WFFrmMainMap.cs" />
<Compile Include="Models\Mapping\WFProcessInstanceMap.cs" />
<Compile Include="Models\Mapping\WFProcessOperationHistoryMap.cs" />
@@ -64,7 +62,6 @@
<Compile Include="Models\Mapping\WFProcessTransitionHistoryMap.cs" />
<Compile Include="Models\Mapping\WFSchemeContentMap.cs" />
<Compile Include="Models\Mapping\WFSchemeInfoMap.cs" />
<Compile Include="Workflow\Mapping\WorkflowSchemeMap.cs" />
<Compile Include="UnitWork.cs" />
<Compile Include="BaseRepository.cs" />
<Compile Include="Models\Mapping\CategoryMap.cs" />
@@ -88,9 +85,6 @@
<Compile Include="StockRepository.cs" />
<Compile Include="UserRepository.cs" />
<Compile Include="RelevanceRepository.cs" />
<Compile Include="Workflow\WorkflowSchemeRepository.cs" />
<Compile Include="Workflow\WorkflowBaseRepository.cs" />
<Compile Include="Workflow\WorkflowContext.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj">

View File

@@ -1,37 +0,0 @@
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a CodeSmith Template.
//
// DO NOT MODIFY contents of this file. Changes to this
// file will be lost if the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
using OpenAuth.Domain;
namespace OpenAuth.Repository.Workflow.Mapping
{
public partial class WorkflowSchemeMap
: System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<WorkflowScheme>
{
public WorkflowSchemeMap()
{
// table
ToTable("WorkflowScheme", "dbo");
// keys
HasKey(t => t.Code);
// Properties
Property(t => t.Code)
.HasColumnName("Code")
.HasMaxLength(256)
.IsRequired();
Property(t => t.Scheme)
.HasColumnName("Scheme")
.IsRequired();
// Relationships
}
}
}

View File

@@ -1,134 +0,0 @@
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Linq.Expressions;
using EntityFramework.Extensions;
using Infrastructure;
using OpenAuth.Domain.Interface;
namespace OpenAuth.Repository.Workflow
{
public class WorkflowBaseRepository<T> :IRepository<T> where T:class
{
protected WorkflowContext Context = new WorkflowContext();
/// <summary>
/// 根据过滤条件,获取记录
/// </summary>
/// <param name="exp">The exp.</param>
public IQueryable<T> Find(Expression<Func<T, bool>> exp = null)
{
return Filter(exp);
}
public bool IsExist(Expression<Func<T, bool>> exp)
{
return Context.Set<T>().Any(exp);
}
/// <summary>
/// 查找单个
/// </summary>
public T FindSingle(Expression<Func<T, bool>> exp)
{
return Context.Set<T>().AsNoTracking().FirstOrDefault(exp);
}
/// <summary>
/// 得到分页记录
/// </summary>
/// <param name="pageindex">The pageindex.</param>
/// <param name="pagesize">The pagesize.</param>
/// <param name="orderby">排序,格式如:"Id"/"Id descending"</param>
public IQueryable<T> Find(int pageindex, int pagesize, string orderby = "", Expression<Func<T, bool>> exp = null)
{
if (pageindex < 1) pageindex = 1;
if (string.IsNullOrEmpty(orderby))
orderby = "Id descending";
return Filter(exp).OrderBy(orderby).Skip(pagesize * (pageindex - 1)).Take(pagesize);
}
/// <summary>
/// 根据过滤条件获取记录数
/// </summary>
public int GetCount(Expression<Func<T, bool>> exp = null)
{
return Filter(exp).Count();
}
public void Add(T entity)
{
Context.Set<T>().Add(entity);
Save();
}
/// <summary>
/// 批量添加
/// </summary>
/// <param name="entities">The entities.</param>
public void BatchAdd(T[] entities)
{
Context.Set<T>().AddRange(entities);
Save();
}
public void Update(T entity)
{
var entry = this.Context.Entry(entity);
//todo:如果状态没有任何更改,会报错
entry.State = EntityState.Modified;
Save();
}
public void Delete(T entity)
{
Context.Set<T>().Remove(entity);
Save();
}
/// <summary>
/// 按指定id更新实体,会更新整个实体
/// </summary>
/// <param name="identityExp">The identity exp.</param>
/// <param name="entity">The entity.</param>
public void Update(Expression<Func<T, object>> identityExp, T entity)
{
Context.Set<T>().AddOrUpdate(identityExp, entity);
Save();
}
/// <summary>
/// 实现按需要只更新部分更新
/// <para>如Update(u =>u.Id==1,u =>new User{Name="ok"});</para>
/// </summary>
/// <param name="where">The where.</param>
/// <param name="entity">The entity.</param>
public void Update(Expression<Func<T, bool>> where, Expression<Func<T, T>> entity)
{
Context.Set<T>().Where(where).Update(entity);
}
public virtual void Delete(Expression<Func<T, bool>> exp)
{
Context.Set<T>().Where(exp).Delete();
}
public void Save()
{
Context.SaveChanges();
}
private IQueryable<T> Filter(Expression<Func<T, bool>> exp)
{
var dbSet = Context.Set<T>().AsQueryable();
if (exp != null)
dbSet = dbSet.Where(exp);
return dbSet;
}
}
}

View File

@@ -1,41 +0,0 @@
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a CodeSmith Template.
//
// DO NOT MODIFY contents of this file. Changes to this
// file will be lost if the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
using System.Data.Entity;
using OpenAuth.Domain;
using OpenAuth.Repository.Models;
using OpenAuth.Repository.Models.Mapping;
using OpenAuth.Repository.Workflow.Mapping;
namespace OpenAuth.Repository.Workflow
{
public partial class WorkflowContext: DbContext
{
static WorkflowContext()
{
Database.SetInitializer< OpenAuthDBContext>(null);
}
public WorkflowContext()
:base("Name=WorkFlow")
{ }
public WorkflowContext(string nameOrConnectionString)
: base(nameOrConnectionString)
{ }
public System.Data.Entity.DbSet<WorkflowScheme> WorkflowSchemes { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new WorkflowSchemeMap());
}
}
}

View File

@@ -1,11 +0,0 @@
using OpenAuth.Domain;
using OpenAuth.Domain.Interface;
namespace OpenAuth.Repository.Workflow
{
public class WorkflowSchemeRepository:WorkflowBaseRepository<WorkflowScheme>,IWorkflowSchemeRepository
{
}
}