Commit 42bb457c authored by 阿星Plus's avatar 阿星Plus

添加啊代码注释

parent 1a86b42b
......@@ -5,12 +5,12 @@ using System.Text;
namespace Plus
{
/// <summary>
/// Action Output
/// 输出
/// </summary>
public class ActionOutput
{
/// <summary>
/// Errors List
/// 错误列表
/// </summary>
public IList<string> Errors { get; }
......@@ -20,7 +20,7 @@ namespace Plus
public bool Success => Errors.Count == 0;
/// <summary>
/// Exception
/// 异常
/// </summary>
public Exception Exception { get; set; }
......
namespace Plus
{
/// <summary>
/// Action Output <see cref="T"/>
/// 输出 <see cref="T"/>
/// </summary>
/// <typeparam name="T"></typeparam>
public class ActionOutput<T> : ActionOutput
{
/// <summary>
/// <see cref="Result"/>
/// 返回结果
/// </summary>
public T Result { get; set; }
}
......
......@@ -3,10 +3,12 @@ using System;
namespace Plus.Aspects
{
/// <summary>
/// PlusCrossCuttingConcerns
/// </summary>
internal class PlusCrossCuttingConcerns
{
public const string Validation = "PlusValidation";
public const string UnitOfWork = "PlusUnitOfWork";
public static void AddApplied(object obj, params string[] concerns)
......
......@@ -3,17 +3,37 @@ using System.Collections.Generic;
namespace Plus.Collections
{
/// <summary>
/// A shortcut for <see cref="ITypeList{TBaseType}"/> to use object as base type.
/// </summary>
public interface ITypeList : ITypeList<object>
{
}
/// <summary>
/// Extends <see cref="IList{Type}"/> to add restriction a specific base type.
/// </summary>
/// <typeparam name="TBaseType"></typeparam>
public interface ITypeList<in TBaseType> : IList<Type>
{
/// <summary>
/// Adds a type to list.
/// </summary>
/// <typeparam name="T"></typeparam>
void Add<T>() where T : TBaseType;
/// <summary>
/// Checks if a type exists in the list.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
bool Contains<T>() where T : TBaseType;
/// <summary>
/// Removes a type from list
/// </summary>
/// <typeparam name="T"></typeparam>
void Remove<T>() where T : TBaseType;
}
}
\ No newline at end of file
......@@ -5,16 +5,34 @@ using System.Reflection;
namespace Plus.Collections
{
/// <summary>
/// A shortcut for <see cref="TypeList{TBaseType}"/> to use object as base type
/// </summary>
public class TypeList : TypeList<object>, ITypeList
{
}
/// <summary>
/// Extends <see cref="List{Type}"/> to add restriction a specific base type.
/// </summary>
/// <typeparam name="TBaseType"></typeparam>
public class TypeList<TBaseType> : ITypeList<TBaseType>
{
/// <summary>
/// Gets the count.
/// </summary>
public int Count { get { return _typeList.Count; } }
/// <summary>
/// Gets a value indicating whether this instance is read only.
/// </summary>
public bool IsReadOnly { get { return false; } }
/// <summary>
/// Gets or sets the <see cref="Type"/> at the specified index.
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public Type this[int index]
{
get { return _typeList[index]; }
......@@ -27,6 +45,9 @@ namespace Plus.Collections
private readonly List<Type> _typeList;
/// <summary>
/// Creates a new <see cref="TypeList{T}"/> object.
/// </summary>
public TypeList()
{
_typeList = new List<Type>();
......
......@@ -3,13 +3,12 @@ using System.Collections.Generic;
namespace Plus.Configuration
{
/// <summary>
/// 用于设置/获取 自定义配置
/// </summary>
public class DictionaryBasedConfig : IDictionaryBasedConfig
{
protected Dictionary<string, object> CustomSettings
{
get;
private set;
}
protected Dictionary<string, object> CustomSettings { get; private set; }
public object this[string name]
{
......
......@@ -2,6 +2,9 @@
namespace Plus.Configuration
{
/// <summary>
/// 字典配置接口
/// </summary>
public interface IDictionaryBasedConfig
{
void Set<T>(string name, T value);
......
namespace Plus.Configuration.Startup
{
/// <summary>
/// EventBusConfiguration
/// </summary>
internal class EventBusConfiguration : IEventBusConfiguration
{
public bool UseDefaultEventBus { get; set; }
......
using Plus.Dependency;
using Plus.Domain.Uow;
using Plus.Runtime.Caching.Configuration;
using System;
namespace Plus.Configuration.Startup
......@@ -27,19 +29,19 @@ namespace Plus.Configuration.Startup
/// <returns></returns>
T Get<T>();
//IUnitOfWorkDefaultOptions UnitOfWork
//{
// get;
//}
/// <summary>
/// 用于配置工作单元
/// </summary>
IUnitOfWorkDefaultOptions UnitOfWork { get; }
//ICachingConfiguration Caching
//{
// get;
//}
/// <summary>
/// 用于配置缓存
/// </summary>
ICachingConfiguration Caching { get; }
//IValidationConfiguration Validation
//{
// get;
//}
/// <summary>
/// 用于配置验证
/// </summary>
IValidationConfiguration Validation { get; }
}
}
\ No newline at end of file
......@@ -5,6 +5,9 @@ using System.Collections.Generic;
namespace Plus.Configuration.Startup
{
/// <summary>
/// IValidationConfiguration
/// </summary>
public interface IValidationConfiguration
{
List<Type> IgnoredTypes { get; }
......
using Plus.Dependency;
using Plus.Domain.Uow;
using Plus.Runtime.Caching.Configuration;
using System;
using System.Collections.Generic;
namespace Plus.Configuration.Startup
{
/// <summary>
/// 该类用于在启动时配置模块
/// </summary>
public class PlusStartupConfiguration : DictionaryBasedConfig, IPlusStartupConfiguration, IDictionaryBasedConfig
{
public IIocManager IocManager
{
get;
private set;
}
public IIocManager IocManager { get; private set; }
public Dictionary<Type, Action> ServiceReplaceActions
{
get;
private set;
}
public Dictionary<Type, Action> ServiceReplaceActions { get; private set; }
public IUnitOfWorkDefaultOptions UnitOfWork { get; private set; }
public ICachingConfiguration Caching { get; private set; }
public IValidationConfiguration Validation { get; private set; }
public PlusStartupConfiguration(IIocManager iocManager)
{
......@@ -25,6 +28,9 @@ namespace Plus.Configuration.Startup
public void Initialize()
{
UnitOfWork = IocManager.Resolve<IUnitOfWorkDefaultOptions>();
Caching = IocManager.Resolve<ICachingConfiguration>();
Validation = IocManager.Resolve<IValidationConfiguration>();
ServiceReplaceActions = new Dictionary<Type, Action>();
}
......
......@@ -5,17 +5,14 @@ using System.Collections.Generic;
namespace Plus.Configuration.Startup
{
/// <summary>
/// ValidationConfiguration
/// </summary>
public class ValidationConfiguration : IValidationConfiguration
{
public List<Type> IgnoredTypes
{
get;
}
public List<Type> IgnoredTypes { get; }
public ITypeList<IMethodParameterValidator> Validators
{
get;
}
public ITypeList<IMethodParameterValidator> Validators { get; }
public ValidationConfiguration()
{
......
namespace Plus.Dependency
{
/// <summary>
/// DisposableDependencyObjectWrapper
/// </summary>
internal class DisposableDependencyObjectWrapper : DisposableDependencyObjectWrapper<object>, IDisposableDependencyObjectWrapper
{
public DisposableDependencyObjectWrapper(IIocResolver iocResolver, object obj)
......
......@@ -2,6 +2,10 @@
namespace Plus.Dependency
{
/// <summary>
/// DisposableDependencyObjectWrapper
/// </summary>
/// <typeparam name="T"></typeparam>
internal class DisposableDependencyObjectWrapper<T> : IDisposableDependencyObjectWrapper<T>, IDisposable
{
private readonly IIocResolver _iocResolver;
......
namespace Plus.Dependency
{
/// <summary>
/// IDependencyRegistrar
/// </summary>
public interface IDependencyRegistrar
{
void RegisterAssembly(IRegistrationContext context);
......
......@@ -2,6 +2,9 @@
namespace Plus.Dependency
{
/// <summary>
/// IRegistrationContext
/// </summary>
public interface IRegistrationContext
{
Assembly Assembly { get; }
......
namespace Plus.Dependency
{
/// <summary>
/// 所有实现此接口的类都自动注册到依赖项注入作为 SingletonDependency
/// </summary>
public interface ISingletonDependency
{
......
namespace Plus.Dependency
{
/// <summary>
/// 所有实现此接口的类都自动注册到依赖项注入作为 TransientDependency
/// </summary>
public interface ITransientDependency
{
......
......@@ -9,6 +9,9 @@ using Plus.Runtime.Caching.Configuration;
namespace Plus.Dependency.Installers
{
/// <summary>
/// PlusCoreInstaller
/// </summary>
internal class PlusCoreInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
......
......@@ -7,6 +7,9 @@ using System.Reflection;
namespace Plus.Dependency
{
/// <summary>
/// 该类用于直接执行依赖项注入任务
/// </summary>
public class IocManager : IIocManager, IIocRegistrar, IIocResolver, IDisposable
{
private readonly List<IDependencyRegistrar> _conventionalRegistrars;
......
......@@ -2,6 +2,9 @@
namespace Plus.Dependency
{
/// <summary>
/// <see cref="IIocResolver"/> 扩展方法
/// </summary>
public static class IocResolverExtensions
{
public static IDisposableDependencyObjectWrapper<T> ResolveAsDisposable<T>(this IIocResolver iocResolver)
......
......@@ -2,6 +2,9 @@
namespace Plus.Dependency
{
/// <summary>
/// RegistrationContext
/// </summary>
internal class RegistrationContext : IRegistrationContext
{
/// <summary>
......@@ -15,7 +18,7 @@ namespace Plus.Dependency
public IIocManager IocManager { get; private set; }
/// <summary>
///
/// Registration configuration.
/// </summary>
/// <param name="assembly"></param>
/// <param name="iocManager"></param>
......
......@@ -3,12 +3,19 @@ using System.Collections.Generic;
namespace Plus.Domain.Entities
{
/// <summary>
/// Entity
/// </summary>
[Serializable]
public abstract class Entity : Entity<int>, IEntity
{
}
/// <summary>
/// Entity
/// </summary>
/// <typeparam name="TPrimaryKey"></typeparam>
[Serializable]
public abstract class Entity<TPrimaryKey> : IEntity<TPrimaryKey>
{
......
......@@ -3,6 +3,9 @@ using System.Runtime.Serialization;
namespace Plus.Domain.Entities
{
/// <summary>
/// EntityNotFoundException
/// </summary>
[Serializable]
public class EntityNotFoundException : PlusException
{
......
namespace Plus.Domain.Entities
{
/// <summary>
/// IEntity
/// </summary>
public interface IEntity : IEntity<int>
{
......
namespace Plus.Domain.Entities
{
/// <summary>
/// Defines interface for base entity type. All entities in the system must implement this interface.
/// 为基本实体类型定义接口,系统中的所有实体都必须实现此接口
/// </summary>
/// <typeparam name="TPrimaryKey">Type of the primary key of the entity</typeparam>
/// <typeparam name="TPrimaryKey">主键类型</typeparam>
public interface IEntity<TPrimaryKey>
{
/// <summary>
/// Unique identifier for this entity.
/// 主键
/// </summary>
TPrimaryKey Id { get; set; }
/// <summary>
/// Checks if this entity is transient (not persisted to database and it has not an <see cref="Id"/>).
/// True => transient
/// </summary>
/// <returns>True, if this entity is transient</returns>
/// <returns></returns>
bool IsTransient();
}
}
\ No newline at end of file
......@@ -8,10 +8,10 @@ using System.Threading.Tasks;
namespace Plus.Domain.Repositories
{
/// <summary>
/// This interface is implemented by all repositories to ensure implementation of fixed methods.
/// 仓储接口
/// </summary>
/// <typeparam name="TEntity">Main Entity type this repository works on</typeparam>
/// <typeparam name="TPrimaryKey">Primary key type of the entity</typeparam>
/// <typeparam name="TEntity"></typeparam>
/// <typeparam name="TPrimaryKey"></typeparam>
public interface IRepository<TEntity, TPrimaryKey> : IRepository where TEntity : class, IEntity<TPrimaryKey>
{
#region Select/Get/Query
......
......@@ -7,6 +7,11 @@ using System.Threading.Tasks;
namespace Plus.Domain.Repositories
{
/// <summary>
/// ISupportsExplicitLoading
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <typeparam name="TPrimaryKey"></typeparam>
public interface ISupportsExplicitLoading<TEntity, TPrimaryKey> where TEntity : class, IEntity<TPrimaryKey>
{
Task EnsureCollectionLoadedAsync<TProperty>(TEntity entity, Expression<Func<TEntity, IEnumerable<TProperty>>> collectionExpression, CancellationToken cancellationToken) where TProperty : class;
......
namespace Plus.Domain.Repositories
{
/// <summary>
/// UnitOfWorkExtensionDataTypes
/// </summary>
internal class UnitOfWorkExtensionDataTypes
{
public static string HardDelete { get; } = "HardDelete";
......
......@@ -2,6 +2,9 @@
namespace Plus.Domain.Uow
{
/// <summary>
/// DataFilterConfiguration
/// </summary>
public class DataFilterConfiguration
{
public string FilterName { get; }
......
namespace Plus.Domain.Uow
{
/// <summary>
/// IUnitOfWorkFilterExecuter
/// </summary>
public interface IUnitOfWorkFilterExecuter
{
void ApplyDisableFilter(IUnitOfWork unitOfWork, string filterName);
......
......@@ -6,6 +6,9 @@ using System.Transactions;
namespace Plus.Domain.Uow
{
/// <summary>
/// UnitOfWorkDefaultOptions
/// </summary>
internal class UnitOfWorkDefaultOptions : IUnitOfWorkDefaultOptions
{
public TransactionScopeOption Scope { get; set; }
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Plus.Domain.Uow
{
/// <summary>
/// UnitOfWorkDefaultOptionsExtensions
/// </summary>
internal static class UnitOfWorkDefaultOptionsExtensions
{
public static UnitOfWorkAttribute GetUnitOfWorkAttributeOrNull(this IUnitOfWorkDefaultOptions unitOfWorkDefaultOptions, MethodInfo methodInfo)
......@@ -24,7 +25,7 @@ namespace Plus.Domain.Uow
if (unitOfWorkDefaultOptions.IsConventionalUowClass(methodInfo.DeclaringType))
{
return new UnitOfWorkAttribute(); //Default
return new UnitOfWorkAttribute();
}
return null;
......
......@@ -90,7 +90,7 @@ namespace Plus.Domain.Uow
exception => uow.Dispose()
);
}
else //Task<TResult>
else
{
invocation.ReturnValue = InternalAsyncHelper.CallAwaitTaskWithPostActionAndFinallyAndGetResult(
invocation.Method.ReturnType.GenericTypeArguments[0],
......
......@@ -54,8 +54,6 @@ namespace Plus.Domain.Uow
internal void FillDefaultsForNonProvidedOptions(IUnitOfWorkDefaultOptions defaultOptions)
{
//TODO: Do not change options object..?
if (!IsTransactional.HasValue)
{
IsTransactional = defaultOptions.IsTransactional;
......
......@@ -6,12 +6,11 @@ using System.Reflection;
namespace Plus.Domain.Uow
{
internal static class UnitOfWorkRegistrar
{
/// <summary>
/// Initializes the registerer.
/// UnitOfWorkRegistrar
/// </summary>
/// <param name="iocManager">IOC manager</param>
internal static class UnitOfWorkRegistrar
{
public static void Initialize(IIocManager iocManager)
{
iocManager.IocContainer.Kernel.ComponentRegistered += (key, handler) =>
......
......@@ -4,6 +4,9 @@ using System;
namespace Plus.Event.Bus.Factories
{
/// <summary>
/// IocHandlerFactory
/// </summary>
public class IocHandlerFactory : IEventHandlerFactory
{
private readonly IIocResolver _iocResolver;
......
......@@ -4,6 +4,9 @@ using System.Threading.Tasks;
namespace Plus
{
/// <summary>
/// InternalAsyncHelper
/// </summary>
internal static class InternalAsyncHelper
{
public static async Task AwaitTaskWithFinally(Task actualReturnValue, Action<Exception> finalAction)
......
namespace Plus.Logging
{
/// <summary>
/// IHasLogSeverity
/// </summary>
public interface IHasLogSeverity
{
LogSeverity Severity { get; set; }
......
......@@ -6,6 +6,9 @@ using System.Linq;
namespace Plus.Logging
{
/// <summary>
/// 帮助类,写日志用
/// </summary>
public static class LogHelper
{
public static ILogger Logger { get; private set; }
......
namespace Plus.Logging
{
/// <summary>
/// LogSeverity
/// </summary>
public enum LogSeverity
{
Debug,
......
......@@ -3,6 +3,9 @@ using System;
namespace Plus.Logging
{
/// <summary>
/// LoggerExtensions
/// </summary>
public static class LoggerExtensions
{
public static void Log(this ILogger logger, LogSeverity severity, string message)
......
......@@ -8,6 +8,9 @@ using System.Reflection;
namespace Plus.Modules
{
/// <summary>
/// 模块
/// </summary>
public abstract class PlusModule
{
protected internal IIocManager IocManager { get; internal set; }
......
......@@ -4,6 +4,9 @@ using System.Reflection;
namespace Plus.Modules
{
/// <summary>
/// PlusModuleInfo
/// </summary>
public class PlusModuleInfo
{
public Assembly Assembly { get; }
......
......@@ -3,6 +3,9 @@ using Plus.Dependency;
namespace Plus
{
/// <summary>
/// PlusEngine
/// </summary>
public class PlusEngine
{
private bool _initialized = false;
......
......@@ -11,6 +11,9 @@ using System.Reflection;
namespace Plus
{
/// <summary>
/// PlusStarter
/// </summary>
public class PlusStarter : IDisposable
{
protected bool IsDisposed;
......
......@@ -2,6 +2,9 @@
namespace Plus
{
/// <summary>
/// PlusStarterOptions
/// </summary>
public class PlusStarterOptions
{
public IIocManager IocManager { get; set; }
......
......@@ -5,6 +5,9 @@ using System.Reflection;
namespace Plus.Reflection
{
/// <summary>
/// AssemblyFinder
/// </summary>
public class AssemblyFinder : IAssemblyFinder
{
private readonly IPlusModuleManager _moduleManager;
......
......@@ -2,6 +2,9 @@
namespace Plus.Reflection
{
/// <summary>
/// ITypeFinder
/// </summary>
public interface ITypeFinder
{
Type[] Find(Func<Type, bool> predicate);
......
......@@ -6,6 +6,9 @@ using System.Reflection;
namespace Plus.Reflection
{
/// <summary>
/// TypeFinder
/// </summary>
public class TypeFinder : ITypeFinder
{
public ILogger Logger { get; set; }
......
......@@ -2,6 +2,9 @@
namespace Plus.Runtime.Caching.Configuration
{
/// <summary>
/// CacheConfigurator
/// </summary>
internal class CacheConfigurator : ICacheConfigurator
{
public string CacheName { get; private set; }
......
......@@ -5,6 +5,9 @@ using System.Collections.Immutable;
namespace Plus.Runtime.Caching.Configuration
{
/// <summary>
/// CachingConfiguration
/// </summary>
internal class CachingConfiguration : ICachingConfiguration
{
public IPlusStartupConfiguration PlusConfiguration { get; private set; }
......
......@@ -2,6 +2,9 @@
namespace Plus.Runtime.Validation
{
/// <summary>
/// DisableValidationAttribute
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Property)]
public class DisableValidationAttribute : Attribute
{
......
......@@ -2,6 +2,9 @@
namespace Plus.Runtime.Validation
{
/// <summary>
/// EnableValidationAttribute
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public class EnableValidationAttribute : Attribute
{
......
......@@ -4,6 +4,9 @@ using System.ComponentModel.DataAnnotations;
namespace Plus.Runtime.Validation.Interception
{
/// <summary>
/// IMethodParameterValidator
/// </summary>
public interface IMethodParameterValidator : ITransientDependency
{
IReadOnlyList<ValidationResult> Validate(object validatingObject);
......
......@@ -5,7 +5,7 @@ using Plus.Dependency;
namespace Plus.Runtime.Validation.Interception
{
/// <summary>
/// 这个拦截器用于拦截类的方法调用,类的方法必须经过验证
/// 这个拦截器用于拦截类的方法调用,类的方法必须经过验证
/// </summary>
public class ValidationInterceptor : IInterceptor
{
......
......@@ -6,6 +6,9 @@ using System.Reflection;
namespace Plus.Runtime.Validation.Interception
{
/// <summary>
/// ValidationInterceptorRegistrar
/// </summary>
internal static class ValidationInterceptorRegistrar
{
public static void Initialize(IIocManager iocManager)
......
......@@ -6,6 +6,9 @@ using System.Runtime.Serialization;
namespace Plus.Runtime.Validation
{
/// <summary>
/// PlusValidationException
/// </summary>
[Serializable]
public class PlusValidationException : PlusException, IHasLogSeverity
{
......
......@@ -2,6 +2,9 @@
namespace Plus
{
/// <summary>
/// SequentialGuidGenerator
/// </summary>
public class SequentialGuidGenerator : IGuidGenerator
{
public static SequentialGuidGenerator Instance { get; } = new SequentialGuidGenerator();
......
......@@ -2,7 +2,10 @@
namespace Plus.Service
{
interface IApplicationService : ITransientDependency
/// <summary>
/// IApplicationService
/// </summary>
public interface IApplicationService : ITransientDependency
{
}
}
\ No newline at end of file
......@@ -2,6 +2,9 @@
namespace Plus.Service
{
/// <summary>
/// IAvoidDuplicateCrossCuttingConcerns
/// </summary>
public interface IAvoidDuplicateCrossCuttingConcerns
{
List<string> AppliedCrossCuttingConcerns { get; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment