├── .gitignore ├── LICENSE ├── README.md ├── doc ├── never.png └── never_emit.png ├── never.sln ├── nuget.bat ├── src ├── Never.Configuration │ ├── App_Config │ │ ├── share.config │ │ ├── share.json │ │ ├── wap.config │ │ ├── wap.json │ │ ├── www.config │ │ └── www.json │ ├── ConfigCenter │ │ ├── ConfigFileInfo.cs │ │ ├── ConfigFileType.cs │ │ ├── ConfigurationWatcher.cs │ │ ├── ConfigurationWatcherEventArgs.cs │ │ ├── IConfigurationBuilder.cs │ │ ├── ICustomKeyValueFinder.cs │ │ ├── IShareFileReference.cs │ │ ├── JsonConfigurationBuilder.cs │ │ ├── Remoting │ │ │ ├── ConfigFileClient.cs │ │ │ ├── ConfigFileClientRequest.cs │ │ │ ├── ConfigFileCommand.cs │ │ │ └── ConfigFileServer.cs │ │ ├── ShareConfigurationBuilder.cs │ │ ├── ShareFileEventArgs.cs │ │ ├── ShareFileInfo.cs │ │ ├── StartupExtension.cs │ │ └── XmlConfigurationBuilder.cs │ ├── Framework │ │ ├── AppConfigReader.cs │ │ ├── FuncConfigReader.cs │ │ ├── MachineConfig.cs │ │ └── StartupExtension.cs │ ├── IConfigReader.cs │ ├── Never.Configuration.csproj │ └── Ststandard │ │ ├── AppConfigReader.cs │ │ └── StartupExtension.cs ├── Never.Deployment │ ├── A10HealthReport.cs │ ├── ApiUriDispatcher.cs │ ├── ApiUriHealthElement.cs │ ├── ApiUrlA10Element.cs │ ├── DefaultApiRouteProvider.cs │ ├── HttpServiceProxyFactory.cs │ ├── HttpServiceTypeProxyBuilder.cs │ ├── IA10HealthReport.cs │ ├── IApiRouteLogTracker.cs │ ├── IApiRouteProvider.cs │ ├── IApiUriDispatcher.cs │ ├── IApiUriHealthElement.cs │ ├── Never.Deployment.csproj │ ├── StartupExtension.cs │ ├── StartupService.cs │ └── UrlConcat.cs ├── Never.EasySql │ ├── ArrayEasySqlParameter.cs │ ├── BaseDao.cs │ ├── BaseDaoBuilder.cs │ ├── CallMode.cs │ ├── ConstructibleDaoBuilder.cs │ ├── DaoBuilderPool.cs │ ├── DefaultDataSource.cs │ ├── DefaultSession.cs │ ├── EasyDecoratedDao.cs │ ├── EasyDecoratedTextDao.cs │ ├── EasyDecoratedXmlDao.cs │ ├── EasySqlExecuter.cs │ ├── EasySqlExtension.cs │ ├── EasySqlParameter.cs │ ├── EmbeddedDaoBuilder.cs │ ├── FileDaoBuilder.cs │ ├── IDao.cs │ ├── IDaoBuilder.cs │ ├── IDataSource.cs │ ├── IEasySqlExecuter.cs │ ├── IEasySqlTransactionExecuter.cs │ ├── INullableParameter.cs │ ├── ISession.cs │ ├── ISqlParameterEnumerable.cs │ ├── ISqlTagDao.cs │ ├── ISqlTagProvider.cs │ ├── KeyValueEasySqlParameter.cs │ ├── Linq │ │ ├── EasySqlContext.cs │ │ ├── EasySqlExtension.cs │ │ ├── EasySqlQueryable.cs │ │ ├── IEasySqlContext.cs │ │ ├── IEasySqlQueryable.cs │ │ ├── ISqlarameter.cs │ │ ├── MySql │ │ │ ├── MySqlEasyContext.cs │ │ │ ├── MySqlExtension`1`.cs │ │ │ ├── MySqlExtension`1`2`.cs │ │ │ ├── MySqlExtension`1`2`3`.cs │ │ │ ├── MySqlExtension`1`2`3`4`.cs │ │ │ ├── MySqlExtension`1`2`3`4`5`.cs │ │ │ ├── MySqlExtension`1`2`3`4`5`6`.cs │ │ │ ├── MySqlExtension`1`2`3`4`5`6`7`.cs │ │ │ └── MySqlParameter.cs │ │ └── Predicate.cs │ ├── Never.EasySql.csproj │ ├── SqlClient │ │ ├── MySqlExecuter.cs │ │ ├── OdbcServerExecuter.cs │ │ ├── OleDbServerExecuter.cs │ │ ├── OracleServerExecuter.cs │ │ ├── PostgreSqlExecuter.cs │ │ ├── SqlServerExecuter.cs │ │ └── SqliteExecuter.cs │ └── Xml │ │ ├── ArrayLabel.cs │ │ ├── BaseLabel.cs │ │ ├── ContainLabel.cs │ │ ├── EmptyLabel.cs │ │ ├── ILabel.cs │ │ ├── IfLabel.cs │ │ ├── LabelType.cs │ │ ├── NotEmptyLabel.cs │ │ ├── NotExistsLabel.cs │ │ ├── NotNullLabel.cs │ │ ├── NullLabel.cs │ │ ├── ParameterPosition.cs │ │ ├── ReturnLabel.cs │ │ ├── SqlTag.cs │ │ ├── SqlTagFormat.cs │ │ ├── SqlTagProvider.cs │ │ ├── TextLabel.cs │ │ ├── easysql.xsd │ │ ├── easysqldemo.txt │ │ └── easysqldemo.xml ├── Never.Hosting │ ├── AppStartup.cs │ ├── HostingExtension.cs │ ├── IoC │ │ ├── ApiServiceCollection.cs │ │ ├── ApiServiceProvider.cs │ │ ├── ApiServiceProviderFactory.cs │ │ ├── ApiServiceScope.cs │ │ └── ApiServiceScopeFactory.cs │ └── Never.Hosting.csproj ├── Never.MemCached │ ├── BinaryCached.cs │ ├── BinaryCompressProtocol.cs │ ├── BinaryProtocols │ │ ├── BinaryCached.html │ │ ├── Endian.cs │ │ ├── EndianAttribute.cs │ │ ├── Magic.cs │ │ ├── Package.cs │ │ ├── RequestHeader.cs │ │ ├── ResponseHeader.cs │ │ └── ResponseStatus.cs │ ├── Command.cs │ ├── ConnectionPool.cs │ ├── DefaultCompressProtocol.cs │ ├── GZipCompressProtocol.cs │ ├── ICompressProtocol.cs │ ├── MemcachedClient.cs │ ├── Never.Memcached.csproj │ ├── SocketSetting.cs │ ├── Sockets │ │ ├── ClientSocket.cs │ │ ├── Connection.cs │ │ ├── IConnection.cs │ │ └── SocketEventArgs.cs │ ├── StartupExtension.cs │ ├── TargetTypeFlag.cs │ ├── TargetTypeFlagAttribute.cs │ ├── TextCached.cs │ └── TextProtocols │ │ └── TextCached.html ├── Never.Web.Mvc │ ├── Attributes │ │ ├── CommaSeparatedModelBinder.cs │ │ └── CommaSeparatedModelBinderAttribute.cs │ ├── Controllers │ │ └── BasicController.cs │ ├── DataAnnotations │ │ ├── StartupService.cs │ │ ├── TypeProcessor.cs │ │ └── ValidatorProvider.cs │ ├── Dispatcher │ │ ├── ActionBehaviorStorager.cs │ │ ├── ActionResultMetadata.cs │ │ └── CustomHttpControllerSelector.cs │ ├── HttpContextExtension.cs │ ├── IHttpActionResult.cs │ ├── IoC │ │ ├── ApiServiceCollection.cs │ │ ├── ApiServiceProvider.cs │ │ ├── ApiServiceScope.cs │ │ ├── ApiServiceScopeFactory.cs │ │ ├── ApiStartService.cs │ │ ├── DependencyResolver.cs │ │ └── ServiceRegisterExtension.cs │ ├── JsonGridModel.cs │ ├── Never.Web.Mvc.csproj │ ├── Results │ │ ├── MyExcelResult.cs │ │ ├── MyJsonResult.cs │ │ ├── MyPDFResult.cs │ │ └── MyRssResult.cs │ ├── Security │ │ ├── UserAuthorizeAttribute.cs │ │ └── UserPrincipalAttribute.cs │ ├── StartupExtension.cs │ ├── WebHttpApplication.cs │ └── WebStartup.cs ├── Never.Web.WebApi │ ├── Attributes │ │ ├── CommaSeparatedModelBinder.cs │ │ └── CommaSeparatedModelBinderAttribute.cs │ ├── Controllers │ │ └── BasicController.cs │ ├── DataAnnotations │ │ ├── StartupService.cs │ │ ├── TypeProcessor.cs │ │ └── ValidatorProvider.cs │ ├── Dispatcher │ │ ├── ActionBehaviorStorager.cs │ │ ├── ActionResultMetadata.cs │ │ ├── CustomHttpActionSelector.cs │ │ └── CustomHttpControllerSelector.cs │ ├── Encryptions │ │ ├── DefaultContentEncryptor.cs │ │ ├── IApiContentEncryptor.cs │ │ ├── TripleDESContentEncryptor.cs │ │ └── UnAuthorizeApiContentEncryptor.cs │ ├── HttpContextExtension.cs │ ├── IHttpActionResult.cs │ ├── IoC │ │ ├── ApiServiceCollection.cs │ │ ├── ApiServiceProvider.cs │ │ ├── ApiServiceScope.cs │ │ ├── ApiServiceScopeFactory.cs │ │ ├── ApiStartService.cs │ │ ├── DependencyResolver.cs │ │ └── ServiceRegisterExtension.cs │ ├── MessageHandlers │ │ ├── DelegatingStreamContent.cs │ │ ├── HttpMethodOverrideHandler.cs │ │ ├── LazyStreamContent.cs │ │ └── SecurityMessageHandler.cs │ ├── Never.Web.WebApi.csproj │ ├── Results │ │ ├── ActionResult.cs │ │ ├── FileResult.cs │ │ ├── MyExcelResult.cs │ │ ├── MyJsonResult.cs │ │ └── MyPDFResult.cs │ ├── Security │ │ ├── UserAuthorizeAttribute.cs │ │ └── UserPrincipalAttribute.cs │ ├── StartupExtension.cs │ ├── WebHttpApplication.cs │ └── WebStartup.cs ├── Never.Web │ ├── Caching │ │ ├── HttpRequestCache.cs │ │ ├── HttpRuntimeCache.cs │ │ └── HttpThreadCache.cs │ ├── Encryptions │ │ ├── IContentEncryptor.cs │ │ └── UnAuthorizeContentEncryptor.cs │ ├── Fakes │ │ ├── FakeHttpContextBaseWrapper.cs │ │ ├── FakeHttpContextWrapper.cs │ │ ├── FakeHttpRequestWrapper.cs │ │ ├── FakeHttpResponseWrapper.cs │ │ ├── FakeHttpSessionStateWrapper.cs │ │ └── HttpContextWrapper.cs │ ├── IoC │ │ ├── Providers │ │ │ └── WebDomainAssemblyProvider.cs │ │ ├── WebEasyContainer.cs │ │ └── WebLifetimeScopeTracker.cs │ ├── Never.Web.csproj │ ├── Serialization │ │ ├── JavaScriptSerializer.cs │ │ └── SoapSerialier.cs │ ├── Sessions │ │ ├── SessionState.cs │ │ ├── SessionStateActions.cs │ │ ├── SessionStateList.cs │ │ └── SessionStateStoreProvider.cs │ ├── StartupExtension.cs │ └── WebApplicationStartup.cs ├── Never.WorkFlow │ ├── App_Data │ │ ├── mysql.sql │ │ └── sqlserver.sql │ ├── Attributes │ │ └── WorkStepAttribute.cs │ ├── CompliantEventArgs.cs │ ├── CoordinationMode.cs │ ├── Coordinations │ │ ├── DefaultSerialTaskStrategy.cs │ │ ├── DefaultTaskschedStrategy.cs │ │ ├── ExecutingNode.cs │ │ ├── TaskschedEngine.cs │ │ ├── TaskschedNode.cs │ │ ├── TaskschedQueue.cs │ │ └── WorkContext.cs │ ├── Exceptions │ │ ├── TemplateNotCompliantException.cs │ │ ├── TemplateNotFoundException.cs │ │ ├── WorkFlowEngineInitException.cs │ │ └── WorkFlowKeyTooLongException.cs │ ├── IExecutingNode.cs │ ├── ISerialTaskStrategy.cs │ ├── ITaskschedEngine.cs │ ├── ITaskschedNode.cs │ ├── ITaskschedQueue.cs │ ├── ITaskschedStrategy.cs │ ├── ITemplateEngine.cs │ ├── IWorkContext.cs │ ├── IWorkContextCleaner.cs │ ├── IWorkFlowEngine.cs │ ├── IWorkStep.cs │ ├── IWorkStepMessage.cs │ ├── IWorkStepMessageValidateContext.cs │ ├── IWorkStepMessageValidator.cs │ ├── Messages │ │ ├── EmptyAndAbortedWorkStepMessage.cs │ │ ├── EmptyButWaitingWorkStepMessage.cs │ │ ├── ExecutingErrorWorkStepMessage.cs │ │ ├── IMultipleWorkStepMessage.cs │ │ ├── MeanwhileWorkStepMessage.cs │ │ └── MultipleWorkStepMessage.cs │ ├── Never.WorkFlow.csproj │ ├── Repository │ │ ├── IExecutingRepository.cs │ │ ├── ITemplateRepository.cs │ │ ├── MemoryExecutingRepository.cs │ │ ├── SingleTableMySqlExecutingRepository.cs │ │ ├── SingleTableSqlExecutingRepository.cs │ │ ├── SingleTableSqlServerExecutingRepository.cs │ │ ├── SqlExecutingRepository.cs │ │ ├── TripleTableMySqlExecutingRepository.cs │ │ ├── TripleTableSqlExecutingRepository.cs │ │ └── TripleTableSqlServerExecutingRepository.cs │ ├── StartupExtension.cs │ ├── StartupService.cs │ ├── TaskschedNodeSearch.cs │ ├── TaskschedStatus.cs │ ├── Template.cs │ ├── TemplateEngine.cs │ ├── TemplateWorkStep.cs │ ├── TemplateWorkStepElement.cs │ ├── WorkFlowEngine.cs │ ├── WorkFlowStatus.cs │ └── WorkSteps │ │ ├── BeginWorkStep.cs │ │ └── EndWorkStep.cs ├── Never.WorkerService │ ├── IoC │ │ ├── ApiServiceCollection.cs │ │ ├── ApiServiceProvider.cs │ │ ├── ApiServiceProviderFactory.cs │ │ ├── ApiServiceScope.cs │ │ └── ApiServiceScopeFactory.cs │ ├── Never.WorkerService.csproj │ ├── StartupExtension.cs │ └── WorkerStartup.cs └── Never │ ├── Aawsl.cs │ ├── Anonymous.cs │ ├── AnonymousExtension.cs │ ├── Aop │ ├── DefaultRuntimeMode.cs │ ├── DomainFilters │ │ ├── CommandBehaviorStorager.cs │ │ ├── CommandHandlerAuthorizeAttribute.cs │ │ ├── CommandHandlerFilterAttribute.cs │ │ ├── EventBehaviorStorager.cs │ │ ├── EventHandlerFilterAttribute.cs │ │ ├── EventHandlerPriorityAttribute.cs │ │ ├── HandlerBehaviorStorager.cs │ │ ├── ICommandActionFilter.cs │ │ └── IEventActionFilter.cs │ ├── DynamicProxy │ │ ├── Builders │ │ │ ├── IllusiveMockBuilder.Generic.cs │ │ │ ├── IllusiveMockBuilder.cs │ │ │ ├── ProxyMockBuilder.Generic.cs │ │ │ └── ProxyMockBuilder.cs │ │ ├── IMockSetup.cs │ │ ├── Mock.cs │ │ ├── MockBuilder.cs │ │ ├── MockEmitBuilder.cs │ │ ├── MockSetup.Gereric.cs │ │ ├── MockSetup.cs │ │ ├── MockSetupInfoStore.cs │ │ └── ProxyObjectInfoStore.cs │ ├── IInterceptor.cs │ ├── IInterceptors │ │ ├── OutputAllArgsInterceptor.cs │ │ ├── StopwatchInterceptor.cs │ │ └── TickCountInterceptor.cs │ ├── IInvocation.cs │ ├── IRuntimeMode.cs │ ├── IRuntimeModeProvider.cs │ ├── InterceptCompileSetting.cs │ ├── LoggerAttribute.cs │ └── StandardInterceptor.cs │ ├── ApiResult.cs │ ├── ApiStatus.cs │ ├── ApplicationStartup.cs │ ├── Attributes │ ├── ApiActionRemarkAttribute.cs │ ├── ApiAreaRemarkAttribute.cs │ ├── CanBeNullAttribute.cs │ ├── CanBeNullOrEmptyAttribute.cs │ ├── DefaultValueAttribute.cs │ ├── IgnoreAnalyseAttribute.cs │ ├── NotNullAttribute.cs │ ├── NotNullOrEmptyAttribute.cs │ ├── ParameterAttribute.cs │ ├── ParameterLengthAttribute.cs │ ├── RemarkAttribute.cs │ └── SummaryAttribute.cs │ ├── Caching │ ├── ConcurrentCounterDictCache.Generic.cs │ ├── ConcurrentCounterDictCache.cs │ ├── ContextCache.cs │ ├── CounterDictCache.Generic.cs │ ├── CounterDictCache.cs │ ├── CounterDictCacheAutoRecyler.cs │ ├── ICaching.cs │ ├── ICounterDictCache.cs │ ├── ICounterDictCacheAutoRecyler.cs │ ├── MemoryCache.cs │ ├── ThreadContextCache.cs │ └── TransientContextCache.cs │ ├── Collections │ ├── AutoExtendBufferQueue.cs │ ├── AutoExtendBufferStatck.cs │ ├── BufferQueue.cs │ ├── BufferQueueEnumerator.cs │ ├── BufferStack.cs │ ├── BufferStackEnumerator.cs │ ├── DoubleTrackNode.cs │ ├── IBufferQueue.cs │ ├── IBufferStack.cs │ ├── SafeBufferQueue.cs │ ├── SafeBufferStack.cs │ ├── SingleTrackNode.cs │ ├── SingleTrackNodeBufferQueue.cs │ └── SingleTrackNodeBufferStack.cs │ ├── CommandStreams │ ├── CommandAppDomainStartupService.cs │ ├── CommandDomainAttribute.cs │ ├── CommandStreamExtension.cs │ ├── CommandStreamHelper.cs │ ├── CommandStreamMessage.cs │ ├── DefaultCommandStreamAnalyser.cs │ ├── DefaultOperateCommand.cs │ ├── EmptyCommandStreamStorager.cs │ ├── ICommandStorager.cs │ ├── ICommandStreamAnalyser.cs │ ├── ICommandStreamStorager.cs │ ├── IOperateCommand.cs │ ├── IgnoreStoreCommandAttribute.cs │ ├── MQCommandStorager.cs │ ├── MQCommandStreamStorager.cs │ └── MultipleCommandStorager.cs │ ├── Commands │ ├── CommandBus.cs │ ├── CommandBusExcutingHelper.cs │ ├── CommandExcutingElement.cs │ ├── CommandHandlerMethodProcessor.cs │ ├── CommandHandlerProvider.cs │ ├── CommandStartupService.cs │ ├── CommandTypeProcessor.cs │ ├── Concurrent │ │ ├── Database.cs │ │ ├── Table.cs │ │ └── TableRow.cs │ ├── DefaultCommandContext.cs │ ├── HandlerCommunication.cs │ ├── IAbortedSerialCommand.cs │ ├── ICommand.cs │ ├── ICommandBus.cs │ ├── ICommandContext.cs │ ├── ICommandContextInitable.cs │ ├── ICommandHandler.cs │ ├── IEnqueueSerialCommand.cs │ ├── ISerialCommand.cs │ ├── InprocEventBus.cs │ ├── InprocEventProviderCommandBus.cs │ ├── MQEventBus.cs │ ├── MQEventProviderCommandBus.cs │ ├── MemoryCommandContext.cs │ ├── MixtureCommandContext.cs │ ├── Recovery │ │ ├── CommandRecoveryManager.cs │ │ ├── EventRecoveryManager.cs │ │ ├── IFailRecoveryStorager.cs │ │ ├── RecoveryCommandBus.cs │ │ ├── RecoveryCommandModel.cs │ │ ├── RecoveryEventBus.cs │ │ ├── RecoveryEventModel.cs │ │ └── RecoveryWorker.cs │ └── SerialCommandBus.cs │ ├── DataAnnotations │ ├── IAmValidator.cs │ ├── IValidationOption.cs │ ├── IValidator.cs │ ├── ValidationFailure.cs │ ├── ValidationOption.cs │ ├── ValidationResult.cs │ ├── Validator.cs │ └── ValidatorAttribute.cs │ ├── Deployment │ ├── IRoutePrimaryKeySelect.cs │ └── StringRoutePrimaryKeySelect.cs │ ├── DigitSplit.cs │ ├── Disposer.cs │ ├── Domains │ ├── AggregateRoot.Generic.cs │ ├── AggregateRoot.cs │ ├── AggregateRootIHandleStartService.cs │ ├── ChangeAggregateCommand.cs │ ├── CreateAggregateCommand.cs │ ├── GuidAggregateCommand.cs │ ├── IAggregateCommand.cs │ ├── IAggregateRoot.cs │ ├── IHandle.cs │ ├── ITransactionRepository.cs │ ├── StartupService.cs │ ├── StringAggregateCommand.cs │ └── ValueObject.cs │ ├── EventStreams │ ├── DefaultEventStreamAnalyser.cs │ ├── DefaultOperateEvent.cs │ ├── EmptyEventStreamStorager.cs │ ├── EventAppDomainStartupService.cs │ ├── EventDomainAttribute.cs │ ├── EventStreamExtension.cs │ ├── EventStreamHelper.cs │ ├── EventStreamMessage.cs │ ├── IBatchEventStreamMessage.cs │ ├── IEventStorager.cs │ ├── IEventStreamAnalyser.cs │ ├── IEventStreamStorager.cs │ ├── IOperateEvent.cs │ ├── IgnoreStoreEventAttribute.cs │ ├── MQEventStorager.cs │ ├── MQEventStreamStorager.cs │ └── MultipleEventStorager.cs │ ├── Events │ ├── AggregateRootChangeEvent.cs │ ├── AggregateRootCreateEvent.cs │ ├── AggregateRootDeleteEvent.cs │ ├── AggregateRootViableEvent.cs │ ├── DefaultEventContext.cs │ ├── EventBus.cs │ ├── EventBusExcutingHelper.cs │ ├── EventExcutingElement.cs │ ├── EventHandlerMethodProcessor.cs │ ├── EventHandlerProvider.cs │ ├── EventStartupService.cs │ ├── EventTypeProcessor.cs │ ├── IAggregateRootEvent.cs │ ├── IEvent.cs │ ├── IEventBus.cs │ ├── IEventContext.cs │ ├── IEventHandler.cs │ └── IStartupEventContext.cs │ ├── Exceptions │ ├── DataFormatException.cs │ ├── DomainException.cs │ ├── FriendlyException.cs │ ├── InvalidException.cs │ ├── KeyExistedException.cs │ ├── KeyNotExistedException.cs │ ├── MessageException.cs │ ├── ParameterException.cs │ ├── ParameterNullException.cs │ ├── ParameterOutOfRangeException.cs │ ├── RepeatExcutingException.cs │ ├── RepositoryExcutingException.cs │ ├── ResourcePoorException.cs │ ├── StreamStorageException.cs │ └── SystemBusyException.cs │ ├── IApplicationStartup.cs │ ├── IConstructibleOption.cs │ ├── IO │ └── FileWatcher.cs │ ├── IServiceActivator.cs │ ├── ITreeNode.cs │ ├── IValuableOption.cs │ ├── IValueObject.cs │ ├── IWorkContext.cs │ ├── IWorkService.cs │ ├── IWorkTigger.cs │ ├── IoC │ ├── AutoInjectingAttribute.cs │ ├── AutoInjectingEnvironmentCollector.cs │ ├── AutoInjectingGroupInfo.cs │ ├── AutoInjectingStartupService.cs │ ├── ComponentLifeStyle.cs │ ├── ContainerContext.cs │ ├── DefaultLifetimeScopeTracker.cs │ ├── EasyContainer.cs │ ├── EasyExtension.cs │ ├── IAssemblyProvider.cs │ ├── IAutoInjectingEnvironmentCollector.cs │ ├── IAutoInjectingEnvironmentProvider.cs │ ├── IComponentLifeStyleStorager.cs │ ├── IContainer.cs │ ├── IContainerStartup.cs │ ├── IContainerStartupEventArgs.cs │ ├── ILifetimeScope.cs │ ├── ILifetimeScopeTracker.cs │ ├── IServiceLocator.cs │ ├── IServiceRegister.cs │ ├── ITypeFinder.cs │ ├── Injections │ │ ├── IParameterRegisterRule.cs │ │ ├── IProxyRegisterRule.cs │ │ ├── IRegisterRule.cs │ │ ├── IRegisterRuleChangeable.cs │ │ ├── IRegisterRuleContainer.cs │ │ ├── IRegisterRuleQuery.cs │ │ ├── IResolveContext.cs │ │ ├── IregisterRuleDescriptor.cs │ │ ├── LifetimeScope.cs │ │ ├── RegisterRule.cs │ │ ├── RegisterRuleBuilder.cs │ │ ├── RegisterRuleCollector.cs │ │ ├── RegisterRuleContainer.cs │ │ ├── Rules │ │ │ ├── ConstructorDictionary.cs │ │ │ └── ConstructorList.cs │ │ ├── ServiceActivator.cs │ │ ├── ServiceLocator.cs │ │ ├── ServiceProvider.cs │ │ ├── ServiceRegister.cs │ │ └── UnableRegisterRule.cs │ ├── Providers │ │ ├── AppDomainAssemblyProvider.cs │ │ ├── DefaultAssemblyProvider.cs │ │ └── DefaultTypeFinder.cs │ ├── ResolveMethod.cs │ ├── ScopedAutoInjectingAttribute.cs │ ├── ScopedAutoInjectingEnvironmentProvider.cs │ ├── SingletonAutoInjectingAttribute.cs │ ├── SingletonAutoInjectingEnvironmentProvider.cs │ ├── ThreadLifetimeScopeTracker.cs │ ├── TransientAutoInjectingAttribute.cs │ └── TransientAutoInjectingEnvironmentProvider.cs │ ├── KeyValueTuple.cs │ ├── Logging │ ├── AllotLogger.cs │ ├── ILogger.cs │ ├── ILoggerBuilder.cs │ └── LoggerBuilder.cs │ ├── Mappers │ ├── EasyMapper.cs │ ├── IMapper.cs │ ├── MapperBuilder.Generic.Action.cs │ ├── MapperBuilder.Generic.Func.cs │ ├── MapperBuilder.Generic.cs │ ├── MapperBuilder.cs │ ├── MapperBuilderHelper.cs │ ├── MapperContext.cs │ └── MapperSetting.cs │ ├── Messages │ ├── DefaultMessageConnection.cs │ ├── DefaultMessageContext.cs │ ├── DefaultMessageProducerProvider.cs │ ├── EmptyMessageProducer.cs │ ├── IMessage.cs │ ├── IMessageConnection.cs │ ├── IMessageConsumer.cs │ ├── IMessageContext.cs │ ├── IMessageProducer.cs │ ├── IMessageProducerProvider.cs │ ├── IMessagePublisher.cs │ ├── IMessageRoute.cs │ ├── IMessageSubscriber.cs │ ├── MessageDispatcher.cs │ ├── MessageExcutingElement.cs │ ├── MessageExcutingHelper.cs │ ├── MessagePacket.cs │ ├── MessagePublisher.cs │ ├── MessageStartupService.cs │ ├── MessageSubscriberProvider.cs │ ├── MessageTaskDispatcher.cs │ ├── Microstoft │ │ ├── Consumer.cs │ │ ├── MessageConnection.cs │ │ └── Producer.cs │ ├── MultipleMessageProducer.cs │ ├── StartupService.cs │ └── TestMessage.cs │ ├── Never.csproj │ ├── ObjectExtension.Crypt.cs │ ├── ObjectExtension.String.cs │ ├── ObjectExtension.Type.cs │ ├── ObjectExtension.ValueType.cs │ ├── ObjectExtension.cs │ ├── PagedData.cs │ ├── PagedSearch.cs │ ├── RangeTuple.cs │ ├── Reflection │ ├── EasyEmitBuilder.cs │ ├── EmitBuilder.Opcode.cs │ ├── EmitBuilder.cs │ ├── IEmitBuilder.cs │ ├── ILabel.cs │ ├── ILocal.cs │ ├── IOwner.cs │ ├── IncrementName.cs │ ├── MyLabel.cs │ ├── MyLocal.cs │ ├── OpCodeTrace.cs │ ├── TrackEmitBuilder.cs │ ├── TypeConverters │ │ └── ArrayStringTypeConverter.cs │ └── TypeHelper.cs │ ├── Remoting │ ├── ClientRequestHadler.cs │ ├── Http │ │ ├── Protocol.cs │ │ ├── Request.cs │ │ ├── Response.cs │ │ └── ResponseResult.cs │ ├── IRemoteProtocol.cs │ ├── IRemoteRequest.cs │ ├── IRemoteResponse.cs │ ├── IRequestHandler.cs │ ├── IResponseHandler.cs │ ├── IResponseHandlerContext.cs │ ├── IResponseHandlerResult.cs │ └── ServerRequestHandler.cs │ ├── Security │ ├── IUser.cs │ ├── IWorker.cs │ ├── UserIdentity.cs │ └── UserPrincipal.cs │ ├── Serialization │ ├── BinarySerializer.cs │ ├── DataContractSerializer.cs │ ├── EasyJsonSerializer.cs │ ├── IBinarySerializer.cs │ ├── IJsonSerializer.cs │ ├── IXmlSerializer.cs │ ├── Json │ │ ├── ArraySegmentValue.cs │ │ ├── ConvertMethodProvider.cs │ │ ├── CustomSerializationProvider.cs │ │ ├── DataContractAttribute.cs │ │ ├── DataMemberAttribute.cs │ │ ├── DateTimeFormat.cs │ │ ├── DefaultSetting.cs │ │ ├── Deserialize │ │ │ ├── ContentNodeType.cs │ │ │ ├── DeseralizerBuilder.cs │ │ │ ├── DeseralizerBuilderHelper.cs │ │ │ ├── EnumDeseralizerBuilder.cs │ │ │ ├── Enumerators │ │ │ │ ├── EnumEnumerableProvider.Nullable.cs │ │ │ │ ├── EnumEnumerableProvider.cs │ │ │ │ ├── IDictionaryProvider.Generic.cs │ │ │ │ ├── IDictionaryProvider.cs │ │ │ │ ├── ObjectEnumerableProvider.cs │ │ │ │ ├── PrimitiveEnumerableProvider.Nullable.cs │ │ │ │ └── PrimitiveEnumerableProvider.cs │ │ │ ├── IObjectContentNode.cs │ │ │ ├── JsonContentNode.cs │ │ │ ├── ParseMethodProviderEngrafting.Nullable.cs │ │ │ ├── ParseMethodProviderEngrafting.cs │ │ │ └── ZzzZzDeserializerBuilder.cs │ │ ├── EnumValues.cs │ │ ├── IContentNode.cs │ │ ├── IConvertMethodProvider.cs │ │ ├── IDeserialierBuilder.cs │ │ ├── IDeserializerReader.cs │ │ ├── ISerialierBuilder.cs │ │ ├── ISerializerWriter.cs │ │ ├── IgnoreDataMemberAttribute.cs │ │ ├── InsideHandleType.cs │ │ ├── JsonDeserializeSetting.cs │ │ ├── JsonEmitBuilder.cs │ │ ├── JsonEnumTypes.cs │ │ ├── JsonSerializeSetting.cs │ │ ├── MethodProviders │ │ │ ├── BooleanMethodProvider.cs │ │ │ ├── ByteMethodProvider.cs │ │ │ ├── CharMethodProvider.cs │ │ │ ├── DateTimeMethodProvider.cs │ │ │ ├── Datetimes │ │ │ │ ├── ChineseStyleDateMethodProvider.cs │ │ │ │ ├── ISO8601StyleDateMethodProvider.cs │ │ │ │ ├── MicrosoftStyleDateMethodProvider.cs │ │ │ │ └── RFC1123StyleDateMethodProvider.cs │ │ │ ├── DecimalMethodProvider.cs │ │ │ ├── DoubleMethodProvider.cs │ │ │ ├── EnumMethodProvider.cs │ │ │ ├── ExceptionMethodProvider.cs │ │ │ ├── FloatMethodProvider.cs │ │ │ ├── GuidMethodProvider.cs │ │ │ ├── Int16MethodProvider.cs │ │ │ ├── Int32MethodProvider.cs │ │ │ ├── Int64MethodProvider.cs │ │ │ ├── Nullables │ │ │ │ ├── BooleanMethodProvider.cs │ │ │ │ ├── ByteMethodProvider.cs │ │ │ │ ├── CharMethodProvider.cs │ │ │ │ ├── DateTimeMethodProvider.cs │ │ │ │ ├── Datetimes │ │ │ │ │ ├── ChineseStyleDateMethodProvider.cs │ │ │ │ │ ├── ISO8601StyleDateMethodProvider.cs │ │ │ │ │ ├── MicrosoftStyleDateMethodProvider.cs │ │ │ │ │ └── RFC1123StyleDateMethodProvider.cs │ │ │ │ ├── DecimalMethodProvider.cs │ │ │ │ ├── DoubleMethodProvider.cs │ │ │ │ ├── EnumMethodProvider.cs │ │ │ │ ├── FloatMethodProvider.cs │ │ │ │ ├── GuidMethodProvider.cs │ │ │ │ ├── Int16MethodProvider.cs │ │ │ │ ├── Int32MethodProvider.cs │ │ │ │ ├── Int64MethodProvider.cs │ │ │ │ ├── TimeSpanMethodProvider.cs │ │ │ │ ├── UInt16MethodProvider.cs │ │ │ │ ├── UInt32MethodProvider.cs │ │ │ │ └── UInt64MethodProvider.cs │ │ │ ├── StringMethodProvider.cs │ │ │ ├── TimespanMethodProvider.cs │ │ │ ├── TypeMethodProvider.cs │ │ │ ├── UInt16MethodProvider.cs │ │ │ ├── UInt32MethodProvider.cs │ │ │ └── UInt64MethodProvider.cs │ │ ├── SequenceStringReader.cs │ │ ├── Serialize │ │ │ ├── EnumSerializerBuilder.cs │ │ │ ├── Enumerators │ │ │ │ ├── EnumEnumerableProvider.Nullable.cs │ │ │ │ ├── EnumEnumerableProvider.cs │ │ │ │ ├── IDictionaryProvider.Generic.cs │ │ │ │ ├── IDictionaryProvider.cs │ │ │ │ ├── IEnumerableProvider.Generic.cs │ │ │ │ ├── IEnumerableProvider.cs │ │ │ │ ├── ObjectEnumerableProvider..cs │ │ │ │ └── PrimitiveEnumerableProvider.cs │ │ │ ├── ParseMethodProviderEngrafting.Nullable.cs │ │ │ ├── ParseMethodProviderEngrafting.cs │ │ │ ├── SerialierBuilder.cs │ │ │ ├── SerialierBuilderHelper.cs │ │ │ └── ZzzZzSerialierBuilder.cs │ │ ├── TextWriterDecorate.cs │ │ ├── ThunderReader.cs │ │ └── ThunderWriter.cs │ ├── SerializeEnvironment.cs │ └── XmlSerializer.cs │ ├── Singleton.cs │ ├── Sockets │ └── AsyncArgs │ │ ├── ClientSocket.cs │ │ ├── Connection.cs │ │ ├── IConnection.cs │ │ ├── ISocketBuffer.cs │ │ ├── ISocketBufferProvider.cs │ │ ├── ISocketProtocol.cs │ │ ├── ServerSocket.cs │ │ ├── SocketBufferProvider.cs │ │ ├── SocketEventArgs.cs │ │ ├── SocketSetting.cs │ │ └── SocketUserToken.cs │ ├── SqlClient │ ├── DataRecordBuilder.cs │ ├── DataRecordBuilderHelper.cs │ ├── IDataRecordDecorator.cs │ ├── IParameterPrefixProvider.cs │ ├── ISqlExecuter.cs │ ├── ITransactionExecuter.cs │ ├── ITypeHandler.cs │ ├── MySqlExecuter.cs │ ├── OdbcServerExecuter.cs │ ├── OleDbServerExecuter.cs │ ├── OracleServerExecuter.cs │ ├── PostgreSqlExecuter.cs │ ├── SqlExecuter.cs │ ├── SqlExecuterFactory.cs │ ├── SqlParamerBuilder.cs │ ├── SqlServerExecuter.cs │ ├── SqliteExecuter.cs │ ├── TypeHandlerAttribute.cs │ ├── TypeHandlerAttributeStorager.cs │ └── VagueSqlExecuter.cs │ ├── StartupEventArgs.cs │ ├── StartupExtension.cs │ ├── Startups │ ├── IAssemblyFilter.cs │ ├── IAssemblyProcessor.cs │ ├── IFilteringAssemblyProvider.cs │ ├── IStartupService.cs │ ├── ITypeProcessor.cs │ ├── Impls │ │ ├── EmptyApplicationStartup.cs │ │ ├── EmptyCommandBus.cs │ │ ├── EmptyEventBus.cs │ │ ├── EmptyFilteringAssemblyProvider.cs │ │ ├── EmptyServiceLocator.cs │ │ ├── EmptyServiceRegister.cs │ │ ├── EmptyTypeFinder.cs │ │ ├── FilteringAssemblyProvider.cs │ │ └── RegexAssemblyFilter.cs │ └── StartupContext.cs │ ├── Threading │ ├── AutoResetEventLocker.cs │ ├── IRigidLocker.cs │ ├── IWaitableLocker.cs │ ├── InterLocker.cs │ ├── MonitorLocker.cs │ ├── MutexLocker.cs │ ├── ReaderWriterLocker.cs │ ├── SemaphoreLocker.cs │ ├── SpinLockLocker.cs │ ├── SugerLocker.cs │ └── ThreadCircler.cs │ ├── Utils │ ├── Channel.cs │ ├── Ftp.cs │ ├── MethodTickCount.cs │ ├── NewId.cs │ ├── Randomizer.cs │ ├── ShortUrl.cs │ ├── SimpleStatusMachine.cs │ ├── SimpleStatusMachineExtension.cs │ ├── SimpleStatusMachineHelper.cs │ └── SortHelper.cs │ └── Web │ ├── HttpClientDownloader.cs │ ├── HttpDownloaderExtension.cs │ └── HttpRequestDownloader.cs ├── test ├── Never.Test │ ├── Aop │ │ ├── MethodTest.cs │ │ ├── MockTest.cs │ │ └── ProxyTest.cs │ ├── CQRS │ │ ├── LogEventFilterAttribute.cs │ │ ├── PermissionCommandFilter.cs │ │ ├── TestAggregateRoot.cs │ │ ├── TestCQRS.cs │ │ ├── TestCommand.cs │ │ ├── TestCommandHandler.cs │ │ ├── TestEvent.cs │ │ ├── TestEventHandler.cs │ │ ├── TestMessage.cs │ │ └── TestSubscriber.cs │ ├── Caching │ │ ├── CachingTest.cs │ │ └── MemcachedTest.cs │ ├── Collections │ │ └── BufferQueueTest.cs │ ├── Configurations │ │ ├── AppConfigTest.cs │ │ └── ConfigCenterTest.cs │ ├── IoC │ │ └── MyCtorTest.cs │ ├── Mappers │ │ └── MapperTest.cs │ ├── Never.Test.csproj │ ├── Performance │ │ ├── MapperPTest.cs │ │ └── SerializationPTest.cs │ ├── Program.cs │ ├── Rabbitmq │ │ └── ProducerTest.cs │ ├── Reflection │ │ └── EmitTest.cs │ ├── Serialization │ │ ├── Enum.cs │ │ ├── EnumableTest.cs │ │ ├── FileTextTest.cs │ │ ├── Level.cs │ │ ├── SerializerTest.cs │ │ ├── TestDemo.cs │ │ └── ThunderReaderTest.cs │ ├── Sockets │ │ ├── ClientTest.cs │ │ └── ServerTest.cs │ ├── SqlClient │ │ ├── CallTest.cs │ │ ├── DeleteTest.cs │ │ ├── InsertTest.cs │ │ ├── MySqlTest.cs │ │ ├── SelectTest.cs │ │ ├── SqlModel.cs │ │ └── UpdateTest.cs │ └── Threading │ │ └── LockTest.cs ├── Never.TestMvc │ ├── App_Start │ │ ├── BundleConfig.cs │ │ ├── FilterConfig.cs │ │ └── RouteConfig.cs │ ├── Content │ │ ├── Site.css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap-theme.min.css.map │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ ├── Controllers │ │ └── HomeController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── Never.TestMvc.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Scripts │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── jquery-3.3.1.intellisense.js │ │ ├── jquery-3.3.1.js │ │ ├── jquery-3.3.1.min.js │ │ ├── jquery-3.3.1.min.map │ │ ├── jquery-3.3.1.slim.js │ │ ├── jquery-3.3.1.slim.min.js │ │ ├── jquery-3.3.1.slim.min.map │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ ├── jquery.validate.unobtrusive.min.js │ │ └── modernizr-2.8.3.js │ ├── Views │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ ├── Contact.cshtml │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ └── _Layout.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── favicon.ico │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ └── packages.config ├── Never.TestWebApi │ ├── Controllers │ │ ├── ValuesController.cs │ │ ├── v1.0 │ │ │ └── ValuesController.cs │ │ └── v1.1 │ │ │ └── ValuesController.cs │ ├── Models │ │ └── CreateUserReqs.cs │ ├── Never.TestWebApi.csproj │ ├── Program.cs │ ├── Properties │ │ ├── PublishProfiles │ │ │ └── FolderProfile.pubxml │ │ └── launchSettings.json │ ├── Startup.cs │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── install.bat │ └── uninstall.bat └── Never.TestWorkerService │ ├── FlowMain.cs │ ├── Logging │ ├── WriteMessage.cs │ └── 请假成功短信通知.cs │ ├── Messages │ ├── 主管审批意见结果.cs │ ├── 人事审批请假意见结果.cs │ ├── 组长审批意见结果.cs │ └── 请假申请消息.cs │ ├── Never.TestWorkerService.csproj │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Startup.cs │ ├── Steps │ ├── 主管审批.cs │ ├── 人事审批.cs │ ├── 组长审批.cs │ └── 请假申请.cs │ ├── Worker.cs │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── install.bat │ └── uninstall.bat └── tools ├── Never.Configuration.nuspec ├── Never.Deployment.nuspec ├── Never.EasySql.nuspec ├── Never.Hosting.nuspec ├── Never.Memcached.nuspec ├── Never.Web.Mvc.nuspec ├── Never.Web.WebApi.nuspec ├── Never.Web.nuspec ├── Never.WorkFlow.nuspec ├── Never.WorkerService.nuspec ├── Never.nuspec └── NuGet.exe /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 shelldudu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /doc/never.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shelldudu/never/ee9eb8560e2e75461e539604947a9aa6b78e2688/doc/never.png -------------------------------------------------------------------------------- /doc/never_emit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shelldudu/never/ee9eb8560e2e75461e539604947a9aa6b78e2688/doc/never_emit.png -------------------------------------------------------------------------------- /src/Never.Configuration/App_Config/share.json: -------------------------------------------------------------------------------- 1 | /*共享文件只支持key-value,并且只支持一层key查询,find://eat表示不会保留双引号,find://cat表示保留,link://表示不保留双引号,直接使用引用的value绑定到这里,不支持find语法*/ 2 | { 3 | "template": "true", 4 | "sharename": "share", 5 | "tiantian": "find://eat@user", 6 | "tianqian": "find://cat@user", //"aum_conn": "1236545", 7 | //"risk_conn": "1236545", 8 | //"trisk_conn": "1236545", 9 | "efg": [ 2, 3, 4 ], 10 | "member_conn": "XbqILBocbyuhxKV4pcyowb034nbk0TmXlbn6IJrPrPA2MmdgpS6ZG0NwFU4FtMefANkxM90BgVc=", 11 | "hosturl": { 12 | "wap": "http://wap.abc.com", 13 | "www": "http://www.abc.com", 14 | "app": "http://app.abc.com" 15 | }, 16 | "membera10": { 17 | "url": [ "http://127.0.0.1:8091/api/", "http://127.0.0.1:8091/api/" ], 18 | "ping": [ "http://127.0.0.1:8091/a10", "http://127.0.0.1:8091/a10" ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Never.Configuration/App_Config/wap.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Never.Configuration/App_Config/wap.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shelldudu/never/ee9eb8560e2e75461e539604947a9aa6b78e2688/src/Never.Configuration/App_Config/wap.json -------------------------------------------------------------------------------- /src/Never.Configuration/App_Config/www.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Never.Configuration/App_Config/www.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shelldudu/never/ee9eb8560e2e75461e539604947a9aa6b78e2688/src/Never.Configuration/App_Config/www.json -------------------------------------------------------------------------------- /src/Never.Configuration/ConfigCenter/ConfigFileInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.Configuration.ConfigCenter 9 | { 10 | /// 11 | /// 配置文件 12 | /// 13 | public class ConfigFileInfo 14 | { 15 | /// 16 | /// 文件 17 | /// 18 | public FileInfo File { get; set; } 19 | 20 | /// 21 | /// 编码 22 | /// 23 | public Encoding Encoding { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Never.Configuration/ConfigCenter/ConfigFileType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Configuration.ConfigCenter 8 | { 9 | /// 10 | /// 配置文件 11 | /// 12 | public enum ConfigFileType 13 | { 14 | /// 15 | /// 没有 16 | /// 17 | No = 0, 18 | 19 | /// 20 | /// Json 21 | /// 22 | Json = 1, 23 | 24 | /// 25 | /// Xml 26 | /// 27 | Xml = 2, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Never.Configuration/ConfigCenter/ConfigurationWatcherEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Configuration.ConfigCenter 8 | { 9 | /// 10 | /// 变更事件 11 | /// 12 | public class ConfigurationWatcherEventArgs : EventArgs 13 | { 14 | /// 15 | /// 配置文件构造者 16 | /// 17 | public IEnumerable Builders { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Never.Configuration/ConfigCenter/ICustomKeyValueFinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Configuration.ConfigCenter 8 | { 9 | /// 10 | /// 关键字查找者 11 | /// 12 | public interface ICustomKeyValueFinder 13 | { 14 | /// 15 | /// 查询关键字 16 | /// 17 | /// eat还是cat 18 | /// @user参数 19 | string Find(string mode, string key); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Never.Configuration/ConfigCenter/IShareFileReference.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Configuration.ConfigCenter 8 | { 9 | /// 10 | /// 共享文件引用 11 | /// 12 | public interface IShareFileReference 13 | { 14 | /// 15 | /// 文件与共享文件的引用 16 | /// 17 | IConfigurationBuilder Builder { get; } 18 | 19 | /// 20 | /// 文件与共享文件的引用 21 | /// 22 | IEnumerable Reference { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Never.Configuration/ConfigCenter/Remoting/ConfigFileClientRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Configuration.ConfigCenter.Remoting 8 | { 9 | /// 10 | /// 请求服务 11 | /// 12 | public class ConfigFileClientRequest 13 | { 14 | /// 15 | /// 请求文件名 16 | /// 17 | public string FileName { get; set; } 18 | } 19 | 20 | /// 21 | /// 请求服务 22 | /// 23 | public class ConfigFileClientCallbakRequest: ConfigFileClientRequest 24 | { 25 | /// 26 | /// 文件编码 27 | /// 28 | public string Encoding { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Never.Configuration/ConfigCenter/Remoting/ConfigFileCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Configuration.ConfigCenter.Remoting 8 | { 9 | /// 10 | /// 文件配置命令 11 | /// 12 | public class ConfigFileCommand 13 | { 14 | /// 15 | /// 客户端去服务器获取数据的命令 16 | /// 17 | public static string Push = "push"; 18 | 19 | /// 20 | /// 服务器推送过来的命令 21 | /// 22 | public static string Pull = "pull"; 23 | 24 | /// 25 | /// 客户端去测试服务器的命令 26 | /// 27 | public static string Test = "test"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Never.Configuration/ConfigCenter/ShareFileEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Configuration.ConfigCenter 8 | { 9 | /// 10 | /// 共享文件信息 11 | /// 12 | public class ShareFileEventArgs : EventArgs 13 | { 14 | /// 15 | /// json的配置文件 16 | /// 17 | public ShareFileInfo JsonShareFile { get; } 18 | 19 | /// 20 | /// xml的json的配置文件 21 | /// 22 | public ShareFileInfo XmlShareFile { get; } 23 | 24 | /// 25 | /// 26 | /// 27 | /// 28 | /// 29 | public ShareFileEventArgs(ShareFileInfo jsonShareFile, ShareFileInfo xmlShareFile) 30 | { 31 | this.JsonShareFile = jsonShareFile; 32 | this.XmlShareFile = xmlShareFile; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Never.Configuration/IConfigReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Configuration 8 | { 9 | /// 10 | /// 配置读取 11 | /// 12 | public interface IConfigReader 13 | { 14 | /// 15 | /// 读取某一值 16 | /// 17 | /// key 18 | /// 19 | string this[string key] { get; } 20 | 21 | #if NET461 22 | 23 | /// 24 | /// 配置文件 25 | /// 26 | System.Configuration.Configuration Configuration { get; } 27 | #else 28 | /// 29 | /// 配置文件 30 | /// 31 | Microsoft.Extensions.Configuration.IConfiguration Configuration { get; } 32 | #endif 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Never.Deployment/ApiUrlA10Element.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Deployment 2 | { 3 | /// 4 | /// Api路由元素 5 | /// 6 | public struct ApiUrlA10Element 7 | { 8 | /// 9 | /// 当前ApiUrl 10 | /// 11 | public string ApiUrl { get; set; } 12 | 13 | /// 14 | /// 当前A10文件Url 15 | /// 16 | public string A10Url { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Never.Deployment/IApiRouteLogTracker.cs: -------------------------------------------------------------------------------- 1 | using Never.Logging; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.Deployment 9 | { 10 | /// 11 | /// 日志跟踪 12 | /// 13 | public interface IApiRouteLogTracker 14 | { 15 | /// 16 | /// 日志信息 17 | /// 18 | Func LoggerBuilder { get; set; } 19 | 20 | /// 21 | /// 写日志 22 | /// 23 | /// 24 | /// 25 | Task Write(IEnumerable source, IEnumerable match); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Never.Deployment/IApiRouteProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Never.Deployment 5 | { 6 | /// 7 | /// 路由提供者 8 | /// 9 | public interface IApiRouteProvider 10 | { 11 | /// 12 | /// 当前组 13 | /// 14 | string Group { get; } 15 | 16 | /// 17 | /// url,a10元素 18 | /// 19 | IEnumerable ApiUrlA10Elements { get; } 20 | 21 | /// 22 | /// a10内容匹配 23 | /// 24 | Func A10ContentMatch { get; } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Never.Deployment/IApiUriHealthElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Deployment 4 | { 5 | /// 6 | /// api uri 健康信息 7 | /// 8 | public interface IApiUriHealthElement 9 | { 10 | #region prop属性 11 | 12 | /// 13 | /// 加入Id 14 | /// 15 | int Id { get; } 16 | 17 | /// 18 | /// uri 地址 19 | /// 20 | string ApiUri { get; } 21 | 22 | /// 23 | /// 上一次更新时间 24 | /// 25 | DateTime ReportTime { get; } 26 | 27 | /// 28 | /// a10 地址 29 | /// 30 | string A10Url { get; } 31 | 32 | /// 33 | /// 上一次获取到的内容 34 | /// 35 | string ReportText { get; } 36 | 37 | /// 38 | /// 所属组 39 | /// 40 | string Group { get; } 41 | 42 | #endregion prop属性 43 | } 44 | } -------------------------------------------------------------------------------- /src/Never.Deployment/Never.Deployment.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | net461; 6 | netstandard2.0; 7 | 8 | 9 | 10 | 11 | 12 | bin\ 13 | false 14 | 15 | 16 | 17 | 18 | bin\Never.Deployment.xml 19 | 20 | 21 | 22 | bin\Never.Deployment.xml 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/Never.EasySql/CallMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.EasySql 8 | { 9 | /// 10 | /// Call类型 11 | /// 12 | [Flags] 13 | public enum CallMode 14 | { 15 | /// 16 | /// 执行ExecuteScalar方法 17 | /// 18 | ExecuteScalar = 1, 19 | 20 | /// 21 | /// 执行ExecuteNonQuery方法 22 | /// 23 | ExecuteNonQuery = 2, 24 | 25 | /// 26 | /// 执行方法的命令类型 27 | /// 28 | CommandText = 4, 29 | 30 | /// 31 | /// 执行方法的命令类型 32 | /// 33 | CommandStoredProcedure = 8, 34 | 35 | /// 36 | /// 执行方法的命令类型 37 | /// 38 | CommandTableDirect = 16 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Never.EasySql/DefaultDataSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Common; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.EasySql 9 | { 10 | /// 11 | /// 数据库相关源 12 | /// 13 | public class DefaultDataSource : IDataSource 14 | { 15 | /// 16 | /// 连接字符串 17 | /// 18 | public string ConnectionString { get; internal set; } 19 | 20 | /// 21 | /// 数据工厂 22 | /// 23 | public DbProviderFactory ProviderFactory { get; internal set; } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Never.EasySql/DefaultSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.EasySql 9 | { 10 | /// 11 | /// 执行session,只有开了事务才不为空 12 | /// 13 | public class DefaultSession : ISession 14 | { 15 | /// 16 | /// 数据库相关源 17 | /// 18 | public IDataSource DataSource { get; internal set; } 19 | 20 | /// 21 | /// 事务 22 | /// 23 | public IDbTransaction Transaction { get; internal set; } 24 | 25 | /// 26 | /// 数据操作接口 27 | /// 28 | public IDao Dao { get; internal set; } 29 | 30 | /// 31 | /// 释放资源 32 | /// 33 | public void Dispose() 34 | { 35 | if (this.Transaction != null) 36 | this.Transaction.Dispose(); 37 | 38 | if (this.Dao != null) 39 | this.Dao.Dispose(); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/Never.EasySql/IDaoBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.EasySql 8 | { 9 | /// 10 | /// dao构建者 11 | /// 12 | public interface IDaoBuilder 13 | { 14 | /// 15 | /// 构建者 16 | /// 17 | Func Build { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Never.EasySql/IDataSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Common; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.EasySql 9 | { 10 | /// 11 | /// 数据库相关源 12 | /// 13 | public interface IDataSource 14 | { 15 | /// 16 | /// 连接字符串 17 | /// 18 | string ConnectionString { get; } 19 | 20 | /// 21 | /// 数据工厂 22 | /// 23 | DbProviderFactory ProviderFactory { get; } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Never.EasySql/ISession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.EasySql 9 | { 10 | /// 11 | /// 执行session,只有开了事务才不为空 12 | /// 13 | public interface ISession : System.IDisposable 14 | { 15 | /// 16 | /// 数据库相关源 17 | /// 18 | IDataSource DataSource { get; } 19 | 20 | /// 21 | /// 事务 22 | /// 23 | IDbTransaction Transaction { get; } 24 | 25 | /// 26 | /// 数据操作接口 27 | /// 28 | IDao Dao { get; } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Never.EasySql/ISqlParameterEnumerable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.EasySql 8 | { 9 | /// 10 | /// 可遍历的参数 11 | /// 12 | public interface ISqlParameterEnumerable 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /src/Never.EasySql/ISqlTagProvider.cs: -------------------------------------------------------------------------------- 1 | using Never.EasySql.Xml; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.EasySql 9 | { 10 | /// 11 | /// 所有sqlTag提供者 12 | /// 13 | public interface ISqlTagProvider 14 | { 15 | /// 16 | /// 获取某一个 17 | /// 18 | /// 19 | /// 20 | SqlTag Get(string sqlId); 21 | 22 | /// 23 | /// 获取某一个 24 | /// 25 | /// 26 | /// 27 | /// 28 | bool TryGet(string sqlId, out SqlTag sqlTag); 29 | 30 | /// 31 | /// 获取所有 32 | /// 33 | /// 34 | IEnumerable> GetAll(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Never.EasySql/KeyValueEasySqlParameter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.EasySql 8 | { 9 | /// 10 | /// key-value参数 11 | /// 12 | /// 13 | internal class KeyValueEasySqlParameter : EasySqlParameter 14 | { 15 | #region ctor 16 | 17 | /// 18 | /// sql参数,只接受key-value这种形式的对象 19 | /// 20 | /// 21 | public KeyValueEasySqlParameter(T @object) : base(@object) 22 | { 23 | } 24 | 25 | #endregion ctor 26 | } 27 | } -------------------------------------------------------------------------------- /src/Never.EasySql/Linq/EasySqlContext.cs: -------------------------------------------------------------------------------- 1 | using Never.Utils; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.EasySql.Linq 9 | { 10 | public class EasySqlContext 11 | { 12 | #region prop 13 | 14 | public string SqlId { get; protected set; } 15 | 16 | #endregion prop 17 | 18 | #region build 19 | 20 | /// 21 | /// 22 | /// 23 | protected void BeginBuilding() 24 | { 25 | if (this.SqlId.IsNullOrEmpty()) 26 | this.SqlId = NewId.GenerateString(NewId.StringLength.L24); 27 | } 28 | 29 | #endregion build 30 | } 31 | } -------------------------------------------------------------------------------- /src/Never.EasySql/Linq/EasySqlExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Linq.Expressions; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.EasySql.Linq 9 | { 10 | public static partial class EasySqlExtension 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never.EasySql/Linq/IEasySqlContext.cs: -------------------------------------------------------------------------------- 1 | using Never.Utils; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.EasySql.Linq 9 | { 10 | public interface IEasySqlContext 11 | { 12 | string SqlId { get; } 13 | 14 | void Build(); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Never.EasySql/Linq/ISqlarameter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.EasySql.Linq 8 | { 9 | public interface ISqlarameter 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /src/Never.EasySql/Linq/MySql/MySqlExtension`1`2`3`.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Linq.Expressions; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.EasySql.Linq.MySql 9 | { 10 | public static partial class MySqlExtension 11 | { 12 | public static IEasySqlQueryable LeftJoin(this IEasySqlQueryable queryable, Expression>> expression) where Parameter : class 13 | { 14 | var context = queryable.Context as MySqlEasyContext; 15 | return queryable; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Never.EasySql/Linq/MySql/MySqlExtension`1`2`3`4`.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Linq.Expressions; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.EasySql.Linq.MySql 9 | { 10 | public static partial class MySqlExtension 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never.EasySql/Linq/MySql/MySqlExtension`1`2`3`4`5`.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Linq.Expressions; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.EasySql.Linq.MySql 9 | { 10 | public static partial class MySqlExtension 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never.EasySql/Linq/MySql/MySqlExtension`1`2`3`4`5`6`.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Linq.Expressions; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.EasySql.Linq.MySql 9 | { 10 | public static partial class MySqlExtension 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never.EasySql/Linq/MySql/MySqlExtension`1`2`3`4`5`6`7`.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Linq.Expressions; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.EasySql.Linq.MySql 9 | { 10 | public static partial class MySqlExtension 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never.EasySql/Linq/MySql/MySqlParameter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.EasySql.Linq.MySql 8 | { 9 | public class Limit : ISqlarameter 10 | { 11 | public Limit(int start) 12 | { 13 | this.Start = start; 14 | } 15 | 16 | public int Start { get; set; } 17 | } 18 | 19 | public class Limit2 : Limit, ISqlarameter 20 | { 21 | public Limit2(int start, int pageSize) : base(start) 22 | { 23 | this.PageSize = pageSize; 24 | } 25 | 26 | public int PageSize { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Never.EasySql/Linq/Predicate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Linq.Expressions; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.EasySql.Linq 9 | { 10 | public class Predicate where Parameter : class 11 | { 12 | private readonly Parameter parameter = null; 13 | 14 | public bool Contains(Expression> selector, IEnumerable values) where T : IConvertible 15 | { 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Never.Hosting/IoC/ApiServiceProvider.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Never.IoC.Injections; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Never.Hosting.IoC 10 | { 11 | public class ApiServiceProvider : Never.IoC.Injections.ServiceProvider, ISupportRequiredService 12 | { 13 | private readonly Never.IoC.ILifetimeScope scope = null; 14 | 15 | public ApiServiceProvider(Never.IoC.ILifetimeScope scope) : base(scope) 16 | { 17 | this.scope = scope; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Never.Hosting/Never.Hosting.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | bin\Never.Host.xml 18 | 19 | 20 | 21 | bin\Never.Host.xml 22 | 23 | -------------------------------------------------------------------------------- /src/Never.MemCached/BinaryProtocols/Endian.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Memcached.BinaryProtocols 8 | { 9 | 10 | /// 11 | /// 字节序枚举 12 | /// 13 | public enum Endian 14 | { 15 | /// 16 | /// 大端字节序 17 | /// 18 | BigEndian, 19 | 20 | /// 21 | /// 小端字节序 22 | /// 23 | LittleEndian 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/Never.MemCached/BinaryProtocols/EndianAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Memcached.BinaryProtocols 8 | { 9 | /// 10 | /// 字节序特性 11 | /// 12 | [AttributeUsage(AttributeTargets.Field)] 13 | public class EndianAttribute : Attribute 14 | { 15 | /// 16 | /// 标记字段的字节序 17 | /// 18 | public Endian Endianness { get; private set; } 19 | 20 | /// 21 | /// 构造函数 22 | /// 23 | /// 字节序 24 | public EndianAttribute(Endian endianness) 25 | { 26 | this.Endianness = endianness; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Never.MemCached/BinaryProtocols/Magic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Memcached.BinaryProtocols 8 | { 9 | /// 10 | /// 11 | /// 12 | public enum Magic : byte 13 | { 14 | /// 15 | /// 请求 16 | /// 17 | Request = 0x80, 18 | 19 | /// 20 | /// 响应 21 | /// 22 | Response = 0x81, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Never.MemCached/BinaryProtocols/ResponseStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Memcached.BinaryProtocols 8 | { 9 | 10 | /// 11 | /// 状态 12 | /// 13 | public enum ResponseStatus : short 14 | { 15 | NoError = 0x0000, 16 | KeyNotFound = 0x0001, 17 | KeyExists = 0x0002, 18 | ValueTooLarge = 0x0003, 19 | InvalidArguments = 0x0004, 20 | ItemNotStored = 0x0005, 21 | IncrDecrOnNonNumericValue = 0x0006, 22 | TheVbucketBelongsToAnotherServer = 0x0007, 23 | AuthenticationError = 0x0008, 24 | AuthenticationContinue = 0x0009, 25 | UnknownCommand = 0x0081, 26 | OutOfMemory = 0x0082, 27 | NotSupported = 0x0083, 28 | InternalError = 0x0084, 29 | Busy = 0x0085, 30 | TemporaryFailure = 0x0086 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Never.MemCached/Command.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Memcached 8 | { 9 | public enum Command : byte 10 | { 11 | get = 0, 12 | set = 1, 13 | add = 2, 14 | replace = 3, 15 | delete = 4, 16 | increment = 5, 17 | decrement = 6, 18 | quit = 7, 19 | flush = 8, 20 | getq = 9, 21 | noop = 10, 22 | version = 11, 23 | getk = 12, 24 | getkq = 13, 25 | append = 14, 26 | prepend = 15, 27 | stat = 16, 28 | setq = 17, 29 | addq = 18, 30 | replaceq = 19, 31 | deleteq = 20, 32 | incrementq = 21, 33 | decrementq = 22, 34 | quitq = 23, 35 | flushq = 24, 36 | appendq = 25, 37 | prependq = 26, 38 | sasllist = 32, 39 | saslstart = 33, 40 | saslstep = 34 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Never.MemCached/Never.Memcached.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | net461; 6 | netstandard2.0; 7 | 8 | 9 | 10 | 11 | true 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/Never.MemCached/SocketSetting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Memcached 8 | { 9 | /// 10 | /// 11 | /// 12 | public class SocketSetting 13 | { 14 | /// 15 | /// socket接受数据缓存区大小(8k) 16 | /// 17 | public int ReceiveBufferSize { get; set; } = 1024 * 8; 18 | 19 | /// 20 | /// socket发送数据缓存区大小(8k) 21 | /// 22 | public int SendBufferSize { get; set; } = 1024 * 8; 23 | 24 | /// 25 | /// 连接池中最大个socket活动 26 | /// 27 | public int MaxPoolBufferSize { get; set; } = 10; 28 | 29 | /// 30 | /// 心跳时间 31 | /// 32 | public TimeSpan KeepAlivePeriod { get; set; } = TimeSpan.FromMinutes(10); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Never.MemCached/TargetTypeFlagAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Memcached 8 | { 9 | /// 10 | /// 类型 11 | /// 12 | public class TargetTypeFlagAttribute : Attribute 13 | { 14 | public Type Type { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Never.Web.Mvc/Attributes/CommaSeparatedModelBinderAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Web.Mvc.Attributes 4 | { 5 | 6 | #if !NET461 7 | /// 8 | /// 逗号分割绑定类型 9 | /// 10 | public class CommaSeparatedModelBinderAttribute : Microsoft.AspNetCore.Mvc.ModelBinderAttribute 11 | { 12 | public CommaSeparatedModelBinderAttribute() : base(typeof(CommaSeparatedModelBinder)) 13 | { 14 | 15 | } 16 | } 17 | #else 18 | /// 19 | /// 逗号分割绑定类型 20 | /// 21 | public class CommaSeparatedModelBinderAttribute : System.Web.Mvc.CustomModelBinderAttribute 22 | { 23 | /// 24 | /// 返回Model绑定接口对象 25 | /// 26 | /// 27 | public override System.Web.Mvc.IModelBinder GetBinder() 28 | { 29 | return new CommaSeparatedModelBinder(); 30 | } 31 | } 32 | #endif 33 | } -------------------------------------------------------------------------------- /src/Never.Web.Mvc/DataAnnotations/StartupService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Never.Web.Mvc.DataAnnotations 7 | { 8 | /// 9 | /// 10 | /// 11 | internal class StartupService : Never.Startups.IStartupService 12 | { 13 | #region ctor 14 | 15 | /// 16 | /// 17 | /// 18 | public StartupService() 19 | { 20 | } 21 | 22 | #endregion ctor 23 | 24 | #region IStartupService 25 | 26 | /// 27 | /// 28 | /// 29 | /// 30 | void Startups.IStartupService.OnStarting(Startups.StartupContext context) 31 | { 32 | context.ProcessType(new TypeProcessor()); 33 | } 34 | 35 | /// 36 | /// 37 | /// 38 | int Startups.IStartupService.Order 39 | { 40 | get { return 120; } 41 | } 42 | 43 | #endregion IStartupService 44 | } 45 | } -------------------------------------------------------------------------------- /src/Never.Web.Mvc/Dispatcher/ActionResultMetadata.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace Never.Web.Mvc.Dispatcher 5 | { 6 | /// 7 | /// actionresult资源 8 | /// 9 | public struct ActionResultMetadata 10 | { 11 | /// 12 | /// 当前控制器名字 13 | /// 14 | public string ControllerName { get; set; } 15 | 16 | /// 17 | /// 当前控制器类型 18 | /// 19 | public Type ControllerType { get; set; } 20 | 21 | /// 22 | /// 当前Action方法 23 | /// 24 | public MethodInfo ActionMethod { get; set; } 25 | 26 | /// 27 | /// 区域名,如果支持的话 28 | /// 29 | public string AreaName { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Never.Web.Mvc/IHttpActionResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.Web.Mvc 9 | { 10 | #if !NET461 11 | 12 | /// 13 | /// 方法结果 14 | /// 15 | public interface IHttpActionResult : Microsoft.AspNetCore.Mvc.IActionResult 16 | { 17 | } 18 | #else 19 | 20 | using System.Web.Mvc; 21 | 22 | /// 23 | /// 方法结果 24 | /// 25 | public interface IHttpActionResult 26 | { 27 | /// 28 | /// 启用对操作方法结果的处理 29 | /// 30 | /// 用于执行结果的上下文。上下文信息包括控制器、HTTP 内容、请求上下文和路由数据 31 | void ExecuteResult(ControllerContext context); 32 | } 33 | 34 | #endif 35 | } -------------------------------------------------------------------------------- /src/Never.Web.Mvc/IoC/ApiServiceProvider.cs: -------------------------------------------------------------------------------- 1 | #if !NET461 2 | using Microsoft.Extensions.DependencyInjection; 3 | using Never.IoC.Injections; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace Never.Web.Mvc.IoC 11 | { 12 | public class ApiServiceProvider : Never.IoC.Injections.ServiceProvider, ISupportRequiredService 13 | { 14 | private readonly Never.IoC.ILifetimeScope scope = null; 15 | 16 | public ApiServiceProvider(Never.IoC.ILifetimeScope scope) : base(scope) 17 | { 18 | this.scope = scope; 19 | } 20 | } 21 | } 22 | #endif -------------------------------------------------------------------------------- /src/Never.Web.Mvc/IoC/ApiServiceScope.cs: -------------------------------------------------------------------------------- 1 | #if !NET461 2 | using Microsoft.Extensions.DependencyInjection; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Never.Web.Mvc.IoC 10 | { 11 | public class ApiServiceScope : IServiceScope 12 | { 13 | private readonly Never.IoC.ILifetimeScope scope = null; 14 | 15 | public ApiServiceScope(Never.IoC.ILifetimeScope scope) 16 | { 17 | this.scope = scope; 18 | this.ServiceProvider = new ApiServiceProvider(scope); 19 | } 20 | 21 | public IServiceProvider ServiceProvider { get; } 22 | 23 | public void Dispose() 24 | { 25 | scope.Dispose(); 26 | } 27 | } 28 | } 29 | #endif -------------------------------------------------------------------------------- /src/Never.Web.Mvc/IoC/ApiServiceScopeFactory.cs: -------------------------------------------------------------------------------- 1 | #if !NET461 2 | using Microsoft.Extensions.DependencyInjection; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Never.Web.Mvc.IoC 10 | { 11 | public class ApiServiceScopeFactory : IServiceScopeFactory 12 | { 13 | private readonly Never.IoC.IServiceLocator serviceLocator = null; 14 | 15 | public ApiServiceScopeFactory(Never.IoC.IServiceLocator serviceLocator) 16 | { 17 | this.serviceLocator = serviceLocator; 18 | } 19 | 20 | public IServiceScope CreateScope() 21 | { 22 | return new ApiServiceScope(this.serviceLocator.BeginLifetimeScope()); 23 | } 24 | } 25 | } 26 | #endif -------------------------------------------------------------------------------- /src/Never.Web.Mvc/IoC/ApiStartService.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Never.Web.Mvc.IoC 4 | { 5 | internal class ApiStartService : Never.Startups.IStartupService 6 | { 7 | /// 8 | /// 9 | /// 10 | /// 11 | public void OnStarting(Startups.StartupContext context) 12 | { 13 | context.ServiceRegister.RegisterMvcControllers(context.FilteringAssemblyProvider.GetAssemblies().ToArray()); 14 | } 15 | 16 | /// 17 | /// 18 | /// 19 | public int Order 20 | { 21 | get { return 35; } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Never.Web.WebApi/Attributes/CommaSeparatedModelBinderAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Web.WebApi.Attributes 4 | { 5 | 6 | #if !NET461 7 | /// 8 | /// 逗号分割绑定类型 9 | /// 10 | public class CommaSeparatedModelBinderAttribute : Microsoft.AspNetCore.Mvc.ModelBinderAttribute 11 | { 12 | public CommaSeparatedModelBinderAttribute() : base(typeof(CommaSeparatedModelBinder)) 13 | { 14 | 15 | } 16 | } 17 | #else 18 | /// 19 | /// 逗号分割绑定类型 20 | /// 21 | public class CommaSeparatedModelBinderAttribute : System.Web.Http.ModelBinding.CustomModelBinderAttribute 22 | { 23 | /// 24 | /// 返回Model绑定接口对象 25 | /// 26 | /// 27 | public override System.Web.Http.ModelBinding.IModelBinder GetBinder() 28 | { 29 | return new CommaSeparatedModelBinder(); 30 | } 31 | } 32 | #endif 33 | } -------------------------------------------------------------------------------- /src/Never.Web.WebApi/DataAnnotations/StartupService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Never.IoC; 6 | 7 | namespace Never.Web.WebApi.DataAnnotations 8 | { 9 | /// 10 | /// 11 | /// 12 | internal class StartupService : Never.Startups.IStartupService 13 | { 14 | #region ctor 15 | 16 | /// 17 | /// 18 | /// 19 | public StartupService() 20 | { 21 | } 22 | 23 | #endregion ctor 24 | 25 | #region IStartupService 26 | 27 | /// 28 | /// 29 | /// 30 | /// 31 | void Startups.IStartupService.OnStarting(Startups.StartupContext context) 32 | { 33 | context.ProcessType(new TypeProcessor()); 34 | } 35 | 36 | /// 37 | /// 38 | /// 39 | int Startups.IStartupService.Order 40 | { 41 | get { return 120; } 42 | } 43 | 44 | #endregion IStartupService 45 | } 46 | } -------------------------------------------------------------------------------- /src/Never.Web.WebApi/Dispatcher/ActionResultMetadata.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Text; 6 | 7 | namespace Never.Web.WebApi.Dispatcher 8 | { 9 | /// 10 | /// actionresult资源 11 | /// 12 | public struct ActionResultMetadata 13 | { 14 | /// 15 | /// 当前控制器名字 16 | /// 17 | public string ControllerName { get; set; } 18 | 19 | /// 20 | /// 当前控制器类型 21 | /// 22 | public Type ControllerType { get; set; } 23 | 24 | /// 25 | /// 当前Action方法 26 | /// 27 | public MethodInfo ActionMethod { get; set; } 28 | 29 | /// 30 | /// 区域名,如果支持的话 31 | /// 32 | public string AreaName { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Never.Web.WebApi/Encryptions/IApiContentEncryptor.cs: -------------------------------------------------------------------------------- 1 | using Never.Web.Encryptions; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Net.Http; 7 | using System.Text; 8 | 9 | namespace Never.Web.WebApi.Encryptions 10 | { 11 | /// 12 | /// 加密与解密内容 13 | /// 14 | public interface IApiContentEncryptor : IContentEncryptor 15 | { 16 | /// 17 | /// 当前是否可以适用加密与解密 18 | /// 19 | /// 20 | bool IsValid(HttpRequestMessage request); 21 | } 22 | } -------------------------------------------------------------------------------- /src/Never.Web.WebApi/Encryptions/UnAuthorizeApiContentEncryptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net.Http; 5 | using System.Text; 6 | 7 | namespace Never.Web.WebApi.Encryptions 8 | { 9 | /// 10 | /// 不授权的加密与解密 11 | /// 12 | public sealed class UnAuthorizeApiContentEncryptor : Never.Web.Encryptions.UnAuthorizeContentEncryptor, IApiContentEncryptor 13 | { 14 | /// 15 | /// 是否可用 16 | /// 17 | /// 18 | /// 19 | public bool IsValid(HttpRequestMessage request) 20 | { 21 | return false; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Never.Web.WebApi/IHttpActionResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net.Http; 5 | using System.Text; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | 9 | namespace Never.Web.WebApi 10 | { 11 | #if !NET461 12 | 13 | /// 14 | /// 表示是一个执行结果信息 15 | /// 16 | public interface IHttpActionResult : Microsoft.AspNetCore.Mvc.IActionResult 17 | { 18 | } 19 | #else 20 | 21 | /// 22 | /// 表示是一个执行结果信息 23 | /// 24 | public interface IHttpActionResult : System.Web.Http.IHttpActionResult 25 | { 26 | 27 | } 28 | 29 | #endif 30 | } -------------------------------------------------------------------------------- /src/Never.Web.WebApi/IoC/ApiServiceProvider.cs: -------------------------------------------------------------------------------- 1 | #if !NET461 2 | using Microsoft.Extensions.DependencyInjection; 3 | using Never.IoC.Injections; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace Never.Web.WebApi.IoC 11 | { 12 | public class ApiServiceProvider : Never.IoC.Injections.ServiceProvider, ISupportRequiredService 13 | { 14 | private readonly Never.IoC.ILifetimeScope scope = null; 15 | 16 | public ApiServiceProvider(Never.IoC.ILifetimeScope scope) : base(scope) 17 | { 18 | this.scope = scope; 19 | } 20 | } 21 | } 22 | #endif -------------------------------------------------------------------------------- /src/Never.Web.WebApi/IoC/ApiServiceScope.cs: -------------------------------------------------------------------------------- 1 | #if !NET461 2 | using Microsoft.Extensions.DependencyInjection; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Never.Web.WebApi.IoC 10 | { 11 | public class ApiServiceScope : IServiceScope 12 | { 13 | private readonly Never.IoC.ILifetimeScope scope = null; 14 | 15 | public ApiServiceScope(Never.IoC.ILifetimeScope scope) 16 | { 17 | this.scope = scope; 18 | this.ServiceProvider = new ApiServiceProvider(scope); 19 | } 20 | 21 | public IServiceProvider ServiceProvider { get; } 22 | 23 | public void Dispose() 24 | { 25 | scope.Dispose(); 26 | } 27 | } 28 | } 29 | #endif -------------------------------------------------------------------------------- /src/Never.Web.WebApi/IoC/ApiServiceScopeFactory.cs: -------------------------------------------------------------------------------- 1 | #if !NET461 2 | using Microsoft.Extensions.DependencyInjection; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Never.Web.WebApi.IoC 10 | { 11 | public class ApiServiceScopeFactory : IServiceScopeFactory 12 | { 13 | private readonly Never.IoC.IServiceLocator serviceLocator = null; 14 | 15 | public ApiServiceScopeFactory(Never.IoC.IServiceLocator serviceLocator) 16 | { 17 | this.serviceLocator = serviceLocator; 18 | } 19 | 20 | public IServiceScope CreateScope() 21 | { 22 | return new ApiServiceScope(this.serviceLocator.BeginLifetimeScope()); 23 | } 24 | } 25 | } 26 | #endif -------------------------------------------------------------------------------- /src/Never.Web.WebApi/IoC/ApiStartService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Never.Web.WebApi.IoC 7 | { 8 | internal class ApiStartService : Never.Startups.IStartupService 9 | { 10 | /// 11 | /// 12 | /// 13 | /// 14 | public void OnStarting(Startups.StartupContext context) 15 | { 16 | context.ServiceRegister.RegisterApiControllers(context.FilteringAssemblyProvider.GetAssemblies().ToArray()); 17 | } 18 | /// 19 | /// 20 | /// 21 | public int Order 22 | { 23 | get { return 35; } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Never.Web/Fakes/HttpContextWrapper.cs: -------------------------------------------------------------------------------- 1 | #if !NET461 2 | #else 3 | 4 | using System; 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using System.IO; 8 | using System.Security.Principal; 9 | using System.Text; 10 | using System.Web; 11 | 12 | namespace Never.Web.Fakes 13 | { 14 | /// 15 | /// 伪造httpcontext请求 16 | /// 17 | public class HttpContextWrapper : System.Web.HttpContextWrapper 18 | { 19 | #region ctor 20 | 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | public HttpContextWrapper() 25 | : base(HttpContext.Current != null ? HttpContext.Current : new HttpContext(new HttpRequest("", "http://localhost", ""), new HttpResponse(new StringWriter()))) 26 | { 27 | } 28 | 29 | #endregion ctor 30 | } 31 | } 32 | 33 | #endif -------------------------------------------------------------------------------- /src/Never.Web/Sessions/SessionStateActions.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Web.Sessions 2 | { 3 | /// 4 | /// 标识数据存储区中的会话项的是否为需要初始化的会话。 5 | /// 6 | public enum SessionStateActions 7 | { 8 | /// 9 | /// 任何初始化操作不需要由调用的代码执行。 10 | /// 11 | None = 0, 12 | 13 | /// 14 | /// 数据存储区中的会话项是为需要初始化会话。 15 | /// 16 | InitializeItem = 1 17 | } 18 | } -------------------------------------------------------------------------------- /src/Never.Web/Sessions/SessionStateList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace Never.Web.Sessions 5 | { 6 | /// 7 | /// 存储Session对象模型 8 | /// 9 | [Serializable] 10 | [DataContract] 11 | public class SessionStateList 12 | { 13 | #region property 14 | 15 | /// 16 | /// 还有多少时间过期(以分钟为单位) 17 | /// 18 | [DataMember(Name = "ExpireDate", Order = 1)] 19 | public DateTime ExpireDate { get; set; } 20 | 21 | /// 22 | /// session列表 23 | /// 24 | 25 | [DataMember(Name = "SessionModels", Order = 2)] 26 | public SessionState[] SessionModels { get; set; } 27 | 28 | #endregion property 29 | 30 | #region ctor 31 | 32 | /// 33 | /// 34 | /// 35 | public SessionStateList() 36 | { 37 | this.ExpireDate = DateTime.Now; 38 | this.SessionModels = new SessionState[0]; 39 | } 40 | 41 | #endregion ctor 42 | } 43 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/App_Data/mysql.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shelldudu/never/ee9eb8560e2e75461e539604947a9aa6b78e2688/src/Never.WorkFlow/App_Data/mysql.sql -------------------------------------------------------------------------------- /src/Never.WorkFlow/App_Data/sqlserver.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shelldudu/never/ee9eb8560e2e75461e539604947a9aa6b78e2688/src/Never.WorkFlow/App_Data/sqlserver.sql -------------------------------------------------------------------------------- /src/Never.WorkFlow/Attributes/WorkStepAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.WorkFlow.Attributes 4 | { 5 | /// 6 | /// 工作单元描述 7 | /// 8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] 9 | public sealed class WorkStepAttribute : Attribute 10 | { 11 | /// 12 | /// 描述 13 | /// 14 | public string Sumarry { get; set; } 15 | 16 | /// 17 | /// 工作内容介绍 18 | /// 19 | public string Introduce { get; set; } 20 | 21 | /// 22 | /// 唯一编号 23 | /// 24 | public string UniqueId { get; set; } 25 | 26 | /// 27 | /// uniqueId 请使用唯一,否则报错,可以使用随即字符,但也不要过长,避免数据库膨胀 28 | /// 29 | public WorkStepAttribute(string uniqueId) 30 | { 31 | this.UniqueId = uniqueId; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/CoordinationMode.cs: -------------------------------------------------------------------------------- 1 | namespace Never.WorkFlow 2 | { 3 | /// 4 | /// 协同方式,多个工作流是同时完成还是单一完成 5 | /// 6 | public enum CoordinationMode : byte 7 | { 8 | /// 9 | /// 任何一种 10 | /// 11 | Any = 0, 12 | 13 | /// 14 | /// 同时完成 15 | /// 16 | Meanwhile = 1, 17 | } 18 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/Coordinations/DefaultSerialTaskStrategy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.WorkFlow.Coordinations 4 | { 5 | /// 6 | /// 并发任务执行策略,当前使用锁定taskId策略 7 | /// 8 | public class DefaultSerialTaskStrategy : ISerialTaskStrategy 9 | { 10 | /// 11 | /// 开始任务 12 | /// 13 | /// 任务 14 | /// 回调 15 | /// 16 | public void LockAndInvoke(ITaskschedNode task, Action callback) 17 | { 18 | if (task == null) 19 | { 20 | if (callback != null) 21 | callback.Invoke(); 22 | 23 | return; 24 | } 25 | 26 | lock (task.TaskId.ToString()) 27 | { 28 | if (callback != null) 29 | callback.Invoke(); 30 | 31 | return; 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/Exceptions/TemplateNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Never.WorkFlow.Exceptions 5 | { 6 | /// 7 | /// 模板内容没有找到 8 | /// 9 | [Serializable] 10 | public class TemplateNotFoundException : KeyNotFoundException 11 | { 12 | /// 13 | /// 14 | /// 15 | /// 16 | /// 17 | public TemplateNotFoundException(string messageFormat, string[] message) 18 | : base(string.Format(messageFormat, message)) 19 | { 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/ISerialTaskStrategy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.WorkFlow 4 | { 5 | /// 6 | /// 并发任务执行策略 7 | /// 8 | public interface ISerialTaskStrategy 9 | { 10 | /// 11 | /// 开始任务 12 | /// 13 | /// 任务 14 | /// 回调 15 | /// 16 | void LockAndInvoke(ITaskschedNode task, Action callback); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/ITaskschedEngine.cs: -------------------------------------------------------------------------------- 1 | using Never.WorkFlow.Coordinations; 2 | using System; 3 | 4 | namespace Never.WorkFlow 5 | { 6 | /// 7 | /// 任务引擎 8 | /// 9 | public interface ITaskschedEngine 10 | { 11 | /// 12 | /// 执行该队列下所有任务 13 | /// 14 | /// 15 | void Execute(Guid taskId); 16 | 17 | /// 18 | /// 执行该队列下所有任务 19 | /// 20 | /// 21 | void Execute(TaskschedNode task); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/ITemplateEngine.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.WorkFlow 4 | { 5 | /// 6 | /// 模板引擎接口 7 | /// 8 | public interface ITemplateEngine 9 | { 10 | /// 11 | /// 登记模板 12 | /// 13 | /// 模板 14 | void Register(Template template); 15 | 16 | /// 17 | /// 查询登记模板 18 | /// 19 | /// 模板名字 20 | /// 21 | Template Select(string templateName); 22 | 23 | /// 24 | /// 兼容性事件测试 25 | /// 26 | event EventHandler TestCompliant; 27 | 28 | /// 29 | /// 准备好了 30 | /// 31 | /// 32 | void Startup(); 33 | } 34 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/IWorkContextCleaner.cs: -------------------------------------------------------------------------------- 1 | namespace Never.WorkFlow 2 | { 3 | /// 4 | /// 每一步清理一下环境 5 | /// 6 | public interface IWorkContextCleaner 7 | { 8 | /// 9 | /// 每一步完成清理 10 | /// 11 | void StepClear(); 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/IWorkStep.cs: -------------------------------------------------------------------------------- 1 | namespace Never.WorkFlow 2 | { 3 | /// 4 | /// 每一个工作步骤 5 | /// 6 | public interface IWorkStep 7 | { 8 | /// 9 | /// 执行工作 10 | /// 11 | /// 上下文 12 | /// 上一个工作执行的结果 13 | /// 14 | IWorkStepMessage Execute(IWorkContext context, IWorkStepMessage preResult); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/IWorkStepMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.WorkFlow 4 | { 5 | /// 6 | /// 工作流消息,如果消息要等待的,请返回该类型 7 | /// 8 | public interface IWorkStepMessage : Never.Messages.IMessage 9 | { 10 | /// 11 | /// 任务号,具体对象最好设置set方法 12 | /// 13 | Guid TaskId { get; } 14 | 15 | /// 16 | /// 附加状态 17 | /// 18 | int AttachState { get; } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/IWorkStepMessageValidateContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | 4 | namespace Never.WorkFlow 5 | { 6 | /// 7 | /// 消息验证上下文 8 | /// 9 | public interface IWorkStepMessageValidateContext 10 | { 11 | /// 12 | /// 参数验证规则 13 | /// 14 | /// 15 | /// 16 | /// 17 | void ParamaterRule(Expression> express, string message) where T : IWorkStepMessage; 18 | } 19 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/IWorkStepMessageValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Never.WorkFlow 2 | { 3 | /// 4 | /// 消息验证 5 | /// 6 | public interface IWorkStepMessageValidator 7 | { 8 | /// 9 | /// 验证消息 10 | /// 11 | /// 消息验证上下文 12 | void Validate(IWorkStepMessageValidateContext context); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/Messages/EmptyAndAbortedWorkStepMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.WorkFlow.Messages 4 | { 5 | /// 6 | /// 空但并且是中断的消息 7 | /// 8 | [Serializable] 9 | public sealed class EmptyAndAbortedWorkStepMessage : IWorkStepMessage 10 | { 11 | /// 12 | /// 任务id 13 | /// 14 | public Guid TaskId { get; set; } 15 | 16 | /// 17 | /// 用户签名 18 | /// 19 | public string UserSign { get; set; } 20 | 21 | /// 22 | /// 命令类型 23 | /// 24 | public string CommandType { get; set; } 25 | 26 | /// 27 | /// 中断消息 28 | /// 29 | public string Message { get; set; } 30 | 31 | /// 32 | /// 附加状态 33 | /// 34 | public int AttachState { get; set; } 35 | } 36 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/Messages/EmptyButWaitingWorkStepMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.WorkFlow.Messages 4 | { 5 | /// 6 | /// 空但是要等待的消息 7 | /// 8 | [Serializable] 9 | public sealed class EmptyButWaitingWorkStepMessage : IWorkStepMessage 10 | { 11 | /// 12 | /// 任务id 13 | /// 14 | public Guid TaskId { get; set; } 15 | 16 | /// 17 | /// 用户签名 18 | /// 19 | public string UserSign { get; set; } 20 | 21 | /// 22 | /// 命令类型 23 | /// 24 | public string CommandType { get; set; } 25 | 26 | /// 27 | /// 中断消息 28 | /// 29 | public string Message { get; set; } 30 | 31 | /// 32 | /// 附加状态 33 | /// 34 | public int AttachState { get; set; } 35 | } 36 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/Messages/ExecutingErrorWorkStepMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.WorkFlow.Messages 4 | { 5 | /// 6 | /// 执行异常的消息 7 | /// 8 | [Serializable] 9 | public sealed class ExecutingErrorWorkStepMessage : IWorkStepMessage 10 | { 11 | /// 12 | /// 任务id 13 | /// 14 | public Guid TaskId { get; set; } 15 | 16 | /// 17 | /// 用户签名 18 | /// 19 | public string UserSign { get; set; } 20 | 21 | /// 22 | /// 命令类型 23 | /// 24 | public string CommandType { get; set; } 25 | 26 | /// 27 | /// 中断消息 28 | /// 29 | public Exception Exception { get; set; } 30 | 31 | /// 32 | /// 队列消息 33 | /// 34 | public string PushMessage { get; set; } 35 | 36 | /// 37 | /// 附加状态 38 | /// 39 | public int AttachState { get; set; } 40 | } 41 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/Messages/IMultipleWorkStepMessage.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Never.WorkFlow.Messages 4 | { 5 | /// 6 | /// 多个消息内容的工作流消息 7 | /// 8 | public interface IMultipleWorkStepMessage : IWorkStepMessage 9 | { 10 | /// 11 | /// 消息集合 12 | /// 13 | IEnumerable Messages { get; } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/Messages/MeanwhileWorkStepMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Never.WorkFlow.Messages 5 | { 6 | /// 7 | /// 多个消息内容的工作流消息,不要返回该实例 8 | /// 9 | [Serializable] 10 | [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 11 | public sealed class MeanwhileWorkStepMessage : IWorkStepMessage 12 | { 13 | /// 14 | /// 任务id 15 | /// 16 | public Guid TaskId { get; set; } 17 | 18 | /// 19 | /// 附加状态 20 | /// 21 | public int AttachState { get; set; } 22 | 23 | /// 24 | /// 消息集合 25 | /// 26 | public List Messages { get; set; } 27 | 28 | /// 29 | /// 30 | /// 31 | public MeanwhileWorkStepMessage() 32 | { 33 | this.Messages = new List(5); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/Never.WorkFlow.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | net461; 6 | netstandard2.0; 7 | 8 | 9 | 10 | 11 | bin\Never.WorkFlow.xml 12 | 13 | 14 | 15 | bin\Never.WorkFlow.xml 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Always 27 | 28 | 29 | Always 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/Never.WorkFlow/TaskschedNodeSearch.cs: -------------------------------------------------------------------------------- 1 | namespace Never.WorkFlow 2 | { 3 | /// 4 | /// 任务搜索节点 5 | /// 6 | public class TaskschedNodeSearch : PagedSearch 7 | { 8 | /// 9 | /// 用户标识 10 | /// 11 | public string UserSign { get; set; } 12 | 13 | /// 14 | /// 命令类型 15 | /// 16 | public string CommandType { get; set; } 17 | 18 | /// 19 | /// 工作状态 20 | /// 21 | public TaskschedStatus[] StatusArray { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/TaskschedStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Never.WorkFlow 2 | { 3 | /// 4 | /// 节点状态,注意在仓库中会固定某些值,所在修改的时候要注意点 5 | /// 6 | public enum TaskschedStatus : byte 7 | { 8 | /// 9 | /// 正在工作 10 | /// 11 | Working = 0, 12 | 13 | /// 14 | /// 完成 15 | /// 16 | Finish = 2, 17 | 18 | /// 19 | /// 中止计划 20 | /// 21 | Abort = 3, 22 | } 23 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/WorkFlowStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Never.WorkFlow 2 | { 3 | /// 4 | /// 工作状态 5 | /// 6 | public enum WorkFlowStatus : byte 7 | { 8 | /// 9 | /// 正在初始化 10 | /// 11 | Initing = 0, 12 | 13 | /// 14 | /// 已启动 15 | /// 16 | Started = 1, 17 | 18 | /// 19 | /// 忆关闭 20 | /// 21 | Stoped = 2, 22 | } 23 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/WorkSteps/BeginWorkStep.cs: -------------------------------------------------------------------------------- 1 | using Never.WorkFlow.Attributes; 2 | 3 | namespace Never.WorkFlow.WorkSteps 4 | { 5 | /// 6 | /// 工作的第一步 7 | /// 8 | [WorkStep("aa1b00b7cf4e", Introduce = "开始工作流的第一步,通常是测试环境", Sumarry = "工作流第一步")] 9 | public sealed class BeginWorkStep : IWorkStep 10 | { 11 | /// 12 | /// 执行工作 13 | /// 14 | /// 上下文 15 | /// 上一个工作执行的结果 16 | /// 17 | public IWorkStepMessage Execute(IWorkContext context, IWorkStepMessage preResult) 18 | { 19 | return preResult; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Never.WorkFlow/WorkSteps/EndWorkStep.cs: -------------------------------------------------------------------------------- 1 | using Never.WorkFlow.Attributes; 2 | 3 | namespace Never.WorkFlow.WorkSteps 4 | { 5 | /// 6 | /// 工作的最后一步 7 | /// 8 | [WorkStep("aa1b00b7d77f", Introduce = "开始最后一步表示结束状态", Sumarry = "工作流最后一步")] 9 | public sealed class EndWorkStep : IWorkStep 10 | { 11 | /// 12 | /// 执行工作 13 | /// 14 | /// 上下文 15 | /// 上一个工作执行的结果 16 | /// 17 | public IWorkStepMessage Execute(IWorkContext context, IWorkStepMessage preResult) 18 | { 19 | return preResult; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Never.WorkerService/IoC/ApiServiceProvider.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Never.IoC.Injections; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Never.WorkerService.IoC 10 | { 11 | public class ApiServiceProvider : Never.IoC.Injections.ServiceProvider, ISupportRequiredService 12 | { 13 | private readonly Never.IoC.ILifetimeScope scope = null; 14 | 15 | public ApiServiceProvider(Never.IoC.ILifetimeScope scope) : base(scope) 16 | { 17 | this.scope = scope; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Never.WorkerService/Never.WorkerService.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | Never.WorkerService 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | bin\Never.Host.xml 19 | 20 | 21 | 22 | bin\Never.Host.xml 23 | 24 | -------------------------------------------------------------------------------- /src/Never/Aawsl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never 8 | { 9 | /// 10 | /// 带返回值的委托 11 | /// 12 | public delegate TResult ResultEventHandler(object sender, TEventArgs e) where TEventArgs : EventArgs; 13 | 14 | /// 15 | /// 带返回值的委托 16 | /// 17 | public delegate TResult ResultEventHandler(object sender, TEventArgs1 e1, TEventArgs2 e2) where TEventArgs1 : EventArgs where TEventArgs2 : EventArgs; 18 | 19 | /// 20 | /// 委托 21 | /// 22 | public delegate void VoidEventHandler(object sender, TEventArgs e) where TEventArgs : EventArgs; 23 | 24 | /// 25 | /// 委托 26 | /// 27 | public delegate void VoidEventHandler(object sender, TEventArgs1 e1, TEventArgs2 e2) where TEventArgs1 : EventArgs where TEventArgs2 : EventArgs; 28 | } 29 | -------------------------------------------------------------------------------- /src/Never/Aop/DefaultRuntimeMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Aop 4 | { 5 | /// 6 | /// 默认运行方式,不同环境应该有不同的运行方式,所有标准应该为:提供的值与当前相同(提供值为空则默认为相同)则工作,否则应视为不工作 7 | /// 8 | public class DefaultRuntimeMode : IRuntimeMode, IEquatable 9 | { 10 | /// 11 | /// 运行方式 12 | /// 13 | public string RuntimeMode { get; set; } 14 | 15 | /// 16 | /// 是否相等 17 | /// 18 | /// 19 | /// 20 | public bool Equals(DefaultRuntimeMode other) 21 | { 22 | return other != null && ObjectExtension.IsEquals(this.RuntimeMode, other.RuntimeMode); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Never/Aop/DomainFilters/CommandHandlerAuthorizeAttribute.cs: -------------------------------------------------------------------------------- 1 | using Never.Commands; 2 | using System; 3 | 4 | namespace Never.Aop.DomainFilters 5 | { 6 | /// 7 | /// 命令处理者授权验证 8 | /// 9 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] 10 | public class CommandHandlerAuthorizeAttribute : Attribute 11 | { 12 | /// 13 | /// 验证命令是否通过 14 | /// 15 | /// The context. 16 | /// The command. 17 | /// 18 | public virtual bool Validate(ICommandContext context, ICommand command) 19 | { 20 | return true; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Never/Aop/DomainFilters/CommandHandlerFilterAttribute.cs: -------------------------------------------------------------------------------- 1 | using Never.Commands; 2 | using System; 3 | 4 | namespace Never.Aop.DomainFilters 5 | { 6 | /// 7 | /// 命令处理者过滤器 8 | /// 9 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = false)] 10 | public class CommandHandlerFilterAttribute : Attribute, ICommandActionFilter 11 | { 12 | #region ICommandActionFilter 13 | 14 | /// 15 | /// 动作执行前 16 | /// 17 | /// 上下文 18 | /// 命令 19 | public virtual void OnActionExecuting(ICommandContext context, ICommand command) 20 | { 21 | #if DEBUG 22 | Console.WriteLine("command_action_p1"); 23 | #endif 24 | } 25 | 26 | #endregion ICommandActionFilter 27 | } 28 | } -------------------------------------------------------------------------------- /src/Never/Aop/DomainFilters/EventHandlerFilterAttribute.cs: -------------------------------------------------------------------------------- 1 | using Never.Events; 2 | using System; 3 | 4 | namespace Never.Aop.DomainFilters 5 | { 6 | /// 7 | /// 过滤器 8 | /// 9 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = false)] 10 | public class EventHandlerFilterAttribute : Attribute, IEventActionFilter 11 | { 12 | #region IEventActionFilter 13 | 14 | /// 15 | /// 动作执行前 16 | /// 17 | /// 上下文 18 | /// 事件 19 | public virtual void OnActionExecuting(Events.IEventContext context, IEvent e) 20 | { 21 | #if DEBUG 22 | Console.WriteLine("event_action"); 23 | #endif 24 | } 25 | 26 | #endregion IEventActionFilter 27 | } 28 | } -------------------------------------------------------------------------------- /src/Never/Aop/DomainFilters/EventHandlerPriorityAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Aop.DomainFilters 4 | { 5 | /// 6 | /// 事件处理优先级,里面的Order[排序,请设置为大于0,如果小于0,则当为1处理] 7 | /// 8 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 9 | public sealed class EventHandlerPriorityAttribute : Attribute 10 | { 11 | /// 12 | /// 排序,请设置为大于0,如果小于0,则当为1处理 13 | /// 14 | public int Order { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Never/Aop/DomainFilters/ICommandActionFilter.cs: -------------------------------------------------------------------------------- 1 | using Never.Commands; 2 | 3 | namespace Never.Aop.DomainFilters 4 | { 5 | /// 6 | /// 事件监听者执行事件前的动作过滤器 7 | /// 8 | public interface ICommandActionFilter 9 | { 10 | /// 11 | /// 动作执行前 12 | /// 13 | /// 上下文 14 | /// 命令 15 | void OnActionExecuting(ICommandContext context, ICommand command); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Never/Aop/DomainFilters/IEventActionFilter.cs: -------------------------------------------------------------------------------- 1 | using Never.Events; 2 | 3 | namespace Never.Aop.DomainFilters 4 | { 5 | /// 6 | /// 事件监听者执行事件前的动作过滤器 7 | /// 8 | public interface IEventActionFilter 9 | { 10 | /// 11 | /// 动作执行前 12 | /// 13 | /// 上下文 14 | /// 事件 15 | void OnActionExecuting(IEventContext context, IEvent e); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Never/Aop/DynamicProxy/Builders/IllusiveMockBuilder.Generic.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Never.Aop.DynamicProxy.Builders 4 | { 5 | /// 6 | /// 构建T对象的虚拟实现 7 | /// 8 | public class IllusiveMockBuilder : IllusiveMockBuilder 9 | { 10 | #region ctor 11 | 12 | internal IllusiveMockBuilder(List rules) : base(rules, typeof(Target)) 13 | { 14 | } 15 | 16 | #endregion ctor 17 | } 18 | } -------------------------------------------------------------------------------- /src/Never/Aop/IInterceptor.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Aop 2 | { 3 | /// 4 | /// 拦截接口 5 | /// 6 | public interface IInterceptor 7 | { 8 | /// 9 | /// 在对方法进行调用前 10 | /// 11 | /// 调用信息 12 | void PreProceed(IInvocation invocation); 13 | 14 | /// 15 | /// 对方法进行调用后 16 | /// 17 | /// 调用信息 18 | void PostProceed(IInvocation invocation); 19 | } 20 | } -------------------------------------------------------------------------------- /src/Never/Aop/IRuntimeMode.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Aop 2 | { 3 | /// 4 | /// 运行方式,不同环境应该有不同的运行方式,所有标准应该为:提供的值与当前相同(提供值为空则默认为相同)则工作,否则应视为不工作 5 | /// 6 | public interface IRuntimeMode 7 | { 8 | /// 9 | /// 运行方式 10 | /// 11 | string RuntimeMode { get; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never/Aop/IRuntimeModeProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Aop 2 | { 3 | /// 4 | /// 运行方式提供者,不同环境应该有不同的运行方式,所有标准应该为:提供的值与当前相同(提供值为空则默认为相同)则工作,否则应视为不工作 5 | /// 6 | public interface IRuntimeModeProvider 7 | { 8 | /// 9 | /// 当前环境的运行方式 10 | /// 11 | IRuntimeMode[] RuntimeModeArray { get; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never/Aop/InterceptCompileSetting.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Aop 2 | { 3 | /// 4 | /// 拦截器编译配置 5 | /// 6 | public struct InterceptCompileSetting 7 | { 8 | /// 9 | /// 对参数进行装箱,默认为false 10 | /// 11 | public bool BoxArgument { get; set; } 12 | 13 | /// 14 | /// 是否存储参数,默认为false,因为参数不确定性,会影响性能,所以没有必要所有代理均需要获取参数 15 | /// 16 | public bool StoreArgument { get; set; } 17 | 18 | /// 19 | /// 没有调用信息 20 | /// 21 | public bool NoInvocation { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Never/Aop/StandardInterceptor.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Aop 2 | { 3 | /// 4 | /// 基本的拦截器 5 | /// 6 | public class StandardInterceptor : IInterceptor 7 | { 8 | /// 9 | /// 在对方法进行调用前 10 | /// 11 | /// 12 | public virtual void PreProceed(IInvocation invocation) 13 | { 14 | } 15 | 16 | /// 17 | /// 对方法进行调用后 18 | /// 19 | /// 20 | public virtual void PostProceed(IInvocation invocation) 21 | { 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Never/ApiStatus.cs: -------------------------------------------------------------------------------- 1 | using Never.Attributes; 2 | 3 | namespace Never 4 | { 5 | /// 6 | /// 结果状态 7 | /// 8 | public enum ApiStatus 9 | { 10 | /// 11 | /// 错误 12 | /// 13 | [Remark(Name = "错误")] 14 | Error = -1, 15 | 16 | /// 17 | /// 失败 18 | /// 19 | [Remark(Name = "失败")] 20 | Fail = 0, 21 | 22 | /// 23 | /// 成功 24 | /// 25 | [Remark(Name = "成功")] 26 | Success = 1 27 | } 28 | } -------------------------------------------------------------------------------- /src/Never/Attributes/ApiAreaRemarkAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Attributes 4 | { 5 | /// 6 | /// API区域资源标识 7 | /// 8 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 9 | public sealed class ApiAreaRemarkAttribute : Attribute 10 | { 11 | /// 12 | /// 区域名字 13 | /// 14 | public string Area { get; set; } 15 | 16 | /// 17 | /// 18 | /// 19 | /// 20 | public ApiAreaRemarkAttribute(string area) 21 | { 22 | this.Area = area; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Never/Attributes/CanBeNullAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Attributes 4 | { 5 | /// 6 | /// 指示对象可以为空 7 | /// 8 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Field | AttributeTargets.Property, Inherited = true, AllowMultiple = true)] 9 | public sealed class CanBeNullAttribute : ParameterAttribute 10 | { 11 | #region ctor 12 | 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public CanBeNullAttribute() 17 | { 18 | } 19 | 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// 23 | /// 参数名字 24 | public CanBeNullAttribute(string name) 25 | : base(name) 26 | { 27 | this.Name = name; 28 | } 29 | 30 | #endregion ctor 31 | } 32 | } -------------------------------------------------------------------------------- /src/Never/Attributes/CanBeNullOrEmptyAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Attributes 4 | { 5 | /// 6 | /// 指示对象可以为空 7 | /// 8 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Field | AttributeTargets.Property, Inherited = true, AllowMultiple = true)] 9 | public sealed class CanBeNullOrEmptyAttribute : ParameterAttribute 10 | { 11 | #region ctor 12 | 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public CanBeNullOrEmptyAttribute() 17 | { 18 | } 19 | 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// 23 | /// 参数名字 24 | public CanBeNullOrEmptyAttribute(string name) 25 | : base(name) 26 | { 27 | this.Name = name; 28 | } 29 | 30 | #endregion ctor 31 | } 32 | } -------------------------------------------------------------------------------- /src/Never/Attributes/IgnoreAnalyseAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Attributes 4 | { 5 | /// 6 | /// 忽略分析的行为 7 | /// 8 | public class IgnoreAnalyseAttribute : Attribute 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /src/Never/Attributes/NotNullAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Attributes 4 | { 5 | /// 6 | /// 指示对象不可以为空 7 | /// 8 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Field | AttributeTargets.Property, Inherited = true, AllowMultiple = true)] 9 | public sealed class NotNullAttribute : ParameterAttribute 10 | { 11 | #region ctor 12 | 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public NotNullAttribute() 17 | { 18 | } 19 | 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// 23 | /// 参数名字 24 | public NotNullAttribute(string name) 25 | : base(name) 26 | { 27 | this.Name = name; 28 | } 29 | 30 | #endregion ctor 31 | } 32 | } -------------------------------------------------------------------------------- /src/Never/Attributes/NotNullOrEmptyAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Attributes 4 | { 5 | /// 6 | /// 指示字符串不可以为空 7 | /// 8 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Field | AttributeTargets.Property, Inherited = true, AllowMultiple = true)] 9 | public sealed class NotNullOrEmptyAttribute : ParameterAttribute 10 | { 11 | #region ctor 12 | 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public NotNullOrEmptyAttribute() 17 | { 18 | } 19 | 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// 23 | /// 参数名字 24 | public NotNullOrEmptyAttribute(string name) 25 | : base(name) 26 | { 27 | this.Name = name; 28 | } 29 | 30 | #endregion ctor 31 | } 32 | } -------------------------------------------------------------------------------- /src/Never/Attributes/ParameterAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Attributes 4 | { 5 | /// 6 | /// 参数特性 7 | /// 8 | [AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = true)] 9 | public class ParameterAttribute : Attribute 10 | { 11 | #region property 12 | 13 | /// 14 | /// 参数名 15 | /// 16 | public string Name { get; set; } 17 | 18 | #endregion property 19 | 20 | #region ctor 21 | 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | public ParameterAttribute() 26 | { 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the class. 31 | /// 32 | /// 参数名字 33 | public ParameterAttribute(string name) 34 | { 35 | this.Name = name; 36 | } 37 | 38 | #endregion ctor 39 | } 40 | } -------------------------------------------------------------------------------- /src/Never/Attributes/SummaryAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Attributes 4 | { 5 | /// 6 | /// 摘要说明特性 7 | /// 8 | [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] 9 | public class SummaryAttribute : Attribute 10 | { 11 | /// 12 | /// 描述 13 | /// 14 | public string Descn { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Never/Caching/ICounterDictCache.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Caching 2 | { 3 | /// 4 | /// 计时缓存自动刷新管理 5 | /// 6 | internal interface ICounterDictCache 7 | { 8 | /// 9 | /// 回收缓存 10 | /// 11 | void RecyleCache(); 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never/Caching/ICounterDictCacheAutoRecyler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Caching 4 | { 5 | /// 6 | /// 计时缓存自动刷新管理 7 | /// 8 | internal interface ICounterDictCacheAutoRecyler 9 | { 10 | /// 11 | /// 注册到自动回收管理处 12 | /// 13 | /// 14 | /// 15 | void Register(ICounterDictCache cache, TimeSpan timeSpan); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Never/Caching/TransientContextCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | 4 | namespace Never.Caching 5 | { 6 | /// 7 | /// 短暂的上下文缓存 8 | /// 9 | public sealed class TransientContextCache : ContextCache, ICaching, IDisposable 10 | { 11 | #region ctor 12 | 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public TransientContextCache() 17 | : base(new Hashtable()) 18 | { 19 | } 20 | 21 | #endregion ctor 22 | 23 | #region IDisposable成员 24 | 25 | /// 26 | /// 释放内部资源 27 | /// 28 | /// 是否释放 29 | protected override void Dispose(bool isDispose) 30 | { 31 | base.Dispose(isDispose); 32 | } 33 | 34 | #endregion IDisposable成员 35 | } 36 | } -------------------------------------------------------------------------------- /src/Never/CommandStreams/CommandDomainAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.CommandStreams 4 | { 5 | /// 6 | /// 命令所处在的运行域 7 | /// 8 | [AttributeUsage(AttributeTargets.Class)] 9 | public class CommandDomainAttribute : Attribute 10 | { 11 | /// 12 | /// 运行域 13 | /// 14 | public string Domain { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Never/CommandStreams/CommandStreamExtension.cs: -------------------------------------------------------------------------------- 1 | namespace Never.CommandStreams 2 | { 3 | /// 4 | /// 扩展 5 | /// 6 | public static class CommandStreamExtension 7 | { 8 | /// 9 | /// 10 | /// 11 | /// 12 | /// 13 | public static CommandStreamMessage ConvertTo(this IOperateCommand operaCommand) 14 | { 15 | return CommandStreamHelper.ConvertTo(operaCommand); 16 | } 17 | 18 | /// 19 | /// 20 | /// 21 | /// 22 | /// 23 | /// 24 | public static CommandStreamMessage ConvertTo(this IOperateCommand operaCommand, Serialization.IJsonSerializer jsonSerializer) 25 | { 26 | return CommandStreamHelper.ConvertTo(operaCommand, jsonSerializer); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Never/CommandStreams/ICommandStorager.cs: -------------------------------------------------------------------------------- 1 | using Never.Commands; 2 | 3 | namespace Never.CommandStreams 4 | { 5 | /// 6 | /// 领域命令存储接口 7 | /// 8 | public interface ICommandStorager 9 | { 10 | /// 11 | /// 保存领域命令 12 | /// 13 | /// 命令类型 14 | /// 命令 15 | /// 命令上下文 16 | void Save(ICommandContext commandContext, T command) where T : ICommand; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Never/CommandStreams/ICommandStreamAnalyser.cs: -------------------------------------------------------------------------------- 1 | using Never.Commands; 2 | 3 | namespace Never.CommandStreams 4 | { 5 | /// 6 | /// 命令分析接口 7 | /// 8 | public interface ICommandStreamAnalyser 9 | { 10 | /// 11 | /// 分析命令 12 | /// 13 | /// 命令类型 14 | /// 命令上下文 15 | /// 命令 16 | /// 17 | IOperateCommand Analyse(ICommandContext context, TCommand command) where TCommand : ICommand; 18 | } 19 | } -------------------------------------------------------------------------------- /src/Never/CommandStreams/ICommandStreamStorager.cs: -------------------------------------------------------------------------------- 1 | namespace Never.CommandStreams 2 | { 3 | /// 4 | /// 领域命令存储接口 5 | /// 6 | public interface ICommandStreamStorager 7 | { 8 | /// 9 | /// 保存领域命令 10 | /// 11 | /// 命令 12 | /// 13 | void Save(IOperateCommand command); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Never/CommandStreams/IgnoreStoreCommandAttribute.cs: -------------------------------------------------------------------------------- 1 | using Never.Attributes; 2 | using System; 3 | 4 | namespace Never.CommandStreams 5 | { 6 | /// 7 | /// 忽略保存命令的行为 8 | /// 9 | [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = false)] 10 | public class IgnoreStoreCommandAttribute : IgnoreAnalyseAttribute 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never/Commands/IAbortedSerialCommand.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Commands 2 | { 3 | /// 4 | /// 【并发】的时候放弃执行的命令 5 | /// 6 | public interface IAbortedSerialCommand : ISerialCommand 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/Never/Commands/ICommand.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Commands 2 | { 3 | /// 4 | /// 命令对象 5 | /// 6 | public interface ICommand 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/Never/Commands/ICommandContextInitable.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Commands 2 | { 3 | /// 4 | /// 默认上下文 5 | /// 6 | public interface ICommandContextInitable : ICommandContext 7 | { 8 | /// 9 | /// 初始化命令 10 | /// 11 | /// 上下文通讯 12 | /// 命令对象 13 | void OnInit(HandlerCommunication communication, ICommand command); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Never/Commands/IEnqueueSerialCommand.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Commands 2 | { 3 | /// 4 | /// 【并发】的时候入队列的命令 5 | /// 6 | public interface IEnqueueSerialCommand : ISerialCommand 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/Never/Commands/ISerialCommand.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Commands 2 | { 3 | /// 4 | /// 串行命令【实现了数据库的行锁】,表示该命令要等待个相同的命令执行完后才执行下一个 5 | /// 6 | public interface ISerialCommand 7 | { 8 | /// 9 | /// 执行的主键 10 | /// 11 | string Body { get; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never/Commands/Recovery/RecoveryCommandModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Commands.Recovery 8 | { 9 | /// 10 | /// 恢复命令类型 11 | /// 12 | public class RecoveryCommandModel 13 | { 14 | /// 15 | /// Id 16 | /// 17 | public int Id { get; set; } 18 | 19 | /// 20 | /// Id 21 | /// 22 | public Guid UniqueId { get; set; } 23 | 24 | /// 25 | /// 命令 26 | /// 27 | public ICommand Command { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Never/Commands/Recovery/RecoveryEventModel.cs: -------------------------------------------------------------------------------- 1 | using Never.Events; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.Commands.Recovery 9 | { 10 | /// 11 | /// 恢复事件类型 12 | /// 13 | public class RecoveryEventModel 14 | { 15 | /// 16 | /// Id 17 | /// 18 | public int Id { get; set; } 19 | 20 | /// 21 | /// Id 22 | /// 23 | public Guid UniqueId { get; set; } 24 | 25 | /// 26 | /// 事件处理者 27 | /// 28 | public Type EventHandlerType { get; set; } 29 | 30 | /// 31 | /// 事件 32 | /// 33 | public IEvent @Event { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Never/DataAnnotations/IAmValidator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq.Expressions; 4 | 5 | namespace Never.DataAnnotations 6 | { 7 | /// 8 | /// 验证接口 9 | /// 10 | public interface IAmValidator 11 | { 12 | /// 13 | /// 验证某一对象 14 | /// 15 | /// 16 | ValidationResult Validate(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Never/DataAnnotations/IValidationOption.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.DataAnnotations 8 | { 9 | /// 10 | /// 验证选项 11 | /// 12 | public interface IValidationOption 13 | { 14 | /// 15 | /// 结果选项 16 | /// 17 | ValidationOption Option { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Never/DataAnnotations/IValidator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Linq.Expressions; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.DataAnnotations 9 | { 10 | /// 11 | /// 验证接口 12 | /// 13 | public interface IValidator 14 | { 15 | /// 16 | /// 验证某一对象 17 | /// 18 | /// 19 | /// 20 | ValidationResult Validate(object target); 21 | } 22 | } -------------------------------------------------------------------------------- /src/Never/DataAnnotations/ValidationFailure.cs: -------------------------------------------------------------------------------- 1 | namespace Never.DataAnnotations 2 | { 3 | /// 4 | /// 错误信息 5 | /// 6 | public struct ValidationFailure : IValidationOption 7 | { 8 | /// 9 | /// 错误信息 10 | /// 11 | public string ErrorMessage { get; set; } 12 | 13 | /// 14 | /// 成员名称 15 | /// 16 | public string MemberName { get; set; } 17 | 18 | /// 19 | /// 结果选项 20 | /// 21 | public ValidationOption Option { get; set; } 22 | 23 | /// 24 | /// ToString() 25 | /// 26 | /// 27 | public override string ToString() 28 | { 29 | return string.Concat(this.MemberName, "_", this.ErrorMessage); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Never/DataAnnotations/ValidationOption.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.DataAnnotations 8 | { 9 | /// 10 | /// 验证选项 11 | /// 12 | public enum ValidationOption : byte 13 | { 14 | /// 15 | /// 只能中断 16 | /// 17 | @Break = 0, 18 | 19 | /// 20 | /// 可以继续 21 | /// 22 | @Continue = 1, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Never/DataAnnotations/ValidatorAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.DataAnnotations 4 | { 5 | /// 6 | /// 数组验证模型特性类型通常是实现了接口 7 | /// 8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)] 9 | public class ValidatorAttribute : Attribute 10 | { 11 | #region prop 12 | 13 | /// 14 | /// 验证器类型 15 | /// 16 | public Type ValidatorType { get; set; } 17 | 18 | #endregion prop 19 | 20 | #region ctor 21 | 22 | /// 23 | /// 24 | /// 25 | public ValidatorAttribute() 26 | : this(null) 27 | { 28 | } 29 | 30 | /// 31 | /// 32 | /// 33 | /// 34 | public ValidatorAttribute(Type validatorType) 35 | { 36 | this.ValidatorType = validatorType; 37 | } 38 | 39 | #endregion ctor 40 | } 41 | } -------------------------------------------------------------------------------- /src/Never/Deployment/IRoutePrimaryKeySelect.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Deployment 2 | { 3 | /// 4 | /// 路由主键接口 5 | /// 6 | public interface IRoutePrimaryKeySelect 7 | { 8 | /// 9 | /// 路由主键 10 | /// 11 | string PrimaryKey { get; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never/Deployment/StringRoutePrimaryKeySelect.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Deployment 2 | { 3 | /// 4 | /// 字符串路由主键 5 | /// 6 | public struct StringRoutePrimaryKeySelect : IRoutePrimaryKeySelect 7 | { 8 | #region prop 9 | 10 | /// 11 | /// 关键Key 12 | /// 13 | public string PrimaryKey { get; set; } 14 | 15 | /// 16 | /// 路由主键 17 | /// 18 | string IRoutePrimaryKeySelect.PrimaryKey 19 | { 20 | get 21 | { 22 | return this.PrimaryKey; 23 | } 24 | } 25 | 26 | #endregion prop 27 | } 28 | } -------------------------------------------------------------------------------- /src/Never/Domains/ChangeAggregateCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Domains 4 | { 5 | /// 6 | /// 更新创建根Id 7 | /// 8 | [Serializable, Never.CommandStreams.IgnoreStoreCommand, Never.Attributes.IgnoreAnalyse] 9 | public class ChangeAggregateCommand : IAggregateCommand 10 | { 11 | #region prop 12 | 13 | /// 14 | /// 版本 15 | /// 16 | public int Version { get; set; } 17 | 18 | /// 19 | /// 唯一标识 20 | /// 21 | public TAggregateRootId AggregateId { get; protected set; } 22 | 23 | #endregion prop 24 | 25 | #region ctor 26 | 27 | /// 28 | /// Initializes a new instance of the class. 29 | /// 30 | /// The aggregate identifier. 31 | protected ChangeAggregateCommand(TAggregateRootId aggregateId) 32 | { 33 | this.AggregateId = aggregateId; 34 | } 35 | 36 | #endregion ctor 37 | } 38 | } -------------------------------------------------------------------------------- /src/Never/Domains/CreateAggregateCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Domains 4 | { 5 | /// 6 | /// 创建聚合根命令 7 | /// 8 | [Serializable, Never.CommandStreams.IgnoreStoreCommand, Never.Attributes.IgnoreAnalyse] 9 | public class CreateAggregateCommand : IAggregateCommand 10 | { 11 | #region prop 12 | 13 | /// 14 | /// 版本 15 | /// 16 | public int Version { get; set; } 17 | 18 | /// 19 | /// 唯一标识 20 | /// 21 | public TAggregateRootId AggregateId { get; protected set; } 22 | 23 | #endregion prop 24 | 25 | #region ctor 26 | 27 | /// 28 | /// Initializes a new instance of the class. 29 | /// 30 | /// The aggregate identifier. 31 | protected CreateAggregateCommand(TAggregateRootId aggregateId) 32 | { 33 | this.AggregateId = aggregateId; 34 | } 35 | 36 | #endregion ctor 37 | } 38 | } -------------------------------------------------------------------------------- /src/Never/Domains/IAggregateCommand.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Domains 2 | { 3 | /// 4 | /// 聚合根命令 5 | /// 6 | /// 聚合根标认识 7 | public interface IAggregateCommand : Never.Commands.ICommand 8 | { 9 | /// 10 | /// 版本号 11 | /// 12 | int Version { get; } 13 | 14 | /// 15 | /// 聚合根标认识 16 | /// 17 | TAggregateRootId AggregateId { get; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Never/Domains/IHandle.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Domains 2 | { 3 | /// 4 | /// 聚合根发生变更时定义的事件约定接口 5 | /// 6 | /// 领域事件类型 7 | public interface IHandle where TEvent : Never.Events.IEvent 8 | { 9 | /// 10 | /// 处理领域事件 11 | /// 12 | /// 领域事件类型 13 | void Handle(TEvent e); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Never/Domains/ITransactionRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Domains 4 | { 5 | /// 6 | /// 事务仓库 7 | /// 8 | public interface ITransactionRepository 9 | { 10 | /// 11 | /// 开启事务 12 | /// 13 | /// 事务级别 14 | /// 回调 15 | void UsingTran(System.Data.IsolationLevel level, Action callback); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Never/Domains/StringAggregateCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Domains 4 | { 5 | /// 6 | /// 聚合根命令 7 | /// 8 | [Serializable, Never.CommandStreams.IgnoreStoreCommand, Never.Attributes.IgnoreAnalyse] 9 | public class StringAggregateCommand : IAggregateCommand 10 | { 11 | #region prop 12 | 13 | /// 14 | /// 版本 15 | /// 16 | public int Version { get; set; } 17 | 18 | /// 19 | /// 唯一标识 20 | /// 21 | public string AggregateId { get; protected set; } 22 | 23 | #endregion prop 24 | 25 | #region ctor 26 | 27 | /// 28 | /// Initializes a new instance of the class. 29 | /// 30 | /// The aggregate identifier. 31 | protected StringAggregateCommand(string aggregateId) 32 | { 33 | this.AggregateId = aggregateId; 34 | } 35 | 36 | #endregion ctor 37 | } 38 | } -------------------------------------------------------------------------------- /src/Never/EventStreams/EventDomainAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.EventStreams 4 | { 5 | /// 6 | /// 事件所处在的运行域 7 | /// 8 | [AttributeUsage(AttributeTargets.Class)] 9 | public class EventDomainAttribute : Attribute 10 | { 11 | /// 12 | /// 运行域 13 | /// 14 | public string Domain { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Never/EventStreams/EventStreamExtension.cs: -------------------------------------------------------------------------------- 1 | namespace Never.EventStreams 2 | { 3 | /// 4 | /// 扩展 5 | /// 6 | public static class EventStreamExtension 7 | { 8 | /// 9 | /// 10 | /// 11 | /// 12 | /// 13 | public static EventStreamMessage ConvertTo(this IOperateEvent operaEvent) 14 | { 15 | return EventStreamHelper.ConvertTo(operaEvent); 16 | } 17 | 18 | /// 19 | /// 20 | /// 21 | /// 22 | /// 23 | /// 24 | public static EventStreamMessage ConvertTo(this IOperateEvent operaEvent, Serialization.IJsonSerializer jsonSerializer) 25 | { 26 | return EventStreamHelper.ConvertTo(operaEvent, jsonSerializer); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Never/EventStreams/IBatchEventStreamMessage.cs: -------------------------------------------------------------------------------- 1 | using Never.Messages; 2 | using System.Collections.Generic; 3 | 4 | namespace Never.EventStreams 5 | { 6 | /// 7 | /// 批量事件接口 8 | /// 9 | public interface IBatchEventStreamMessage : IMessage 10 | { 11 | /// 12 | /// 批量事件 13 | /// 14 | IEnumerable Messages { get; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Never/EventStreams/IEventStorager.cs: -------------------------------------------------------------------------------- 1 | using Never.Commands; 2 | using Never.Events; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Never.EventStreams 10 | { 11 | /// 12 | /// 领域事件存储接口 13 | /// 14 | public interface IEventStorager 15 | { 16 | /// 17 | /// 批量保存领域事件 18 | /// 19 | /// 命令上下文 20 | /// 事件列表 21 | /// 22 | void Save(ICommandContext commandContext, IEnumerable> events); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Never/EventStreams/IEventStreamAnalyser.cs: -------------------------------------------------------------------------------- 1 | using Never.Commands; 2 | using Never.Events; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | namespace Never.EventStreams 7 | { 8 | /// 9 | /// 事件分析接口 10 | /// 11 | public interface IEventStreamAnalyser 12 | { 13 | /// 14 | /// 分析事件 15 | /// 16 | /// 命令上下文 17 | /// 事件列表 18 | /// 19 | IEnumerable Analyse(ICommandContext context, IEnumerable> events); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Never/EventStreams/IEventStreamStorager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Never.EventStreams 4 | { 5 | /// 6 | /// 领域事件存储接口 7 | /// 8 | public interface IEventStreamStorager 9 | { 10 | /// 11 | /// 批量保存领域事件 12 | /// 13 | /// 事件列表 14 | /// 15 | void Save(IEnumerable events); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Never/EventStreams/IgnoreStoreEventAttribute.cs: -------------------------------------------------------------------------------- 1 | using Never.Attributes; 2 | using System; 3 | 4 | namespace Never.EventStreams 5 | { 6 | /// 7 | /// 忽略保存事件的行为 8 | /// 9 | [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = false)] 10 | public class IgnoreStoreEventAttribute : IgnoreAnalyseAttribute 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never/Events/IAggregateRootEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Events 4 | { 5 | /// 6 | /// 聚合根事件 7 | /// 8 | /// 聚合根唯一标识对象的类型 9 | public interface IAggregateRootEvent : IEvent 10 | { 11 | #region property 12 | 13 | /// 14 | /// 唯一标识 15 | /// 16 | TAggregateRootKey AggregateId { get; } 17 | 18 | /// 19 | /// 操作时间 20 | /// 21 | DateTime CreateDate { get; } 22 | 23 | /// 24 | /// 操作者 25 | /// 26 | string Creator { get; } 27 | 28 | #endregion property 29 | } 30 | } -------------------------------------------------------------------------------- /src/Never/Events/IEvent.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Events 2 | { 3 | /// 4 | /// 事件 5 | /// 6 | public interface IEvent 7 | { 8 | /// 9 | /// 版本号 10 | /// 11 | int Version { get; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never/Events/IEventBus.cs: -------------------------------------------------------------------------------- 1 | using Never.Commands; 2 | using System.Collections.Generic; 3 | 4 | namespace Never.Events 5 | { 6 | /// 7 | /// C端事件总线 8 | /// 9 | [System.ComponentModel.Browsable(false)] 10 | [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 11 | public interface IEventBus 12 | { 13 | /// 14 | /// 发布事件 15 | /// 16 | /// 17 | /// 18 | void Push(ICommandContext context, IEnumerable events); 19 | 20 | /// 21 | /// 发布事件 22 | /// 23 | /// 24 | /// 25 | /// 26 | void Publish(ICommandContext commandContext, TEvent e) where TEvent : IEvent; 27 | } 28 | } -------------------------------------------------------------------------------- /src/Never/Events/IEventContext.cs: -------------------------------------------------------------------------------- 1 | using Never.Commands; 2 | using Never.Security; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | namespace Never.Events 7 | { 8 | /// 9 | /// 事件上下文 10 | /// 11 | public interface IEventContext : Never.Aop.IRuntimeModeProvider, IWorkContext 12 | { 13 | /// 14 | /// 上下文集合 15 | /// 16 | IDictionary Items { get; } 17 | 18 | /// 19 | /// 当前请求用户 20 | /// 21 | IUser Consigner { get; } 22 | 23 | /// 24 | /// 获取所有的命令 25 | /// 26 | /// 27 | ICommand[] GetAllCommands(); 28 | 29 | /// 30 | /// 新加一个命令 31 | /// 32 | /// 命令对象 33 | void AddCommand(ICommand command); 34 | 35 | /// 36 | /// 当前执行的对象类型 37 | /// 38 | Type TargetType { get; } 39 | } 40 | } -------------------------------------------------------------------------------- /src/Never/Events/IEventHandler.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Events 2 | { 3 | /// 4 | /// 事件处理接口 5 | /// 6 | public interface IEventHandler 7 | { 8 | } 9 | 10 | /// 11 | /// 事件处理接口 12 | /// 13 | /// 领域类型 14 | public interface IEventHandler : IEventHandler 15 | where TEvent : IEvent 16 | { 17 | /// 18 | /// 事件处理约定 19 | /// 20 | /// 上下文 21 | /// 领域事件 22 | void Execute(IEventContext context, TEvent e); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Never/Events/IStartupEventContext.cs: -------------------------------------------------------------------------------- 1 | using Never.Commands; 2 | 3 | namespace Never.Events 4 | { 5 | /// 6 | /// 启动上下文 7 | /// 8 | public interface IStartupEventContext : IEventContext 9 | { 10 | /// 11 | /// 初始化 12 | /// 13 | /// 14 | void OnInit(ICommandContext context); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Never/IApplicationStartup.cs: -------------------------------------------------------------------------------- 1 | using Never.IoC; 2 | using Never.Startups; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | namespace Never 7 | { 8 | /// 9 | /// 程序宿主环境配置服务 10 | /// 11 | public interface IApplicationStartup : IDisposable 12 | { 13 | /// 14 | /// 提供已过滤程序集提供者 15 | /// 16 | IFilteringAssemblyProvider FilteringAssemblyProvider { get; } 17 | 18 | /// 19 | /// 类型查找 20 | /// 21 | ITypeFinder TypeFinder { get; } 22 | 23 | /// 24 | /// 服务定位器 25 | /// 26 | IServiceLocator ServiceLocator { get; } 27 | 28 | /// 29 | /// 服务注册器 30 | /// 31 | IServiceRegister ServiceRegister { get; } 32 | 33 | /// 34 | /// 上下文 35 | /// 36 | IDictionary Items { get; } 37 | 38 | /// 39 | /// 当前是否为web host环境 40 | /// 41 | bool IsWebHosted { get; } 42 | } 43 | } -------------------------------------------------------------------------------- /src/Never/IConstructibleOption.cs: -------------------------------------------------------------------------------- 1 | namespace Never 2 | { 3 | /// 4 | /// 选择接口,约束了泛型可以new入行为 5 | /// 6 | /// 7 | public interface IConstructibleOption : IValuableOption where TOptin : new() 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/Never/ITreeNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Never 4 | { 5 | /// 6 | /// 树节点 7 | /// 8 | public interface ITreeNode 9 | { 10 | /// 11 | /// 节点 12 | /// 13 | int Id { get; } 14 | 15 | /// 16 | /// 父节点 17 | /// 18 | int ParentId { get; } 19 | 20 | /// 21 | /// 深度层次 22 | /// 23 | int Level { get; set; } 24 | } 25 | 26 | /// 27 | /// 树节点 28 | /// 29 | public interface ITreeNode : ITreeNode where TNode : ITreeNode 30 | { 31 | /// 32 | /// 父节点 33 | /// 34 | TNode Parent { get; set; } 35 | 36 | /// 37 | /// 子节点 38 | /// 39 | IEnumerable Children { get; set; } 40 | } 41 | } -------------------------------------------------------------------------------- /src/Never/IValuableOption.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never 8 | { 9 | /// 10 | /// 选择接口 11 | /// 12 | /// 13 | public interface IValuableOption 14 | { 15 | /// 16 | /// TOptin对象实例 17 | /// 18 | TOptin Value { get; } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Never/IValueObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never 4 | { 5 | /// 6 | /// 值对象父类 7 | /// 8 | /// 值对象 9 | public interface IValueObject : IEquatable, IComparable 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /src/Never/IWorkContext.cs: -------------------------------------------------------------------------------- 1 | using Never.Security; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never 9 | { 10 | /// 11 | /// 工作上下文 12 | /// 13 | public interface IWorkContext 14 | { 15 | /// 16 | /// 当前操作者 17 | /// 18 | IWorker Worker { get; } 19 | 20 | /// 21 | /// 当前执行时间 22 | /// 23 | DateTime WorkTime { get; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Never/IWorkService.cs: -------------------------------------------------------------------------------- 1 | namespace Never 2 | { 3 | /// 4 | /// 工作服务 5 | /// 6 | public interface IWorkService 7 | { 8 | /// 9 | /// 工作开始了 10 | /// 11 | void Startup(); 12 | 13 | /// 14 | /// 工作停止了 15 | /// 16 | void Shutdown(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Never/IWorkTigger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never 4 | { 5 | /// 6 | /// 工作触发器 7 | /// 8 | public interface IWorkTigger 9 | { 10 | /// 11 | /// 触发间隔 12 | /// 13 | TimeSpan Timer { get; } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Never/IoC/AutoInjectingAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.IoC 4 | { 5 | /// 6 | /// 生命周期的自动注入属性 7 | /// 8 | public abstract class AutoInjectingAttribute : Attribute 9 | { 10 | /// 11 | /// 注入类型 12 | /// 13 | public virtual Type ServiceType { get; } 14 | 15 | /// 16 | /// 注入的Key 17 | /// 18 | public virtual string Key { get; } 19 | 20 | /// 21 | /// 声明生命周期 22 | /// 23 | public abstract ComponentLifeStyle Declare { get; } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Never/IoC/AutoInjectingGroupInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.IoC 4 | { 5 | /// 6 | /// 自动注入分组 7 | /// 8 | public class AutoInjectingGroupInfo 9 | { 10 | /// 11 | /// 注入属性 12 | /// 13 | public AutoInjectingAttribute Attribute { get; set; } 14 | 15 | /// 16 | /// 具体对象类型(即放着attribute属性的类型) 17 | /// 18 | public Type ImplementationType { get; set; } 19 | 20 | /// 21 | /// 注入Key 22 | /// 23 | public string Key { get; set; } 24 | 25 | /// 26 | /// 注入生命周期 27 | /// 28 | public ComponentLifeStyle LifeStyle { get; set; } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Never/IoC/ComponentLifeStyle.cs: -------------------------------------------------------------------------------- 1 | namespace Never.IoC 2 | { 3 | /// 4 | /// 组件生命周期 5 | /// 6 | public enum ComponentLifeStyle 7 | { 8 | /// 9 | /// 单例:任何情况下返回相同实例 10 | /// 11 | Singleton = 0, 12 | 13 | /// 14 | /// 作用域:每个作用域内只会产生一个实例 15 | /// 16 | Scoped = 1, 17 | 18 | /// 19 | /// 短暂:每次请求都会返回单独的实例 20 | /// 21 | Transient = 2 22 | } 23 | } -------------------------------------------------------------------------------- /src/Never/IoC/ContainerContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | 4 | namespace Never.IoC 5 | { 6 | /// 7 | /// IoC容器引擎环境 8 | /// 9 | public static class ContainerContext 10 | { 11 | #region prop 12 | 13 | /// 14 | /// 当前容器 15 | /// 16 | public static IContainer Current 17 | { 18 | get 19 | { 20 | return Singleton.Instance; 21 | } 22 | [MethodImpl(MethodImplOptions.Synchronized)] 23 | set 24 | { 25 | Singleton.Instance = value; 26 | } 27 | } 28 | 29 | #endregion prop 30 | } 31 | } -------------------------------------------------------------------------------- /src/Never/IoC/IAssemblyProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace Never.IoC 4 | { 5 | /// 6 | /// 程序集提供者 7 | /// 8 | public interface IAssemblyProvider 9 | { 10 | /// 11 | /// 获取所有程序集对象 12 | /// 13 | /// 14 | Assembly[] GetAssemblies(); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Never/IoC/IAutoInjectingEnvironmentCollector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | 5 | namespace Never.IoC 6 | { 7 | /// 8 | /// 主动注入环境规则收集者 9 | /// 10 | public interface IAutoInjectingEnvironmentCollector 11 | { 12 | /// 13 | /// 收集类型 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | void Register(AutoInjectingGroupInfo[] groups, object collector, ITypeFinder typeFinder, IEnumerable assemblies); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Never/IoC/IAutoInjectingEnvironmentProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | 5 | namespace Never.IoC 6 | { 7 | /// 8 | /// 主动注入环境提供者 9 | /// 10 | public interface IAutoInjectingEnvironmentProvider 11 | { 12 | /// 13 | /// 要验证的自动注入属性 14 | /// 15 | /// 16 | Type GetAutoInjectingAttributeType(); 17 | 18 | /// 19 | /// 注入类型 20 | /// 21 | /// 22 | /// 23 | void Call(AutoInjectingGroupInfo[] groups, IContainerStartupEventArgs eventArgs); 24 | } 25 | } -------------------------------------------------------------------------------- /src/Never/IoC/IComponentLifeStyleStorager.cs: -------------------------------------------------------------------------------- 1 | using Never.IoC.Injections; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.IoC 9 | { 10 | /// 11 | /// 生命周期存储器 12 | /// 13 | public interface IComponentLifeStyleStorager 14 | { 15 | /// 16 | /// 查询 17 | /// 18 | /// 19 | /// 20 | /// 21 | T Query(IRegisterRuleDescriptor rule); 22 | 23 | /// 24 | /// 更新 25 | /// 26 | /// 27 | /// 28 | /// 29 | /// 30 | T Cache(IRegisterRuleDescriptor rule, T @object); 31 | } 32 | } -------------------------------------------------------------------------------- /src/Never/IoC/IContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.IoC 4 | { 5 | /// 6 | /// IoC容器接口 7 | /// 8 | public interface IContainer 9 | { 10 | /// 11 | /// 服务注册器 12 | /// 13 | IServiceRegister ServiceRegister { get; } 14 | 15 | /// 16 | /// 服务定位器 17 | /// 18 | IServiceLocator ServiceLocator { get; } 19 | 20 | /// 21 | /// 服务创建器 22 | /// 23 | IServiceActivator ServiceActivator { get; } 24 | 25 | /// 26 | /// 类型发现者 27 | /// 28 | ITypeFinder TypeFinder { get; } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Never/IoC/IContainerStartup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.IoC 8 | { 9 | /// 10 | /// 容器初始化过程 11 | /// 12 | public interface IContainerStartup 13 | { 14 | /// 15 | /// 初始化 16 | /// 17 | event EventHandler OnIniting; 18 | 19 | /// 20 | /// 初始化 21 | /// 22 | void Init(); 23 | 24 | /// 25 | /// 启动中 26 | /// 27 | event EventHandler OnStarting; 28 | 29 | /// 30 | /// 启动中 31 | /// 32 | void Startup(); 33 | } 34 | } -------------------------------------------------------------------------------- /src/Never/IoC/ILifetimeScopeTracker.cs: -------------------------------------------------------------------------------- 1 | using Never.Caching; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.IoC 9 | { 10 | /// 11 | /// 组件生命范围定义跟踪者 12 | /// 13 | public interface ILifetimeScopeTracker 14 | { 15 | /// 16 | /// 开始一个范围 17 | /// 18 | /// 19 | /// 20 | ILifetimeScope StartScope(ILifetimeScope parent); 21 | 22 | /// 23 | /// 清空所有范围 24 | /// 25 | void CleanScope(); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Never/IoC/Injections/IParameterRegisterRule.cs: -------------------------------------------------------------------------------- 1 | namespace Never.IoC.Injections 2 | { 3 | /// 4 | /// 参数注册规则 5 | /// 6 | public interface IParameterRegisterRule 7 | { 8 | /// 9 | /// 构造函数参数 10 | /// 11 | /// 服务类型 12 | /// 注册key 13 | /// 14 | IParameterRegisterRule WithParameter(string key); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Never/IoC/Injections/IProxyRegisterRule.cs: -------------------------------------------------------------------------------- 1 | namespace Never.IoC.Injections 2 | { 3 | /// 4 | /// 代理注册规则 5 | /// 6 | public interface IProxyRegisterRule 7 | { 8 | /// 9 | /// 构造函数参数 10 | /// 11 | /// 拦截器类型 12 | /// 注册key 13 | /// 14 | IProxyRegisterRule WithInterceptor(string key) where TInterceptor : Never.Aop.IInterceptor; 15 | } 16 | } -------------------------------------------------------------------------------- /src/Never/IoC/Injections/IRegisterRuleChangeable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.IoC.Injections 4 | { 5 | /// 6 | /// 规则更新 7 | /// 8 | public interface IRegisterRuleChangeable 9 | { 10 | /// 11 | /// 更新容器规则 12 | /// 13 | /// 14 | void Update(RegisterRuleCollector rule); 15 | 16 | /// 17 | /// 创建规则,如果已经构建,则该规则不会被加入到规则集合中 18 | /// 19 | /// 服务类型 20 | /// 21 | RegisterRule CreateRule(Type serviceType); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Never/IoC/Injections/IResolveContext.cs: -------------------------------------------------------------------------------- 1 | using Never.Caching; 2 | using System; 3 | 4 | namespace Never.IoC.Injections 5 | { 6 | /// 7 | /// 构建行为在执行过程的上下文 8 | /// 9 | public interface IResolveContext 10 | { 11 | /// 12 | /// 查询 13 | /// 14 | /// 15 | /// 16 | T Query(IRegisterRuleDescriptor rule, ILifetimeScope scope); 17 | 18 | /// 19 | /// 缓存 20 | /// 21 | /// 22 | /// 23 | /// 24 | /// 25 | T Cache(IRegisterRuleDescriptor rule, ILifetimeScope scope, T @object); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Never/IoC/Injections/Rules/ConstructorDictionary.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Never.IoC.Injections.Rules 4 | { 5 | /// 6 | /// 构造函数Dictionary 7 | /// 8 | /// 9 | /// 10 | internal class ConstructorDictionary : Dictionary, IDictionary 11 | { 12 | /// 13 | /// 14 | /// 15 | /// 16 | /// 17 | public ConstructorDictionary(K k, V v) : base(new Dictionary() { { k, v } }) 18 | { 19 | } 20 | 21 | /// 22 | /// 23 | /// 24 | private ConstructorDictionary() : base() 25 | { 26 | } 27 | 28 | /// 29 | /// 30 | /// 31 | /// 32 | public static ConstructorDictionary CreateEmpty() 33 | { 34 | return new ConstructorDictionary(); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/Never/IoC/Injections/UnableRegisterRule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.IoC.Injections 8 | { 9 | /// 10 | /// 不再注册 11 | /// 12 | public struct UnableRegisterRule 13 | { 14 | /// 15 | /// 是否不可行了 16 | /// 17 | public bool Unabled { get; } 18 | 19 | /// 20 | /// 构造对象 21 | /// 22 | /// 23 | public UnableRegisterRule(bool unabled) 24 | { 25 | this.Unabled = unabled; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Never/IoC/ResolveMethod.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.IoC 8 | { 9 | /// 10 | /// resove method 11 | /// 12 | public enum ResolveMethod : byte 13 | { 14 | /// 15 | /// default 16 | /// 17 | Resolve = 0, 18 | 19 | /// 20 | /// try resolve 21 | /// 22 | ResolveTriable = 1, 23 | 24 | /// 25 | /// optional 26 | /// 27 | ResolveOptional = 2, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Never/Logging/ILoggerBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Logging 4 | { 5 | /// 6 | /// 日志输出管理器 7 | /// 8 | public interface ILoggerBuilder 9 | { 10 | /// 11 | /// 构建实例 12 | /// 13 | /// 日志名字 14 | /// 15 | ILogger Build(string loggerName); 16 | 17 | /// 18 | /// 构建实例 19 | /// 20 | /// 日志类型 21 | /// 22 | ILogger Build(Type loggerType); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Never/Mappers/MapperContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Mappers 8 | { 9 | /// 10 | /// 上下文 11 | /// 12 | public struct MapperContext 13 | { 14 | /// 15 | /// 上下文 16 | /// 17 | public MapperSetting Setting { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Never/Messages/DefaultMessageConnection.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Messages 2 | { 3 | /// 4 | /// 消息链接对象 5 | /// 6 | public class DefaultMessageConnection : Never.Messages.IMessageConnection 7 | { 8 | #region property 9 | 10 | /// 11 | /// 链接字符串 12 | /// 13 | public virtual string ConnetctionString { get; set; } 14 | 15 | #endregion property 16 | } 17 | } -------------------------------------------------------------------------------- /src/Never/Messages/IMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Messages 2 | { 3 | /// 4 | /// 消息 5 | /// 6 | public interface IMessage 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/Never/Messages/IMessageConnection.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Messages 2 | { 3 | /// 4 | /// 消息链接对象 5 | /// 6 | public interface IMessageConnection 7 | { 8 | #region property 9 | 10 | /// 11 | /// 链接字符串 12 | /// 13 | string ConnetctionString { get; } 14 | 15 | #endregion property 16 | } 17 | } -------------------------------------------------------------------------------- /src/Never/Messages/IMessageConsumer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Messages 4 | { 5 | /// 6 | /// 消息消费者 7 | /// 8 | public interface IMessageConsumer : IWorkService 9 | { 10 | /// 11 | /// 消息路由 12 | /// 13 | IMessageConnection MessageConnection { get; } 14 | 15 | /// 16 | /// 接收一条消息 17 | /// 18 | /// 19 | MessagePacket Receive(); 20 | 21 | /// 22 | /// 异步接收一条消息 23 | /// 24 | /// 回调 25 | void ReceiveAsync(Action messageCallback); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Never/Messages/IMessageContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Never.Messages 5 | { 6 | /// 7 | /// 消息上下文 8 | /// 9 | public interface IMessageContext 10 | { 11 | /// 12 | /// 上下文集合 13 | /// 14 | IDictionary Items { get; } 15 | 16 | /// 17 | /// 当前执行的对象类型 18 | /// 19 | Type TargetType { get; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Never/Messages/IMessageProducer.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Messages 2 | { 3 | /// 4 | /// 消息生产者接口 5 | /// 6 | public interface IMessageProducer : IWorkService 7 | { 8 | /// 9 | /// 消息路由 10 | /// 11 | IMessageConnection MessageConnection { get; } 12 | 13 | /// 14 | /// 发送一条消息 15 | /// 16 | /// 消息 17 | void Send(MessagePacket message); 18 | 19 | /// 20 | /// 发送一条消息 21 | /// 22 | /// 消息 23 | /// 消息路由 24 | void Send(MessagePacket message, IMessageRoute route); 25 | } 26 | } -------------------------------------------------------------------------------- /src/Never/Messages/IMessageProducerProvider.cs: -------------------------------------------------------------------------------- 1 | using Never.Serialization; 2 | 3 | namespace Never.Messages 4 | { 5 | /// 6 | /// 消息提供者 7 | /// 8 | public interface IMessageProducerProvider 9 | { 10 | /// 11 | /// 查询Json序列化接口 12 | /// 13 | /// 14 | IJsonSerializer JsonSerilizer { get; } 15 | 16 | /// 17 | /// 查询消息提供者 18 | /// 19 | /// 20 | IMessageProducer MessageProducer { get; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Never/Messages/IMessagePublisher.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Never.Messages 4 | { 5 | /// 6 | /// 发布者 7 | /// 8 | public interface IMessagePublisher 9 | { 10 | /// 11 | /// 发布消息 12 | /// 13 | /// 消息类型 14 | /// 上下文通讯 15 | /// 消息 16 | void Publish(IMessageContext context, TMessage message) 17 | where TMessage : IMessage; 18 | } 19 | } -------------------------------------------------------------------------------- /src/Never/Messages/IMessageRoute.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Messages 2 | { 3 | /// 4 | /// 消息路由,通常都为空 5 | /// 6 | public interface IMessageRoute 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/Never/Messages/IMessageSubscriber.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Messages 2 | { 3 | /// 4 | /// 订阅者 5 | /// 6 | public interface IMessageSubscriber 7 | { 8 | } 9 | 10 | /// 11 | /// 订阅者 12 | /// 13 | /// 消息类型 14 | public interface IMessageSubscriber : IMessageSubscriber 15 | where TMessage : IMessage 16 | { 17 | /// 18 | /// 消息处理约定 19 | /// 20 | /// 上下文 21 | /// 消息消息 22 | void Execute(IMessageContext context, TMessage message); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Never/Messages/MessageExcutingElement.cs: -------------------------------------------------------------------------------- 1 | using Never.Logging; 2 | using System; 3 | 4 | namespace Never.Messages 5 | { 6 | /// 7 | /// 消息执行过程中一些元素 8 | /// 9 | public struct MessageExcutingElement 10 | { 11 | /// 12 | /// 日志 13 | /// 14 | public ILoggerBuilder LoggerBuilder { get; set; } 15 | 16 | /// 17 | /// 消息处理者 18 | /// 19 | public IMessageSubscriber MessageHandler { get; set; } 20 | 21 | /// 22 | /// 消息类型,通常只有一个 23 | /// 24 | public Type MessageHandlerType { get; set; } 25 | 26 | /// 27 | /// 消息上下文 28 | /// 29 | public IMessageContext MessageContext { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Never/Messages/Microstoft/MessageConnection.cs: -------------------------------------------------------------------------------- 1 | #if NET461 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Messaging; 7 | using System.Text; 8 | 9 | namespace Never.Messages.Microstoft 10 | { 11 | /// 12 | /// MSMQ消息链接对象 13 | /// 14 | public class MessageConnection : DefaultMessageConnection, Never.Messages.IMessageConnection 15 | { 16 | #region const 17 | 18 | /// 19 | /// 格式为[OS:{1}\Private$\{2}] 20 | /// 21 | public const string MSMQ_OS_Route = @"FormatName:DIRECT=OS:{0}\Private$\{1}"; 22 | 23 | /// 24 | /// 格式为[TCP:{1}\Private$\{2}] 25 | /// 26 | public const string MSMQ_TCP_Route = @"FormatName:DIRECT=TCP:{0}\Private$\{1}"; 27 | 28 | #endregion const 29 | } 30 | } 31 | 32 | #endif -------------------------------------------------------------------------------- /src/Never/Messages/TestMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Messages 4 | { 5 | /// 6 | /// 测试消息 7 | /// 8 | [Serializable] 9 | public sealed class TestMessage : Never.Messages.IMessage 10 | { 11 | /// 12 | /// 测试消息Id 13 | /// 14 | public int Id { get; set; } 15 | 16 | /// 17 | /// 测试消息Name 18 | /// 19 | public string Name { get; set; } 20 | 21 | /// 22 | /// 测试消息其他 23 | /// 24 | public string Other { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Never/Reflection/IEmitBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Reflection.Emit; 4 | 5 | namespace Never.Reflection 6 | { 7 | /// 8 | /// 定义Emit操作接口 9 | /// 10 | public interface IEmitBuilder 11 | { 12 | /// 13 | /// 约定方法的调用 14 | /// 15 | CallingConventions CallingConventions { get; } 16 | 17 | /// 18 | /// 方法参数的类型 19 | /// 20 | Type[] ParameterTypes { get; } 21 | 22 | /// 23 | /// 返回的类型 24 | /// 25 | Type ReturnType { get; } 26 | 27 | /// 28 | /// IL指令 29 | /// 30 | ILGenerator IL { get; } 31 | 32 | /// 33 | /// 声明一个新临时变量 34 | /// 35 | /// 变量类型 36 | /// 37 | ILocal DeclareLocal(Type localType); 38 | 39 | /// 40 | /// 声明一个新标签 41 | /// 42 | /// 43 | ILabel DefineLabel(); 44 | } 45 | } -------------------------------------------------------------------------------- /src/Never/Reflection/ILabel.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection.Emit; 2 | 3 | namespace Never.Reflection 4 | { 5 | /// 6 | /// 标签 7 | /// 8 | public interface ILabel : IOwner 9 | { 10 | #region prop 11 | 12 | /// 13 | /// 标签 14 | /// 15 | Label Label { get; } 16 | 17 | #endregion prop 18 | } 19 | } -------------------------------------------------------------------------------- /src/Never/Reflection/ILocal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection.Emit; 3 | 4 | namespace Never.Reflection 5 | { 6 | /// 7 | /// 局部变量 8 | /// 9 | public interface ILocal : IOwner 10 | { 11 | #region porp 12 | 13 | /// 14 | /// 变量对象 15 | /// 16 | Type LocalType { get; } 17 | 18 | /// 19 | /// 索引 20 | /// 21 | int Index { get; } 22 | 23 | /// 24 | /// 局部变量 25 | /// 26 | LocalBuilder LocalBuilder { get; } 27 | 28 | #endregion porp 29 | } 30 | } -------------------------------------------------------------------------------- /src/Never/Reflection/IOwner.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Reflection 2 | { 3 | /// 4 | /// 所属者属性 5 | /// 6 | public interface IOwner 7 | { 8 | /// 9 | /// 所拥有者 10 | /// 11 | object Owner { get; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Never/Reflection/MyLabel.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection.Emit; 2 | 3 | namespace Never.Reflection 4 | { 5 | /// 6 | /// 标签 7 | /// 8 | public struct MyLabel : ILabel, IOwner 9 | { 10 | #region prop 11 | 12 | /// 13 | /// 标签 14 | /// 15 | public Label Label { get; set; } 16 | 17 | /// 18 | /// 所拥有者 19 | /// 20 | public object Owner { get; set; } 21 | 22 | #endregion prop 23 | } 24 | } -------------------------------------------------------------------------------- /src/Never/Reflection/MyLocal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection.Emit; 3 | 4 | namespace Never.Reflection 5 | { 6 | /// 7 | /// 局部变量 8 | /// 9 | public struct MyLocal : ILocal, IOwner 10 | { 11 | #region porp 12 | 13 | /// 14 | /// 变量对象 15 | /// 16 | public Type LocalType { get; set; } 17 | 18 | /// 19 | /// 索引 20 | /// 21 | public int Index { get; set; } 22 | 23 | /// 24 | /// 局部变量 25 | /// 26 | public LocalBuilder LocalBuilder { get; set; } 27 | 28 | /// 29 | /// 所拥有者 30 | /// 31 | public object Owner { get; set; } 32 | 33 | #endregion porp 34 | } 35 | } -------------------------------------------------------------------------------- /src/Never/Reflection/OpCodeTrace.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection.Emit; 2 | 3 | namespace Never.Reflection 4 | { 5 | /// 6 | /// OpCode轨迹 7 | /// 8 | public struct OpCodeTrace 9 | { 10 | /// 11 | /// 当前OpCode 12 | /// 13 | public OpCode? OpCode { get; set; } 14 | 15 | /// 16 | /// 操作方法的名字 17 | /// 18 | public string MethodName { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Never/Remoting/Http/ResponseResult.cs: -------------------------------------------------------------------------------- 1 | using Never; 2 | using Never.Sockets.AsyncArgs; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Collections.Specialized; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace Never.Remoting.Http 12 | { 13 | /// 14 | /// 处理结果 15 | /// 16 | public class ResponseResult : EventArgs, IResponseHandlerResult 17 | { 18 | #region prop 19 | 20 | /// 21 | /// body内容 22 | /// 23 | public MemoryStream Body { get; set; } 24 | 25 | /// 26 | /// 查询参数 27 | /// 28 | public NameValueCollection Query { get; set; } 29 | 30 | /// 31 | /// form参数 32 | /// 33 | public NameValueCollection Form { get; set; } 34 | 35 | /// 36 | /// header参数 37 | /// 38 | public NameValueCollection Headers { get; set; } 39 | 40 | #endregion 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Never/Remoting/IRemoteRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.Specialized; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Never.Remoting 10 | { 11 | /// 12 | /// 请求参数 13 | /// 14 | public interface IRemoteRequest 15 | { 16 | #region prop 17 | 18 | /// 19 | /// 命令类型 20 | /// 21 | string CommandType { get; } 22 | 23 | #endregion 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Never/Remoting/IRemoteResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Remoting 8 | { 9 | /// 10 | /// 响应结果 11 | /// 12 | public interface IRemoteResponse 13 | { 14 | /// 15 | /// 命令类型 16 | /// 17 | string CommandType { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Never/Remoting/IRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Remoting 8 | { 9 | /// 10 | /// 请求处理 11 | /// 12 | public interface IRequestHandler 13 | { 14 | /// 15 | /// 请求处理 16 | /// 17 | /// 18 | /// 19 | TaskCompletionSource Excute(IRemoteRequest request); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Never/Remoting/IResponseHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Remoting 8 | { 9 | /// 10 | /// 响应处理 11 | /// 12 | public interface IResponseHandler 13 | { 14 | /// 15 | /// 请求处理 16 | /// 17 | /// 18 | /// 19 | /// 20 | IResponseHandlerResult Excute(IResponseHandlerContext context, IRemoteRequest request); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Never/Remoting/IResponseHandlerContext.cs: -------------------------------------------------------------------------------- 1 | using Never; 2 | using Never.Sockets.AsyncArgs; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Never.Remoting 10 | { 11 | /// 12 | /// 上下文 13 | /// 14 | public interface IResponseHandlerContext 15 | { 16 | /// 17 | /// socket事件 18 | /// 19 | SocketEventArgs EventArgs { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Never/Remoting/IResponseHandlerResult.cs: -------------------------------------------------------------------------------- 1 | using Never; 2 | using Never.Sockets.AsyncArgs; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Collections.Specialized; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace Never.Remoting 12 | { 13 | /// 14 | /// 处理结果 15 | /// 16 | public interface IResponseHandlerResult 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Never/Security/IUser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Security 4 | { 5 | /// 6 | /// 当前会员 7 | /// 8 | public interface IUser : IEquatable 9 | { 10 | #region property 11 | 12 | /// 13 | /// 用户注册Id 14 | /// 15 | long UserId { get; } 16 | 17 | /// 18 | /// 用户名 19 | /// 20 | string UserName { get; } 21 | 22 | #endregion property 23 | } 24 | } -------------------------------------------------------------------------------- /src/Never/Security/IWorker.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Security 2 | { 3 | /// 4 | /// 作业操作者 5 | /// 6 | public interface IWorker 7 | { 8 | /// 9 | /// 操作者名字 10 | /// 11 | string WorkerName { get; } 12 | 13 | /// 14 | /// 操作者Id 15 | /// 16 | long WorkerId { get; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Never/Serialization/Json/DataContractAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Serialization.Json 4 | { 5 | /// 6 | /// 表示是一个json对象 7 | /// 8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = false)] 9 | public sealed class DataContractAttribute : Attribute 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /src/Never/Serialization/Json/DataMemberAttribute.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shelldudu/never/ee9eb8560e2e75461e539604947a9aa6b78e2688/src/Never/Serialization/Json/DataMemberAttribute.cs -------------------------------------------------------------------------------- /src/Never/Serialization/Json/Deserialize/ContentNodeType.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Serialization.Json.Deserialize 2 | { 3 | /// 4 | /// json当前节点类型 5 | /// 6 | public enum ContentNodeType 7 | { 8 | /// 9 | /// 是一个字符串 10 | /// 11 | String = 0, 12 | 13 | /// 14 | /// 是一个数组 15 | /// 16 | Array = 1, 17 | 18 | /// 19 | /// 是一个对象 20 | /// 21 | Object = 2 22 | } 23 | } -------------------------------------------------------------------------------- /src/Never/Serialization/Json/Deserialize/IObjectContentNode.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Serialization.Json.Deserialize 2 | { 3 | /// 4 | /// json 节点 5 | /// 6 | public interface IObjectContentNode : IContentNode 7 | { 8 | /// 9 | /// 节点内容,当前有Object和数组两种 10 | /// 11 | object Node { get; } 12 | 13 | /// 14 | /// json当前节点类型 15 | /// 16 | ContentNodeType NodeType { get; } 17 | 18 | /// 19 | /// 原始json 串 20 | /// 21 | string Original { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Never/Serialization/Json/IConvertMethodProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Serialization.Json 2 | { 3 | /// 4 | /// 转换方法提供者 5 | /// 6 | /// 7 | public interface IConvertMethodProvider 8 | { 9 | /// 10 | /// 从对象中写入流中 11 | /// 12 | /// 写入流 13 | /// 配置项 14 | /// 15 | void Write(ISerializerWriter writer, JsonSerializeSetting setting, T source); 16 | 17 | /// 18 | /// 在流中读取字节后转换为对象 19 | /// 20 | /// 配置项 21 | /// 节点流内容 22 | /// 字符读取器 23 | /// 是否检查空值 24 | /// 25 | T Parse(IDeserializerReader reader, JsonDeserializeSetting setting, IContentNode node, bool checkNullValue); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Never/Serialization/Json/IDeserialierBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Serialization.Json 4 | { 5 | /// 6 | /// 反序列化构建 7 | /// 8 | /// 9 | public interface IDeserialierBuilder 10 | { 11 | /// 12 | /// 进行构建,该回调方法第一个参数是读取器,第二个参数是配置,第三个参数:下一个数组层次,如果为1,则表示数组连续,比如2维数据,通常为0 13 | /// 14 | /// 15 | Func Build(JsonDeserializeSetting setting); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Never/Serialization/Json/ISerialierBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Serialization.Json 4 | { 5 | /// 6 | /// Interface ISerialierBuilder 7 | /// 8 | /// 9 | public interface ISerialierBuilder 10 | { 11 | /// 12 | /// 进行构建,该回调方法第一个参数是写入器,第二个参数是配置,第三个参数是数据类型,第四个参数:如果上层也是复合对象,当前对象也是复合对象,则调用的时候层次会加1,类似递归 13 | /// 14 | Action Build(JsonSerializeSetting setting); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Never/Serialization/Json/ISerializerWriter.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Serialization.Json 2 | { 3 | /// 4 | /// 序列化写入流 5 | /// 6 | public interface ISerializerWriter 7 | { 8 | /// 9 | /// 将字符数组写入文本流。 10 | /// 11 | /// 要写入文本流中的字符数组 12 | void Write(char[] buffer); 13 | 14 | /// 15 | /// 将字符数组写入文本流。 16 | /// 17 | /// 要写入文本流中的字符数组 18 | /// 数组开始索引 19 | /// 要追加的字符数 20 | void Write(char[] buffer, int startIndex, int charCount = 0); 21 | 22 | /// 23 | /// 将字符写入文本流。 24 | /// 25 | /// 要写入文本流中的字符。 26 | void Write(char value); 27 | 28 | /// 29 | /// 将字符串写入文本流 30 | /// 31 | /// 字符串 32 | void Write(string value); 33 | } 34 | } -------------------------------------------------------------------------------- /src/Never/Serialization/Json/IgnoreDataMemberAttribute.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shelldudu/never/ee9eb8560e2e75461e539604947a9aa6b78e2688/src/Never/Serialization/Json/IgnoreDataMemberAttribute.cs -------------------------------------------------------------------------------- /src/Never/Serialization/Json/InsideHandleType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Serialization.Json 8 | { 9 | /// 10 | /// 内部处理type 11 | /// 12 | public enum InsideHandleType 13 | { 14 | /// 15 | /// string 16 | /// 17 | @string = 0, 18 | 19 | /// 20 | /// datetime 21 | /// 22 | @datetime = 1, 23 | 24 | /// 25 | /// datetimeoffset 26 | /// 27 | @datetimeoffset = 2, 28 | 29 | /// 30 | /// guid 31 | /// 32 | @guid =3, 33 | 34 | /// 35 | /// timespan 36 | /// 37 | @timespan = 4, 38 | 39 | /// 40 | /// decimal 41 | /// 42 | @decimal = 5 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Never/Serialization/Json/JsonEnumTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Serialization.Json 2 | { 3 | /// 4 | /// value 标签引号类型 5 | /// 6 | public enum ValueQuoteSignal : byte 7 | { 8 | /// 9 | /// 无,默认值 10 | /// 11 | No = 0, 12 | 13 | /// 14 | /// 单引号 15 | /// 16 | Single = 1, 17 | 18 | /// 19 | /// 双引号 20 | /// 21 | Double = 2, 22 | } 23 | 24 | /// 25 | /// 当前内容的容器结构类型 26 | /// 27 | public enum ContainerSignal : byte 28 | { 29 | /// 30 | /// 空的 31 | /// 32 | Empty = 0, 33 | 34 | /// 35 | /// 是{对象,表示当前内容是在{的容器中 36 | /// 37 | Object = 1, 38 | 39 | /// 40 | /// 是[对象,表示当前内容是在[的容器中 41 | /// 42 | Array = 2, 43 | } 44 | } -------------------------------------------------------------------------------- /src/Never/Singleton.cs: -------------------------------------------------------------------------------- 1 | namespace Never 2 | { 3 | /// 4 | /// 创建单例对象 5 | /// 6 | /// 单例对象 7 | public sealed class Singleton 8 | { 9 | #region field 10 | 11 | /// 12 | /// 单例对象 13 | /// 14 | private static T instance; 15 | 16 | #endregion field 17 | 18 | #region instance 19 | 20 | /// 21 | /// 单例对象 22 | /// 23 | public static T Instance 24 | { 25 | get 26 | { 27 | return instance; 28 | } 29 | 30 | set 31 | { 32 | instance = value; 33 | } 34 | } 35 | 36 | #endregion instance 37 | } 38 | } -------------------------------------------------------------------------------- /src/Never/Sockets/AsyncArgs/ISocketBuffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Sockets.AsyncArgs 8 | { 9 | /// 10 | /// 缓冲区 11 | /// 12 | public interface ISocketBuffer 13 | { 14 | /// 15 | /// 缓存区 16 | /// 17 | ArraySegment Segment { get; } 18 | 19 | /// 20 | /// 所在组 21 | /// 22 | RangeTuple Group { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Never/Sockets/AsyncArgs/ISocketBufferProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Sockets.AsyncArgs 8 | { 9 | /// 10 | /// 缓冲区 11 | /// 12 | public interface ISocketBufferProvider 13 | { 14 | /// 15 | /// 获取一个缓冲区 16 | /// 17 | /// 18 | ISocketBuffer Alloc(); 19 | 20 | /// 21 | /// 回收 22 | /// 23 | /// 24 | void Recycle(ISocketBuffer item); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Never/Sockets/AsyncArgs/ISocketProtocol.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.Sockets.AsyncArgs 9 | { 10 | /// 11 | /// 协议 12 | /// 13 | public interface ISocketProtocol 14 | { 15 | /// 16 | /// 将date转成发送的数据 17 | /// 18 | /// 原始数据 19 | /// 20 | byte[] To(byte[] data); 21 | 22 | /// 23 | /// 将接受到的数据转成目标数据 24 | /// 25 | /// 接受的目标数据 26 | /// 27 | byte[] From(ConcurrentQueue collection); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Never/Sockets/AsyncArgs/SocketSetting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Sockets.AsyncArgs 8 | { 9 | /// 10 | /// 11 | /// 12 | public class SocketSetting 13 | { 14 | /// 15 | /// socket接受数据缓存区大小(8k) 16 | /// 17 | public int ReceiveBufferSize { get; set; } = 1024 * 8; 18 | 19 | /// 20 | /// socket发送数据缓存区大小(8k) 21 | /// 22 | public int SendBufferSize { get; set; } = 1024 * 8; 23 | 24 | /// 25 | /// 服务器最大连接 26 | /// 27 | public int MaxBacklog { get; set; } = 100; 28 | 29 | /// 30 | /// 心跳间隔 31 | /// 32 | public TimeSpan KeepAlivePeriod { get; set; } = TimeSpan.FromSeconds(1); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Never/Sockets/AsyncArgs/SocketUserToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.Concurrent; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.Sockets.AsyncArgs 9 | { 10 | /// 11 | /// token 12 | /// 13 | public class SocketUserToken 14 | { 15 | /// 16 | /// 当前缓冲区信息 17 | /// 18 | public ISocketBuffer SocketBuffer { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Never/SqlClient/IParameterPrefixProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Never.SqlClient 2 | { 3 | /// 4 | /// 参数前缀 5 | /// 6 | public interface IParameterPrefixProvider 7 | { 8 | /// 9 | /// 获取参数的前缀,比如@ ; ?等 10 | /// 11 | /// 12 | string GetParameterPrefix(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Never/SqlClient/ITransactionExecuter.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | 3 | namespace Never.SqlClient 4 | { 5 | /// 6 | /// 事务执行者 7 | /// 8 | public interface ITransactionExecuter 9 | { 10 | /// 11 | /// 开启新事务 12 | /// 13 | void BeginTransaction(); 14 | 15 | /// 16 | /// 开启新事务 17 | /// 18 | /// 19 | void BeginTransaction(IsolationLevel level); 20 | 21 | /// 22 | /// 提交 23 | /// 24 | void CommitTransaction(); 25 | 26 | /// 27 | /// 提交 28 | /// 29 | /// 关闭连接 30 | void CommitTransaction(bool closeConnection); 31 | 32 | /// 33 | /// 回滚 34 | /// 35 | void RollBackTransaction(); 36 | 37 | /// 38 | /// 回滚 39 | /// 40 | /// 关闭连接 41 | void RollBackTransaction(bool closeConnection); 42 | } 43 | } -------------------------------------------------------------------------------- /src/Never/StartupEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never 4 | { 5 | /// 6 | /// 启动事件 7 | /// 8 | public class StartupEventArgs : EventArgs 9 | { 10 | /// 11 | /// 资源 12 | /// 13 | public object Collector { get; } 14 | 15 | /// 16 | /// 启动信息 17 | /// 18 | public ApplicationStartup Startup { get; } 19 | 20 | /// 21 | /// ctor 22 | /// 23 | /// 24 | public StartupEventArgs(ApplicationStartup startup) : this(startup, null) 25 | { 26 | } 27 | 28 | /// 29 | /// ctor 30 | /// 31 | /// 32 | /// 33 | public StartupEventArgs(ApplicationStartup startup, object collector) 34 | { 35 | this.Startup = startup; 36 | this.Collector = collector; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/Never/Startups/IAssemblyFilter.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Startups 2 | { 3 | /// 4 | /// 程序集过滤器 5 | /// 6 | public interface IAssemblyFilter 7 | { 8 | /// 9 | /// 要分析的程序集,为true的时候则包含分析,即在IAssemblyProcessor中出现 10 | /// 11 | /// 程序集名称 12 | /// 13 | bool Include(string assemblyFullName); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Never/Startups/IAssemblyProcessor.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace Never.Startups 4 | { 5 | /// 6 | /// 程序集加工处理器 7 | /// 8 | public interface IAssemblyProcessor 9 | { 10 | /// 11 | /// 处理程序集 12 | /// 13 | /// 程序宿主环境配置 14 | /// 程序集 15 | void Processing(IApplicationStartup application, Assembly assembly); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Never/Startups/IFilteringAssemblyProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace Never.Startups 4 | { 5 | /// 6 | /// 提供已过滤程序集提供者 7 | /// 8 | public interface IFilteringAssemblyProvider 9 | { 10 | /// 11 | /// 获取所有过滤好的程序集对象 12 | /// 13 | /// 14 | Assembly[] GetAssemblies(); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Never/Startups/IStartupService.cs: -------------------------------------------------------------------------------- 1 | namespace Never.Startups 2 | { 3 | /// 4 | /// 启动服务 5 | /// 6 | public interface IStartupService 7 | { 8 | /// 9 | /// 在程序宿主环境开始启动时刻,要处理的逻辑 10 | /// 11 | /// 启动上下文 12 | void OnStarting(StartupContext context); 13 | 14 | /// 15 | /// 排序,通常IoC的规则会排在前十,所以其他对象请在IoC后面 16 | /// 17 | int Order { get; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Never/Startups/ITypeProcessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Never.Startups 4 | { 5 | /// 6 | /// 对象类型加工处理器 7 | /// 8 | public interface ITypeProcessor 9 | { 10 | /// 11 | /// 处理类型 12 | /// 13 | /// 程序宿主环境配置 14 | /// 对象类型 15 | void Processing(IApplicationStartup application, Type type); 16 | } 17 | } -------------------------------------------------------------------------------- /test/Never.Test/CQRS/LogEventFilterAttribute.cs: -------------------------------------------------------------------------------- 1 | using Never.Aop.DomainFilters; 2 | using Never.Events; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Never.Test 8 | { 9 | public class LogEventFilterAttribute1 : Aop.DomainFilters.EventHandlerFilterAttribute 10 | { 11 | public override void OnActionExecuting(IEventContext context, IEvent e1) 12 | { 13 | Console.WriteLine("action_handler_one_param"); 14 | } 15 | } 16 | 17 | public class LogEventFilterAttribute : Aop.DomainFilters.EventHandlerFilterAttribute 18 | { 19 | public override void OnActionExecuting(IEventContext context, IEvent @event) 20 | { 21 | Console.WriteLine("action_handler_two_param"); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /test/Never.Test/CQRS/PermissionCommandFilter.cs: -------------------------------------------------------------------------------- 1 | using Never.Commands; 2 | using Never.Exceptions; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Never.Test 8 | { 9 | public class PermissionCommandFilter : Aop.DomainFilters.CommandHandlerFilterAttribute 10 | { 11 | public override void OnActionExecuting(ICommandContext context, ICommand command) 12 | { 13 | Console.WriteLine("prm_handler_act_param"); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /test/Never.Test/CQRS/TestAggregateRoot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Never.Test 6 | { 7 | public class TestAggregateRoot : Never.Domains.AggregateRoot, Never.Domains.IHandle 8 | { 9 | public TestAggregateRoot() 10 | : base(Guid.NewGuid()) 11 | { 12 | this.ApplyEvent(new TestEvent1()); 13 | } 14 | 15 | public void Handle(TestEvent1 e) 16 | { 17 | 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/Never.Test/CQRS/TestMessage.cs: -------------------------------------------------------------------------------- 1 | using Never.Messages; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Never.Test 8 | { 9 | public class TestMessage : IMessage 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /test/Never.Test/CQRS/TestSubscriber.cs: -------------------------------------------------------------------------------- 1 | using Never.Messages; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Never.Test 7 | { 8 | public class TestSubscriber : IMessageSubscriber 9 | { 10 | public void Execute(IMessageContext context, TestMessage e) 11 | { 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /test/Never.Test/Caching/CachingTest.cs: -------------------------------------------------------------------------------- 1 | using Never.Caching; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.Test 9 | { 10 | public class CachingTest 11 | { 12 | [Xunit.Fact] 13 | public void TestThreadContextCache() 14 | { 15 | var cache = new ThreadContextCache(); 16 | cache.Set("A", "120"); 17 | Task.Run(() => 18 | { 19 | Console.WriteLine(cache.Get("A")); 20 | System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5)); 21 | cache = new ThreadContextCache(); 22 | cache.Set("B", "12"); 23 | cache.Dispose(); 24 | GC.Collect(); 25 | }); 26 | 27 | Console.WriteLine(cache.Get("A")); 28 | System.Threading.Thread.Sleep(TimeSpan.FromSeconds(6)); 29 | Console.WriteLine(cache.Get("B")); 30 | Console.ReadLine(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /test/Never.Test/Configurations/AppConfigTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Test 8 | { 9 | internal class AppConfigTest 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /test/Never.Test/Reflection/EmitTest.cs: -------------------------------------------------------------------------------- 1 | using Never.Reflection; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Never.Test 9 | { 10 | public class EmitTest 11 | { 12 | [Xunit.Fact] 13 | public void TestCtor() 14 | { 15 | var emit = EasyEmitBuilder>.NewDynamicMethod(); 16 | emit.NewObject(typeof(MyCommandTwo), Type.EmptyTypes); 17 | emit.Return(); 18 | 19 | var com = emit.CreateDelegate()(); 20 | } 21 | } 22 | 23 | public class MyCommand 24 | { 25 | public int Id { get; set; } 26 | 27 | protected MyCommand() 28 | { 29 | } 30 | } 31 | 32 | public class MyCommandTwo : MyCommand 33 | { 34 | public MyCommandTwo() 35 | { 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /test/Never.Test/Serialization/Enum.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Never.Test 6 | { 7 | public enum ABC : long 8 | { 9 | A = 1, 10 | B = 2, 11 | C = long.MaxValue, 12 | } 13 | 14 | public enum Machine 15 | { 16 | car = 2, 17 | mobile = 3 18 | } 19 | } -------------------------------------------------------------------------------- /test/Never.Test/SqlClient/CallTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Test 8 | { 9 | /// 10 | /// 11 | /// 12 | public class CallTest : Program 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /test/Never.Test/SqlClient/DeleteTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Test 8 | { 9 | /// 10 | /// 11 | /// 12 | public class DeleteTest : Program 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /test/Never.Test/SqlClient/UpdateTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.Test 8 | { 9 | /// 10 | /// 11 | /// 12 | public class UpdateTest : Program 13 | { 14 | //System.Net.Sockets.AddressFamily 15 | } 16 | } -------------------------------------------------------------------------------- /test/Never.TestMvc/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace Never.TestMvc 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/Never.TestMvc/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace Never.TestMvc 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/Never.TestMvc/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Override the default bootstrap behavior where horizontal description lists 13 | will truncate terms that are too long to fit in the left column 14 | */ 15 | .dl-horizontal dt { 16 | white-space: normal; 17 | } 18 | 19 | /* Set width on the form input elements since they're 100% wide by default */ 20 | input, 21 | select, 22 | textarea { 23 | max-width: 280px; 24 | } 25 | -------------------------------------------------------------------------------- /test/Never.TestMvc/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using Never.Commands; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | 8 | namespace Never.TestMvc.Controllers 9 | { 10 | public class HomeController : Controller 11 | { 12 | public HomeController(ICommandBus commandBus, MvcApplication.MyDispose myDispose) 13 | { 14 | 15 | } 16 | 17 | public ActionResult Index() 18 | { 19 | return View(); 20 | } 21 | 22 | public ActionResult About() 23 | { 24 | ViewBag.Message = "Your application description page."; 25 | 26 | return View(); 27 | } 28 | 29 | public ActionResult Contact() 30 | { 31 | ViewBag.Message = "Your contact page."; 32 | 33 | return View(); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /test/Never.TestMvc/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="Never.TestMvc.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /test/Never.TestMvc/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息是通过以下项进行控制的 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Never.TestMvc")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Never.TestMvc")] 13 | [assembly: AssemblyCopyright("版权所有(C) 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 将使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要 19 | // 从 COM 访问此程序集中的某个类型,请针对该类型将 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID 23 | [assembly: Guid("57a54abd-d9eb-47cd-8cd1-4b9f717ecf12")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订版本 31 | // 32 | // 你可以指定所有值,也可以让修订版本和内部版本号采用默认值, 33 | // 方法是按如下所示使用 "*": 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /test/Never.TestMvc/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /test/Never.TestMvc/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
-------------------------------------------------------------------------------- /test/Never.TestMvc/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 错误 7 | 8 | 9 |
10 |

错误。

11 |

处理你的请求时出错。

12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /test/Never.TestMvc/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /test/Never.TestMvc/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /test/Never.TestMvc/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shelldudu/never/ee9eb8560e2e75461e539604947a9aa6b78e2688/test/Never.TestMvc/favicon.ico -------------------------------------------------------------------------------- /test/Never.TestMvc/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shelldudu/never/ee9eb8560e2e75461e539604947a9aa6b78e2688/test/Never.TestMvc/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /test/Never.TestMvc/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shelldudu/never/ee9eb8560e2e75461e539604947a9aa6b78e2688/test/Never.TestMvc/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /test/Never.TestMvc/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shelldudu/never/ee9eb8560e2e75461e539604947a9aa6b78e2688/test/Never.TestMvc/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /test/Never.TestMvc/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shelldudu/never/ee9eb8560e2e75461e539604947a9aa6b78e2688/test/Never.TestMvc/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /test/Never.TestWebApi/Controllers/v1.0/ValuesController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Http; 6 | using Microsoft.AspNetCore.Mvc; 7 | 8 | namespace Never.TestWebApi.Controllers.v1._0 9 | { 10 | [Produces("application/json")] 11 | [Route("api/v1.0/Values")] 12 | public class ValuesController : Controller 13 | { 14 | // GET api/values 15 | [HttpGet] 16 | public IEnumerable Get() 17 | { 18 | return new string[] { "value3", "value4" }; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /test/Never.TestWebApi/Controllers/v1.1/ValuesController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Http; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Never.Attributes; 8 | 9 | namespace Never.TestWebApi.Controllers.v1._1 10 | { 11 | [Route("api/v1.1")] 12 | //[ApiAreaRemark("v1.1")] 13 | public class ValuesController : Controller 14 | { 15 | // GET api/values 16 | [HttpGet] 17 | [ApiActionRemark("a914012f291b", "HttpGet")] 18 | public IEnumerable Get() 19 | { 20 | return new string[] { "value5", "value6" }; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /test/Never.TestWebApi/Properties/PublishProfiles/FolderProfile.pubxml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | FileSystem 9 | FileSystem 10 | Release 11 | Any CPU 12 | 13 | True 14 | False 15 | netcoreapp2.1 16 | win-x64 17 | f7c37fd0-3d35-4e93-98b5-87caeecba94d 18 | false 19 | <_IsPortable>true 20 | obj\Publish\ 21 | True 22 | 23 | -------------------------------------------------------------------------------- /test/Never.TestWebApi/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:52386/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "launchUrl": "api/values", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "Development" 17 | } 18 | }, 19 | "Never.TestWebApi": { 20 | "commandName": "Project", 21 | "launchBrowser": true, 22 | "launchUrl": "api/values", 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | }, 26 | "applicationUrl": "http://localhost:52387/" 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/Never.TestWebApi/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/Never.TestWebApi/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ApiLoad": 6, 3 | "server.ports": "5001", 4 | "Logging": { 5 | "IncludeScopes": false, 6 | "Debug": { 7 | "LogLevel": { 8 | "Default": "Warning" 9 | } 10 | }, 11 | "Console": { 12 | "LogLevel": { 13 | "Default": "Warning" 14 | } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /test/Never.TestWebApi/install.bat: -------------------------------------------------------------------------------- 1 | set path=%CD% 2 | %windir%\system32\sc.exe create Never.TestWebApi binpath= %path%\Never.TestWebApi.exe 3 | pause -------------------------------------------------------------------------------- /test/Never.TestWebApi/uninstall.bat: -------------------------------------------------------------------------------- 1 | set path=%CD% 2 | %windir%\system32\sc.exe delete Never.TestWebApi 3 | pause -------------------------------------------------------------------------------- /test/Never.TestWorkerService/Logging/请假成功短信通知.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.WorkFlow.Test.Logging 8 | { 9 | public class 请假成功短信通知 : Never.Messages.IMessage 10 | { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/Never.TestWorkerService/Messages/主管审批意见结果.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.WorkFlow.Test.Messages 8 | { 9 | public class 主管审批意见结果 : IWorkStepMessage 10 | { 11 | public Guid TaskId { get; set; } 12 | 13 | public int AttachState { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /test/Never.TestWorkerService/Messages/人事审批请假意见结果.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.WorkFlow.Test.Messages 8 | { 9 | public class 人事审批请假意见结果 : IWorkStepMessage 10 | { 11 | public Guid TaskId { get; set; } 12 | 13 | public int AttachState { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /test/Never.TestWorkerService/Messages/组长审批意见结果.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Never.WorkFlow.Test.Messages 8 | { 9 | public class 组长审批意见结果 : IWorkStepMessage 10 | { 11 | public Guid TaskId { get; set; } 12 | 13 | public int AttachState { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /test/Never.TestWorkerService/Program.cs: -------------------------------------------------------------------------------- 1 | using Never.Attributes; 2 | using Never.Commands; 3 | using Never.EasySql; 4 | using Never.EasySql.SqlClient; 5 | using Never.EventStreams; 6 | using Never.IoC; 7 | using Never.IoC.Providers; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading.Tasks; 12 | using Microsoft.Extensions.DependencyInjection; 13 | using Microsoft.Extensions.Hosting; 14 | using Never.WorkerService; 15 | 16 | namespace Never.WorkFlow.Test 17 | { 18 | public class Program 19 | { 20 | public static void Main(string[] args) 21 | { 22 | var build = CreateHostBuilder(args).Build(); 23 | build.Run(); 24 | } 25 | 26 | public static IHostBuilder CreateHostBuilder(string[] args) => 27 | Host.CreateDefaultBuilder(args) 28 | .ConfigureServices((hostContext, services) => 29 | { 30 | services.AddHostedService(); 31 | }) 32 | .UseStartup(); 33 | } 34 | } -------------------------------------------------------------------------------- /test/Never.TestWorkerService/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:55023/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "Never.TestWorkFlow": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "http://localhost:55024/" 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /test/Never.TestWorkerService/Steps/主管审批.cs: -------------------------------------------------------------------------------- 1 | using Never.WorkFlow.Attributes; 2 | using Never.WorkFlow.Test.Messages; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Never.WorkFlow.Test.Steps 10 | { 11 | [WorkStep("a73901108f30", Introduce = "人事主管审批审批", Sumarry = "主管审批")] 12 | public class 主管审批 : IWorkStep 13 | { 14 | public IWorkStepMessage Execute(IWorkContext context, IWorkStepMessage preResult) 15 | { 16 | // return context.CreateWatiingMessage(); 17 | return new 主管审批意见结果() { TaskId = context.TaskId }; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /test/Never.TestWorkerService/Steps/人事审批.cs: -------------------------------------------------------------------------------- 1 | using Never.WorkFlow.Attributes; 2 | using Never.WorkFlow.Test.Messages; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Never.WorkFlow.Test.Steps 10 | { 11 | [WorkStep("a739010fd35f", Introduce = "人事审批", Sumarry = "人事审批")] 12 | public class 人事审批 : IWorkStep 13 | { 14 | public IWorkStepMessage Execute(IWorkContext context, IWorkStepMessage preResult) 15 | { 16 | return new 人事审批请假意见结果() { TaskId = context.TaskId }; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /test/Never.TestWorkerService/Steps/组长审批.cs: -------------------------------------------------------------------------------- 1 | using Never.WorkFlow.Attributes; 2 | using Never.WorkFlow.Test.Messages; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Never.WorkFlow.Test.Steps 10 | { 11 | [WorkStep("a739010ffe40", Introduce = "组长审批", Sumarry = "组长审批")] 12 | public class 组长审批 : IWorkStep 13 | { 14 | public IWorkStepMessage Execute(IWorkContext context, IWorkStepMessage preResult) 15 | { 16 | return new 组长审批意见结果() { TaskId = context.TaskId }; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /test/Never.TestWorkerService/Steps/请假申请.cs: -------------------------------------------------------------------------------- 1 | using Never.WorkFlow.Attributes; 2 | using Never.WorkFlow.Test.Messages; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Never.WorkFlow.Test.Steps 10 | { 11 | [WorkStep("a7390110b733", Introduce = "用户申请请假", Sumarry = "这是用户申请请假的")] 12 | public class 请假申请 : IWorkStep 13 | { 14 | public IWorkStepMessage Execute(IWorkContext context, IWorkStepMessage preResult) 15 | { 16 | return preResult; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /test/Never.TestWorkerService/Worker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.Extensions.Hosting; 7 | using Microsoft.Extensions.Logging; 8 | 9 | namespace Never.WorkFlow.Test 10 | { 11 | public class Worker : BackgroundService 12 | { 13 | private readonly ILogger _logger; 14 | 15 | public Worker(ILogger logger,IServiceProvider serviceProvider) 16 | { 17 | _logger = logger; 18 | } 19 | 20 | protected override async Task ExecuteAsync(CancellationToken stoppingToken) 21 | { 22 | while (!stoppingToken.IsCancellationRequested) 23 | { 24 | _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); 25 | await Task.Delay(1000, stoppingToken); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/Never.TestWorkerService/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/Never.TestWorkerService/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/Never.TestWorkerService/install.bat: -------------------------------------------------------------------------------- 1 | set path=%CD% 2 | %windir%\system32\sc.exe create Never.TestWorkerService binpath= %path%\Never.TestWorkerService.exe 3 | pause -------------------------------------------------------------------------------- /test/Never.TestWorkerService/uninstall.bat: -------------------------------------------------------------------------------- 1 | set path=%CD% 2 | %windir%\system32\sc.exe delete Never.TestWorkerService 3 | pause -------------------------------------------------------------------------------- /tools/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shelldudu/never/ee9eb8560e2e75461e539604947a9aa6b78e2688/tools/NuGet.exe --------------------------------------------------------------------------------