baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
Executable
+7
@@ -0,0 +1,7 @@
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Domain
|
||||
{
|
||||
public abstract class Entity
|
||||
{
|
||||
}
|
||||
}
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Domain
|
||||
{
|
||||
public abstract class EntityInt64 : Entity, IEntity<Int64>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return Equals(obj as EntityInt64);
|
||||
}
|
||||
|
||||
private static bool IsTransient(EntityInt64 obj)
|
||||
{
|
||||
return obj != null && Equals(obj.Id, default(long));
|
||||
}
|
||||
|
||||
private Type GetUnproxiedType()
|
||||
{
|
||||
return GetType();
|
||||
}
|
||||
|
||||
public virtual bool Equals(EntityInt64 other)
|
||||
{
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
if (ReferenceEquals(this, other))
|
||||
return true;
|
||||
|
||||
if (!IsTransient(this) &&
|
||||
!IsTransient(other) &&
|
||||
Equals(Id, other.Id))
|
||||
{
|
||||
var otherType = other.GetUnproxiedType();
|
||||
var thisType = GetUnproxiedType();
|
||||
return thisType.IsAssignableFrom(otherType) ||
|
||||
otherType.IsAssignableFrom(thisType);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
if (Equals(Id, default(long)))
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
return Id.GetHashCode();
|
||||
}
|
||||
|
||||
public static bool operator ==(EntityInt64 x, EntityInt64 y)
|
||||
{
|
||||
return Equals(x, y);
|
||||
}
|
||||
|
||||
public static bool operator !=(EntityInt64 x, EntityInt64 y)
|
||||
{
|
||||
return !(x == y);
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
using Opsoft.NetCore.O3App.Domain.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Domain
|
||||
{
|
||||
public interface IBaseRepository<TEntity> where TEntity : Entity
|
||||
{
|
||||
Task<long> AddAsync(TEntity entity);
|
||||
Task<long> AddAsync(IEnumerable<TEntity> entities);
|
||||
Task<bool> UpdateAsync(TEntity entity);
|
||||
Task<bool> UpdateAsync(IEnumerable<TEntity> entities);
|
||||
Task<List<TEntity>> QueryAsync(string sql, object parameters = null, bool isReadDb = false);
|
||||
Task<PageResult<TEntity>> PagingQueryAsync<TPagingRequest>(string sql, TPagingRequest parameters, bool isReadDb = false) where TPagingRequest : PagingQueryRequest;
|
||||
Task<TEntity> QueryFirstAsync(string sql, object parameters = null, bool isReadDb = false);
|
||||
Task<T> ExecuteScalarAsync<T>(string sql, object parameters = null);
|
||||
Task<TEntity> GetByIdAsync(long id);
|
||||
Task<TEntity> GetByGuidAsync(string guid);
|
||||
}
|
||||
}
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Domain
|
||||
{
|
||||
public interface IDapperContext : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates if transaction is started.
|
||||
/// </summary>
|
||||
bool IsTransactionStarted { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Begins transaction.
|
||||
/// </summary>
|
||||
void BeginTransaction();
|
||||
|
||||
/// <summary>
|
||||
/// Commits operations of transaction.
|
||||
/// </summary>
|
||||
void Commit();
|
||||
|
||||
/// <summary>
|
||||
/// Rollbacks operations of transaction.
|
||||
/// </summary>
|
||||
void Rollback();
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Domain
|
||||
{
|
||||
public interface IDapperContextFactory
|
||||
{
|
||||
IDapperContext Create(string dbName = Shared.Constants.DatabaseNames.Default, bool @readonly = false);
|
||||
}
|
||||
}
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Domain
|
||||
{
|
||||
public interface IDapperUnitOfWork : IDisposable
|
||||
{
|
||||
void SaveChanges();
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Domain
|
||||
{
|
||||
public interface IDapperUnitOfWorkFactory
|
||||
{
|
||||
IDapperUnitOfWork Create(string dbName = Shared.Constants.DatabaseNames.Default, bool @readonly = false);
|
||||
}
|
||||
}
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Domain
|
||||
{
|
||||
public interface IEntity<T>
|
||||
{
|
||||
T Id { get; set; }
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using System;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Domain
|
||||
{
|
||||
public abstract class ServiceBase<TService>
|
||||
where TService : ServiceBase<TService>
|
||||
{
|
||||
protected ServiceBase(IMapper mapper, ILogger<TService> logger)
|
||||
{
|
||||
Mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
|
||||
Logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
public IMapper Mapper { get; }
|
||||
public ILogger Logger { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using System;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Domain
|
||||
{
|
||||
public abstract class ServiceBase<TService, TRepository> : ServiceBase<TService>
|
||||
where TService : ServiceBase<TService>
|
||||
where TRepository : class
|
||||
{
|
||||
protected ServiceBase(TRepository repository, IMapper mapper, ILogger<TService> logger)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
Repository = repository ?? throw new ArgumentNullException(nameof(repository));
|
||||
}
|
||||
public TRepository Repository { get; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user