├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── docs ├── MemberPath.png ├── MemberPath.vsdx ├── Schema.png ├── Schema.vsdx ├── 凭证验证.md ├── 文件路径解析状态图.png └── 文件路径解析状态图.vsdx ├── samples ├── Zongsoft.Options.Configuration.Samples.Views │ ├── GeneralOptionView.Designer.cs │ ├── GeneralOptionView.cs │ ├── GeneralOptionView.resx │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Zongsoft.Options.Configuration.Samples.Views.csproj │ ├── Zongsoft.Options.Configuration.Samples.Views.plugin │ └── Zongsoft.Options.Configuration.Samples.Views.sln ├── Zongsoft.Options.Configuration.Samples │ ├── AdvanceOptionElement.cs │ ├── CmdletOptionElement.cs │ ├── CmdletOptionElementCollection.cs │ ├── CmdletType.cs │ ├── GeneralOptionElement.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SettingOptionElement.cs │ ├── SettingOptionElementCollection.cs │ ├── UseOptionElementExample.cs │ ├── Zongsoft.Options.Configuration.Samples.csproj │ ├── Zongsoft.Options.Configuration.Samples.option │ ├── Zongsoft.Options.Configuration.Samples.plugin │ └── Zongsoft.Options.Configuration.Samples.sln ├── Zongsoft.Samples.Models │ ├── App.config │ ├── Models │ │ ├── EmployeeBase.cs │ │ ├── IEmployee.cs │ │ ├── IManager.cs │ │ ├── IMyEntity.cs │ │ ├── IPerson.cs │ │ ├── IUserEntity.cs │ │ ├── Person.cs │ │ ├── User.cs │ │ ├── UserEntity.cs │ │ └── UserExtension.cs │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── PropertyToken.cs │ ├── Zongsoft.Samples.Models.csproj │ └── Zongsoft.Samples.Models.sln └── Zongsoft.Services.Samples │ ├── Properties │ ├── AssemblyInfo.cs │ └── Resources.resx │ ├── TimingWorker.cs │ ├── Zongsoft.Services.Samples.csproj │ ├── Zongsoft.Services.Samples.plugin │ └── Zongsoft.Services.Samples.sln ├── src ├── Collections │ ├── BinaryComparer.cs │ ├── Category.cs │ ├── CategoryCollection.cs │ ├── Collection.cs │ ├── CollectionRemovedEventArgs.cs │ ├── CollectionRemovedReason.cs │ ├── DequeuedEventArgs.cs │ ├── DictionaryExtension.cs │ ├── EnqueuedEventArgs.cs │ ├── Enumerable.cs │ ├── Finder.cs │ ├── Finder`1.cs │ ├── HashSetExtension.cs │ ├── HierarchicalExpression.cs │ ├── HierarchicalNode.cs │ ├── HierarchicalNodeCollection.cs │ ├── HierarchicalNode`1.cs │ ├── IFindable.cs │ ├── IFindable`1.cs │ ├── IMatchable.cs │ ├── IMatchable`1.cs │ ├── IMatcher.cs │ ├── IMatcher`1.cs │ ├── INamedCollection.cs │ ├── IQueue.cs │ ├── IQueueProvider.cs │ ├── IQueue`1.cs │ ├── IReadOnlyNamedCollection.cs │ ├── ISelectable.cs │ ├── KeyValuePairExtension.cs │ ├── Matcher.cs │ ├── MatcherAttribute.cs │ ├── NamedCollection.cs │ ├── NamedCollectionBase.cs │ ├── NamedCollectionBaseOriginal.cs │ ├── NamedCollectionOriginal.cs │ ├── ObjectCache.cs │ ├── ObjectPool.cs │ ├── Queue.cs │ ├── ReadOnlyNamedCollection.cs │ └── ReadOnlyNamedCollectionBase.cs ├── Common │ ├── Activator.cs │ ├── ActivatorParameterDescriptor.cs │ ├── BitVector32.cs │ ├── Buffer.cs │ ├── Convert.cs │ ├── EnumEntry.cs │ ├── EnumUtility.cs │ ├── ExecutionResult.cs │ ├── IActivator.cs │ ├── IEventHandler.cs │ ├── IEventHandler`1.cs │ ├── IExecutionFilter.cs │ ├── IExecutionFilter`1.cs │ ├── IExecutionHandler.cs │ ├── IExecutionHandler`1.cs │ ├── IExecutionResult.cs │ ├── ISequence.cs │ ├── IValidator.cs │ ├── Randomizer.cs │ ├── SequenceBase.cs │ ├── StringExtension.cs │ ├── TypeExtension.cs │ └── UriExtension.cs ├── Communication │ ├── ChannelAsyncEventArgs.cs │ ├── ChannelBase.cs │ ├── ChannelContext.cs │ ├── ChannelEventArgs.cs │ ├── ChannelFailureEventArgs.cs │ ├── ChannelPipelineContext.cs │ ├── Composition │ │ ├── ExecutedEventArgs.cs │ │ ├── ExecutingEventArgs.cs │ │ ├── ExecutionContext.cs │ │ ├── ExecutionEventArgs.cs │ │ ├── ExecutionFilterCollection.cs │ │ ├── ExecutionFilterComposite.cs │ │ ├── ExecutionFilterCompositeCollection.cs │ │ ├── ExecutionHandler.cs │ │ ├── ExecutionHandlerBase.cs │ │ ├── ExecutionPipeline.cs │ │ ├── ExecutionPipelineCollection.cs │ │ ├── ExecutionPipelineContext.cs │ │ ├── ExecutionPipelineExecutedEventArgs.cs │ │ ├── ExecutionPipelineExecutingEventArgs.cs │ │ ├── ExecutionResult.cs │ │ ├── ExecutionUtility.cs │ │ ├── Executor.cs │ │ ├── IExecutionCombiner.cs │ │ ├── IExecutionContext.cs │ │ ├── IExecutionFilter.cs │ │ ├── IExecutionHandler.cs │ │ ├── IExecutionPipelineContext.cs │ │ ├── IExecutionPipelineSelector.cs │ │ └── IExecutor.cs │ ├── IChannel.cs │ ├── IChannelContext.cs │ ├── IListener.cs │ ├── INotifier.cs │ ├── IPEndPointConverter.cs │ ├── IPacketizer.cs │ ├── IPacketizerFactory.cs │ ├── IReceiver.cs │ ├── ISender.cs │ ├── ListenerBase.cs │ ├── Package.cs │ ├── PackageContent.cs │ ├── PackageContentCollection.cs │ ├── PackageHeader.cs │ ├── PackageHeaderCollection.cs │ ├── PackageSerializer.cs │ ├── PacketizerFactory.cs │ ├── ReceivedEventArgs.cs │ ├── SentEventArgs.cs │ └── Utility.cs ├── ComponentModel │ ├── AliasAttribute.cs │ ├── CustomBooleanConverter.cs │ ├── EncodingConverter.cs │ ├── EnumConverter.cs │ ├── GuidConverter.cs │ ├── INotifyProgressChanged.cs │ ├── ISchemaProvider.cs │ ├── PropertyChangedEventArgs.cs │ ├── Schema.cs │ ├── SchemaAction.cs │ ├── SchemaActionCollection.cs │ ├── SchemaCategory.cs │ ├── SchemaCategoryCollection.cs │ ├── SchemaCollection.cs │ └── SchemaProvider.cs ├── Data │ ├── Condition.cs │ ├── ConditionCollection.cs │ ├── ConditionCombination.cs │ ├── ConditionOperator.cs │ ├── Conditional.cs │ ├── ConditionalAttribute.cs │ ├── ConditionalBase.cs │ ├── ConditionalBehaviors.cs │ ├── ConditionalConverter.cs │ ├── ConditionalConverterContext.cs │ ├── ConditionalRange.cs │ ├── ConditionalRange`1.cs │ ├── DataAccessBase.cs │ ├── DataAccessContext.cs │ ├── DataAccessContextBase.cs │ ├── DataAccessErrorEventArgs.cs │ ├── DataAccessEventArgs.cs │ ├── DataAccessException.cs │ ├── DataAccessFilterBase.cs │ ├── DataAccessFilterCollection.cs │ ├── DataAccessMethod.cs │ ├── DataAccessNaming.cs │ ├── DataAccessProviderBase.cs │ ├── DataConflictException.cs │ ├── DataCountedEventArgs.cs │ ├── DataCountingEventArgs.cs │ ├── DataDeletedEventArgs.cs │ ├── DataDeletingEventArgs.cs │ ├── DataDictionaries.cs │ ├── DataException.cs │ ├── DataExecutedEventArgs.cs │ ├── DataExecutingEventArgs.cs │ ├── DataExistedEventArgs.cs │ ├── DataExistingEventArgs.cs │ ├── DataGettedEventArgs.cs │ ├── DataGettingEventArgs.cs │ ├── DataIncrementedEventArgs.cs │ ├── DataIncrementingEventArgs.cs │ ├── DataInsertedEventArgs.cs │ ├── DataInsertingEventArgs.cs │ ├── DataRecordExtension.cs │ ├── DataSearcher.cs │ ├── DataSearcherAttribute.cs │ ├── DataSelectedEventArgs.cs │ ├── DataSelectingEventArgs.cs │ ├── DataServiceBase.cs │ ├── DataUpdatedEventArgs.cs │ ├── DataUpdatingEventArgs.cs │ ├── DataUpseringEventArgs.cs │ ├── DataUpsertedEventArgs.cs │ ├── Grouping.cs │ ├── ICondition.cs │ ├── IConditional.cs │ ├── IConditionalConverter.cs │ ├── IConditionalRange.cs │ ├── IDataAccess.cs │ ├── IDataAccessContextBase.cs │ ├── IDataAccessFilter.cs │ ├── IDataAccessNaming.cs │ ├── IDataAccessProvider.cs │ ├── IDataDictionary.cs │ ├── IDataDictionary`1.cs │ ├── IDataMutateContextBase.cs │ ├── IDataSearcher.cs │ ├── IDataSearcherConditioner.cs │ ├── IDataSearcher`1.cs │ ├── IDataService.cs │ ├── IDataService`1.cs │ ├── IDataValidator.cs │ ├── IDataValueBinder.cs │ ├── IModel.cs │ ├── IPageable.cs │ ├── ISchema.cs │ ├── ISchemaParser.cs │ ├── ISchemaParser`1.cs │ ├── ISchema`1.cs │ ├── Interval.cs │ ├── Metadata │ │ ├── DataAssociationConstraint.cs │ │ ├── DataAssociationConstraintActor.cs │ │ ├── DataAssociationLink.cs │ │ ├── DataAssociationMultiplicity.cs │ │ ├── DataCommandType.cs │ │ ├── IDataCommand.cs │ │ ├── IDataCommandParameter.cs │ │ ├── IDataEntity.cs │ │ ├── IDataEntityComplexProperty.cs │ │ ├── IDataEntityProperty.cs │ │ ├── IDataEntityPropertyCollection.cs │ │ ├── IDataEntityPropertySequence.cs │ │ ├── IDataEntitySimplexProperty.cs │ │ ├── IDataMetadataContainer.cs │ │ ├── IDataMetadataLoader.cs │ │ ├── IDataMetadataManager.cs │ │ └── IDataMetadataProvider.cs │ ├── Model.cs │ ├── ModelAttribute.cs │ ├── ModelEmitter.cs │ ├── Pageable.cs │ ├── Paging.cs │ ├── PagingEventArgs.cs │ ├── Range.cs │ ├── Range`1.cs │ ├── SchemaMemberBase.cs │ ├── SchemaParserBase.cs │ ├── Scoping.cs │ └── Sorting.cs ├── Diagnostics │ ├── Configuration │ │ ├── LoggerElement.cs │ │ ├── LoggerHandlerElement.cs │ │ └── LoggerHandlerElementCollection.cs │ ├── ConsoleLogger.cs │ ├── DataLogger.cs │ ├── FailureEventArgs.cs │ ├── FileLogger.cs │ ├── ILogger.cs │ ├── LogEntry.cs │ ├── LogLevel.cs │ ├── Logger.cs │ ├── LoggerHandler.cs │ ├── LoggerHandlerCollection.cs │ ├── LoggerHandlerPredication.cs │ ├── LoggerInitializer.cs │ └── TextFileLogger.cs ├── Expressions │ ├── ITokenizer.cs │ ├── Lexer.cs │ ├── SymbolToken.cs │ ├── SyntaxException.cs │ ├── Token.cs │ ├── TokenResult.cs │ ├── TokenScanner.cs │ ├── TokenType.cs │ └── Tokenization │ │ ├── BooleanTokenizer.cs │ │ ├── IdentifierTokenizer.cs │ │ ├── KeywordTokenizer.cs │ │ ├── LiteralTokenizerBase.cs │ │ ├── NullTokenizer.cs │ │ ├── NumberTokenizer.cs │ │ ├── StringTokenizer.cs │ │ └── SymbolTokenizer.cs ├── IO │ ├── BinaryReaderExtension.cs │ ├── DirectoryInfo.cs │ ├── FileInfo.cs │ ├── FileSystem.cs │ ├── IDirectory.cs │ ├── IFile.cs │ ├── IFileSystem.cs │ ├── LocalFileSystem.cs │ ├── Path.cs │ ├── PathAnchor.cs │ ├── PathException.cs │ ├── PathInfo.cs │ ├── PathUtility.cs │ └── TextReaderExtension.cs ├── Messaging │ ├── IMessageQueue.cs │ ├── ITopic.cs │ ├── ITopicProvider.cs │ ├── ITopicSubscription.cs │ ├── MessageBase.cs │ ├── MessageDequeueSettings.cs │ ├── MessageEnqueueSettings.cs │ ├── MessageQueueBase.cs │ ├── MessageQueueListener.cs │ ├── TopicMessage.cs │ ├── TopicReceiverBase.cs │ ├── TopicSubscription.cs │ └── TopicSubscriptionFallbackBehavior.cs ├── Options │ ├── Configuration │ │ ├── ConnectionStringElement.cs │ │ ├── ConnectionStringElementCollection.cs │ │ ├── FilterElement.cs │ │ ├── FilterElementCollection.cs │ │ ├── OptionConfiguration.cs │ │ ├── OptionConfigurationDeclaration.cs │ │ ├── OptionConfigurationDeclarationCollection.cs │ │ ├── OptionConfigurationElement.cs │ │ ├── OptionConfigurationElementCollection.cs │ │ ├── OptionConfigurationElementCollection`1.cs │ │ ├── OptionConfigurationElementCollection`2.cs │ │ ├── OptionConfigurationException.cs │ │ ├── OptionConfigurationLoader.cs │ │ ├── OptionConfigurationManager.cs │ │ ├── OptionConfigurationProperty.cs │ │ ├── OptionConfigurationPropertyAttribute.cs │ │ ├── OptionConfigurationPropertyBehavior.cs │ │ ├── OptionConfigurationPropertyCollection.cs │ │ ├── OptionConfigurationSection.cs │ │ ├── OptionConfigurationSectionCollection.cs │ │ ├── OptionConfigurationUtility.cs │ │ ├── SettingElement.cs │ │ └── SettingElementCollection.cs │ ├── IOption.cs │ ├── IOptionLoader.cs │ ├── IOptionLoaderSelector.cs │ ├── IOptionProvider.cs │ ├── IOptionView.cs │ ├── IOptionViewBuilder.cs │ ├── ISettingsProvider.cs │ ├── Option.cs │ ├── OptionHelper.cs │ ├── OptionLoaderAttribute.cs │ ├── OptionLoaderSelector.cs │ ├── OptionManager.cs │ ├── OptionNode.cs │ ├── OptionNodeCollection.cs │ ├── OptionUtility.cs │ └── Profiles │ │ ├── Profile.cs │ │ ├── Profile.ini │ │ ├── ProfileComment.cs │ │ ├── ProfileCommentCollection.cs │ │ ├── ProfileEntry.cs │ │ ├── ProfileEntryCollection.cs │ │ ├── ProfileException.cs │ │ ├── ProfileItem.cs │ │ ├── ProfileItemCollection.cs │ │ ├── ProfileItemCollectionExtension.cs │ │ ├── ProfileItemType.cs │ │ ├── ProfileItemViewBase.cs │ │ ├── ProfileSection.cs │ │ └── ProfileSectionCollection.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Reflection │ ├── ExpressionUtility.cs │ ├── Expressions │ │ ├── ConstantExpression.cs │ │ ├── IMemberExpression.cs │ │ ├── IdentifierExpression.cs │ │ ├── IndexerExpression.cs │ │ ├── MemberExpression.cs │ │ ├── MemberExpressionEvaluator.cs │ │ ├── MemberExpressionExtension.cs │ │ ├── MemberExpressionParser.cs │ │ ├── MemberExpressionType.cs │ │ └── MethodExpression.cs │ ├── FieldInfoExtension.cs │ ├── MemberAccess.cs │ ├── MemberGettingContext.cs │ ├── MemberGettingResult.cs │ ├── MemberKind.cs │ ├── MemberPathSegment.cs │ ├── MemberSettingContext.cs │ ├── PropertyInfoExtension.cs │ └── Reflector.cs ├── Resources │ └── ResourceUtility.cs ├── Runtime │ ├── Caching │ │ ├── BufferManager-Test.txt │ │ ├── BufferManager.cs │ │ ├── BufferManagerBase.cs │ │ ├── BufferManagerSelector.cs │ │ ├── BufferUtility.cs │ │ ├── CacheChangedEventArgs.cs │ │ ├── CacheChangedReason.cs │ │ ├── CacheEntry.cs │ │ ├── FileBufferManager.cs │ │ ├── IBufferManager.cs │ │ ├── IBufferManagerSelector.cs │ │ ├── ICache.cs │ │ ├── ICacheProvider.cs │ │ ├── MemoryCache.cs │ │ └── StorageBase.cs │ └── Serialization │ │ ├── DictionarySerializer.cs │ │ ├── IDictionarySerializer.cs │ │ ├── ISerializable.cs │ │ ├── ISerializationBinder.cs │ │ ├── ISerializationConverter.cs │ │ ├── ISerializationWriter.cs │ │ ├── ISerializer.cs │ │ ├── ITextSerializer.cs │ │ ├── JsonSerializationWriter.cs │ │ ├── SerializationBehavior.cs │ │ ├── SerializationBinderAttribute.cs │ │ ├── SerializationBinderBase.cs │ │ ├── SerializationContext.cs │ │ ├── SerializationDirection.cs │ │ ├── SerializationEventArgs.cs │ │ ├── SerializationMemberAttribute.cs │ │ ├── SerializationMemberBehavior.cs │ │ ├── SerializationMembers.cs │ │ ├── SerializationNamingConvention.cs │ │ ├── SerializationSettings.cs │ │ ├── SerializationWriterContext.cs │ │ ├── SerializationWritingEventArgs.cs │ │ ├── SerializationWroteEventArgs.cs │ │ ├── Serializer.cs │ │ ├── SerializerAttribute.cs │ │ ├── TextSerializationSettings.cs │ │ ├── TextSerializationWriter.cs │ │ └── TextSerializationWriterBase.cs ├── Security │ ├── CensorshipException.cs │ ├── Credential.cs │ ├── CredentialException.cs │ ├── CredentialIdentity.cs │ ├── CredentialPrincipal.cs │ ├── CredentialRegisterEventArgs.cs │ ├── CredentialUnregisterEventArgs.cs │ ├── ICensorship.cs │ ├── ICredentialProvider.cs │ ├── ISecretProvider.cs │ ├── Membership │ │ ├── Authentication.cs │ │ ├── AuthenticationContext.cs │ │ ├── AuthenticationException.cs │ │ ├── AuthenticationReason.cs │ │ ├── Authorization.cs │ │ ├── AuthorizationAttribute.cs │ │ ├── AuthorizationContext.cs │ │ ├── AuthorizationException.cs │ │ ├── AuthorizationToken.cs │ │ ├── ChangedEventArgs.cs │ │ ├── IAuthenticator.cs │ │ ├── IAuthorizer.cs │ │ ├── IChallenger.cs │ │ ├── IMemberProvider.cs │ │ ├── INamespaceProvider.cs │ │ ├── IPermissionProvider.cs │ │ ├── IRole.cs │ │ ├── IRoleProvider.cs │ │ ├── IUser.cs │ │ ├── IUserIdentity.cs │ │ ├── IUserProvider.cs │ │ ├── Member.cs │ │ ├── MemberType.cs │ │ ├── Permission.cs │ │ ├── PermissionFilter.cs │ │ ├── UserIdentityType.cs │ │ └── UserStatus.cs │ ├── PasswordUtility.cs │ ├── SecretProvider.cs │ └── SecurityException.cs ├── Services │ ├── ApplicationContext.cs │ ├── ApplicationModule.cs │ ├── CommandAttribute.cs │ ├── CommandBase.cs │ ├── CommandBase`1.cs │ ├── CommandCompletionContext.cs │ ├── CommandContext.cs │ ├── CommandException.cs │ ├── CommandExecutedEventArgs.cs │ ├── CommandExecutingEventArgs.cs │ ├── CommandExecutor.cs │ ├── CommandExecutorContext.cs │ ├── CommandExecutorEventArgs.cs │ ├── CommandExecutorExecutedEventArgs.cs │ ├── CommandExecutorExecutingEventArgs.cs │ ├── CommandExecutorFailureEventArgs.cs │ ├── CommandExpression.cs │ ├── CommandExpressionException.cs │ ├── CommandExpressionParser.cs │ ├── CommandLoaderBase.cs │ ├── CommandNotFoundException.cs │ ├── CommandOptionAttribute.cs │ ├── CommandOptionCollection.cs │ ├── CommandOptionException.cs │ ├── CommandOptionMissingException.cs │ ├── CommandOptionValueException.cs │ ├── CommandOutletColor.cs │ ├── CommandOutletContent.cs │ ├── CommandResult.cs │ ├── CommandTreeNode.cs │ ├── CommandTreeNodeCollection.cs │ ├── Commands │ │ ├── Utility.cs │ │ ├── WorkerCommandBase.cs │ │ ├── WorkerInfoCommand.cs │ │ ├── WorkerListenCommand.cs │ │ ├── WorkerPauseCommand.cs │ │ ├── WorkerResumeCommand.cs │ │ ├── WorkerStartCommand.cs │ │ └── WorkerStopCommand.cs │ ├── IApplicationContext.cs │ ├── IApplicationFilter.cs │ ├── IApplicationModule.cs │ ├── ICommand.cs │ ├── ICommandCompletion.cs │ ├── ICommandExecutor.cs │ ├── ICommandExpressionParser.cs │ ├── ICommandLoader.cs │ ├── ICommandOutlet.cs │ ├── ICommandResult.cs │ ├── ICommand`1.cs │ ├── IPredication.cs │ ├── IPredication`1.cs │ ├── IServiceBuilder.cs │ ├── IServiceLifetime.cs │ ├── IServiceProvider.cs │ ├── IServiceProviderFactory.cs │ ├── IServiceStorage.cs │ ├── IWorker.cs │ ├── PredicationBase.cs │ ├── PredicationCollection.cs │ ├── PredicationCollection`1.cs │ ├── PredicationCombination.cs │ ├── ServiceDependencyAttribute.cs │ ├── ServiceEntry.cs │ ├── ServiceNotFoundException.cs │ ├── ServiceProvider.cs │ ├── ServiceProviderBase.cs │ ├── ServiceProviderFactory.cs │ ├── ServiceRegisteredEventArgs.cs │ ├── ServiceResolvedEventArgs.cs │ ├── ServiceResolvingEventArgs.cs │ ├── ServiceStorage.cs │ ├── ServiceStorageBase.cs │ ├── ServiceUnregisteredEventArgs.cs │ ├── WorkerBase.cs │ ├── WorkerState.cs │ └── WorkerStateChangedEventArgs.cs ├── TaskUtility.cs ├── Terminals │ ├── Commands │ │ ├── ClearCommand.cs │ │ ├── ExitCommand.cs │ │ └── ShellCommand.cs │ ├── ConsoleTerminal.cs │ ├── ITerminal.cs │ ├── TerminalCommandContext.cs │ ├── TerminalCommandExecutor.cs │ └── TerminalStyles.cs ├── Text │ ├── Evaluation │ │ ├── BindingEvaluator.cs │ │ ├── DateTimeEvaluator.cs │ │ └── RandomEvaluator.cs │ ├── IParser.cs │ ├── ITemplateEvaluator.cs │ ├── ITextRegular.cs │ ├── ParserContextBase.cs │ ├── ParserExpression.cs │ ├── TemplateEvaluatorBase.cs │ ├── TemplateEvaluatorContext.cs │ ├── TemplateEvaluatorManager.cs │ ├── TextExpression.cs │ ├── TextExpressionArgument.cs │ ├── TextExpressionNode.cs │ ├── TextExpressionNodeCollection.cs │ ├── TextExpressionParser.cs │ └── TextRegular.cs ├── Transactions │ ├── EnlistmentContext.cs │ ├── EnlistmentPhase.cs │ ├── IEnlistment.cs │ ├── IsolationLevel.cs │ ├── Transaction.cs │ ├── TransactionBehavior.cs │ ├── TransactionInformation.cs │ └── TransactionStatus.cs ├── Transitions │ ├── IStateDiagram.cs │ ├── IStateTransfer.cs │ ├── IStateTrigger.cs │ ├── State.cs │ ├── StateContext.cs │ ├── StateContextBase.cs │ ├── StateDiagramBase.cs │ ├── StateMachine.cs │ ├── StateMachineOptions.cs │ ├── StateStepEventArgs.cs │ ├── StateStopEventArgs.cs │ ├── StateStopReason.cs │ ├── StateTransferBase.cs │ ├── StateTriggerBase.cs │ └── StateVector.cs ├── Zongsoft.CoreLibrary.csproj ├── Zongsoft.CoreLibrary.nuspec └── Zongsoft.CoreLibrary.sln └── tests ├── Collections ├── CategoryTests.cs ├── EnumerableTest.cs └── QueueTests.cs ├── Common ├── BufferTests.cs ├── ConvertTests.cs ├── EnumUtilityTests.cs ├── RandomGeneratorTests.cs ├── SequenceTests.cs ├── StringExtensionTests.cs └── TypeExtensionTests.cs ├── Data ├── ConditionCollectionTest.cs ├── ConditionTest.cs ├── ConditionalTest.cs ├── ModelTest.cs ├── RangeTest.cs ├── SchemaTest.cs └── SortingTest.cs ├── Expressions └── LexerTest.cs ├── IO ├── FileSystemTest.cs └── PathTest.cs ├── Models.cs ├── Properties ├── AssemblyInfo.cs └── Resources.resx ├── PropertyToken.cs ├── Reflection ├── FieldInfoTest.cs ├── MemberAccessTest.cs ├── MemberExpressionTest.cs └── PropertyInfoTest.cs ├── Runtime ├── Caching │ └── MemoryCacheTest.cs └── Serialization │ └── DictionarySerializerTest.cs ├── Services ├── CommandExpressionTest.cs ├── CommandTreeNodeCollectionTests.cs └── ServiceProviderTest.cs ├── Zongsoft.CoreLibrary.Tests.csproj └── packages.config /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /docs/MemberPath.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zongsoft/Zongsoft.CoreLibrary/b34af1aa94061c00f3a4f6fdca5ddd581f69449c/docs/MemberPath.png -------------------------------------------------------------------------------- /docs/MemberPath.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zongsoft/Zongsoft.CoreLibrary/b34af1aa94061c00f3a4f6fdca5ddd581f69449c/docs/MemberPath.vsdx -------------------------------------------------------------------------------- /docs/Schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zongsoft/Zongsoft.CoreLibrary/b34af1aa94061c00f3a4f6fdca5ddd581f69449c/docs/Schema.png -------------------------------------------------------------------------------- /docs/Schema.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zongsoft/Zongsoft.CoreLibrary/b34af1aa94061c00f3a4f6fdca5ddd581f69449c/docs/Schema.vsdx -------------------------------------------------------------------------------- /docs/凭证验证.md: -------------------------------------------------------------------------------- 1 | # 凭证验证 2 | 3 | 凭证验证的各种数据保存在相应的缓存容器(非关系型数据库)中。 4 | 5 | ## 注册流程 6 | 1. 每注册一个凭证则在默认缓存容器中添加一条缓存项记录,其缓存项键为:`Zongsoft.Security::`,缓存项的值则为新生成的凭证编号`CertificationId`,并设置其生命周期为系统设定的某个时长。如果指定键的缓存项已存在则用新值覆盖它。 7 | 2. 在默认容器中添加一条缓存项记录,其缓存项名键为`Zongsoft.Security.Certification:`,该缓存项的值为凭证的内容(字典),并设置其生命周期为系统设定的某个时长。 8 | 3. 在缓存容器中获取一条名为`Zongsoft.Security.Certification.Namespaces:`的缓存项(哈希集),如果获取失败则创建它,在该缓存项中添加一条记录,内容为当前生成的凭证号。 9 | 10 | 11 | ## 注销流程 12 | 1. 根据指定的凭证号在默认容器查找到对应的凭证内容;根据凭证内的用户编号将键为:`Zongsoft.Security::`的缓存项删除。 13 | 2. 将指定凭证编号的缓存项删除。 14 | 3. 在缓存容器中获取名为`Zongsoft.Security.Certification.Namespaces:`的缓存项(哈希集),如果获取成功,则将该哈希集中删除已注销的凭证号。 15 | 16 | 17 | ## 续约 18 | 1. 根据指定的凭证号在默认容器查找到对应的凭证内容;根据凭证内的用户编号将键为:`Zongsoft.Security::`的缓存项内容改写为新凭证编号,并顺延其生命周期。如果查找失败则中止续约过程。 19 | 2. 将指定凭证号的缓存项更名为新的凭证号,同时顺延该缓存项的生命周期。 20 | 3. 更新指定凭证号的缓存项内的签发时间等相关信息。 21 | 4. 在缓存容器中获取名为`Zongsoft.Security.Certification.Namespaces:`的缓存项(哈希集),如果获取成功,则将该哈希集中删除原凭证号,并新增一条新的凭证号。 22 | 23 | 24 | 数据结构:字典(Dictionary) 25 | ``` 26 | Zongsoft.Security.Certification: (duration) 27 | { 28 | CertificationId, 29 | Namespace, 30 | Scene, 31 | Duration, 32 | IssuedTime, 33 | Timestamp, 34 | User.UserId, 35 | User.Name, 36 | ExtendedProperties:= 37 | } 38 | ``` 39 | 40 | ``` 41 | 数据结构:字典(Dictionary) 42 | Zongsoft.Security.Certification.Namespaces: 43 | { 44 | : 45 | ... 46 | } 47 | ``` 48 | -------------------------------------------------------------------------------- /docs/文件路径解析状态图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zongsoft/Zongsoft.CoreLibrary/b34af1aa94061c00f3a4f6fdca5ddd581f69449c/docs/文件路径解析状态图.png -------------------------------------------------------------------------------- /docs/文件路径解析状态图.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zongsoft/Zongsoft.CoreLibrary/b34af1aa94061c00f3a4f6fdca5ddd581f69449c/docs/文件路径解析状态图.vsdx -------------------------------------------------------------------------------- /samples/Zongsoft.Options.Configuration.Samples.Views/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("Zongsoft.Options.Configuration.Samples.Views")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("Zongsoft")] 9 | [assembly: AssemblyProduct("Zongsoft.Options.Configuration.Samples.Views")] 10 | [assembly: AssemblyCopyright("Copyright(C) Zongsoft Corporation 2015. All rights reserved.")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: AssemblyVersion("1.0.0.0")] 17 | [assembly: AssemblyFileVersion("1.0.0.0")] 18 | -------------------------------------------------------------------------------- /samples/Zongsoft.Options.Configuration.Samples.Views/Zongsoft.Options.Configuration.Samples.Views.plugin: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /samples/Zongsoft.Options.Configuration.Samples/AdvanceOptionElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Zongsoft.Options; 5 | using Zongsoft.Options.Configuration; 6 | 7 | namespace Zongsoft.Options.Configuration.Samples 8 | { 9 | public class AdvanceOptionElement : OptionConfigurationElement 10 | { 11 | #region 公共属性 12 | [OptionConfigurationProperty("name", "")] 13 | public string Name 14 | { 15 | get 16 | { 17 | return (string)this["name"]; 18 | } 19 | set 20 | { 21 | this["name"] = value ?? string.Empty; 22 | } 23 | } 24 | #endregion 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /samples/Zongsoft.Options.Configuration.Samples/CmdletOptionElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Zongsoft.Options; 7 | using Zongsoft.Options.Configuration; 8 | 9 | namespace Zongsoft.Options.Configuration.Samples 10 | { 11 | public class CmdletOptionElement : OptionConfigurationElement 12 | { 13 | [OptionConfigurationProperty("name", "")] 14 | public string Name 15 | { 16 | get 17 | { 18 | return (string)this["name"]; 19 | } 20 | set 21 | { 22 | this["name"] = value; 23 | } 24 | } 25 | 26 | [OptionConfigurationProperty("type", CmdletType.Text)] 27 | public CmdletType CommandType 28 | { 29 | get 30 | { 31 | return (CmdletType)this["type"]; 32 | } 33 | set 34 | { 35 | this["type"] = value; 36 | } 37 | } 38 | 39 | [OptionConfigurationProperty("text", "")] 40 | public string Text 41 | { 42 | get 43 | { 44 | return (string)this["text"]; 45 | } 46 | set 47 | { 48 | this["text"] = value; 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /samples/Zongsoft.Options.Configuration.Samples/CmdletOptionElementCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Zongsoft.Options; 7 | using Zongsoft.Options.Configuration; 8 | 9 | namespace Zongsoft.Options.Configuration.Samples 10 | { 11 | public class CmdletOptionElementCollection : OptionConfigurationElementCollection 12 | { 13 | protected override string ElementName 14 | { 15 | get 16 | { 17 | return "cmdlet"; 18 | } 19 | } 20 | 21 | protected override OptionConfigurationElement CreateNewElement() 22 | { 23 | return new CmdletOptionElement(); 24 | } 25 | 26 | protected override string GetElementKey(OptionConfigurationElement element) 27 | { 28 | return ((CmdletOptionElement)element).Name; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /samples/Zongsoft.Options.Configuration.Samples/CmdletType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Zongsoft.Options.Configuration.Samples 7 | { 8 | public enum CmdletType 9 | { 10 | Text, 11 | Object, 12 | StoredProcedure, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/Zongsoft.Options.Configuration.Samples/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("Zongsoft.Options.Configuration.Samples")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("Zongsoft")] 9 | [assembly: AssemblyProduct("Zongsoft.Options.Configuration.Samples")] 10 | [assembly: AssemblyCopyright("Copyright(C) Zongsoft Corporation 2015. All rights reserved.")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: AssemblyVersion("1.0.0.0")] 17 | [assembly: AssemblyFileVersion("1.0.0.0")] 18 | -------------------------------------------------------------------------------- /samples/Zongsoft.Options.Configuration.Samples/SettingOptionElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Zongsoft.Options; 7 | using Zongsoft.Options.Configuration; 8 | 9 | namespace Zongsoft.Options.Configuration.Samples 10 | { 11 | [Obsolete("不需要了,请使用 Zongsoft.Options.Configuration.SettingElement 标准实现。")] 12 | public class SettingOptionElement : OptionConfigurationElement 13 | { 14 | [OptionConfigurationProperty("name", OptionConfigurationPropertyBehavior.IsKey)] 15 | public string Name 16 | { 17 | get 18 | { 19 | return (string)this["name"]; 20 | } 21 | set 22 | { 23 | this["name"] = value; 24 | } 25 | } 26 | 27 | [OptionConfigurationProperty("value")] 28 | public string Value 29 | { 30 | get 31 | { 32 | return (string)this["value"]; 33 | } 34 | set 35 | { 36 | this["value"] = value; 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /samples/Zongsoft.Options.Configuration.Samples/SettingOptionElementCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Zongsoft.Options; 7 | using Zongsoft.Options.Configuration; 8 | 9 | namespace Zongsoft.Options.Configuration.Samples 10 | { 11 | [Obsolete("不需要了,请使用 Zongsoft.Options.Configuration.SettingElementCollection 标准实现。")] 12 | public class SettingOptionElementCollection : OptionConfigurationElementCollection 13 | { 14 | public SettingOptionElementCollection() : base("setting") 15 | { 16 | } 17 | 18 | //protected override OptionConfigurationElement CreateNewElement() 19 | //{ 20 | // return new SettingOptionElement(); 21 | //} 22 | 23 | //protected override string GetElementKey(OptionConfigurationElement element) 24 | //{ 25 | // return ((SettingOptionElement)element).Key; 26 | //} 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/Zongsoft.Options.Configuration.Samples/Zongsoft.Options.Configuration.Samples.option: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 27 | -------------------------------------------------------------------------------- /samples/Zongsoft.Options.Configuration.Samples/Zongsoft.Options.Configuration.Samples.plugin: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 24 | 25 | -------------------------------------------------------------------------------- /samples/Zongsoft.Options.Configuration.Samples/Zongsoft.Options.Configuration.Samples.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zongsoft.Options.Configuration.Samples", "Zongsoft.Options.Configuration.Samples.csproj", "{CA815A8B-D577-4127-8073-819F788B6325}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {CA815A8B-D577-4127-8073-819F788B6325}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {CA815A8B-D577-4127-8073-819F788B6325}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {CA815A8B-D577-4127-8073-819F788B6325}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {CA815A8B-D577-4127-8073-819F788B6325}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /samples/Zongsoft.Samples.Models/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /samples/Zongsoft.Samples.Models/Models/IManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Zongsoft.Samples.Models 5 | { 6 | [Zongsoft.Data.Model("Manager")] 7 | public interface IManager : IEmployee 8 | { 9 | bool IsAdvance 10 | { 11 | get; 12 | set; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/Zongsoft.Samples.Models/Models/IPerson.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Zongsoft.Samples.Models 5 | { 6 | public interface IPerson : Zongsoft.Data.IModel //, System.ComponentModel.INotifyPropertyChanged 7 | { 8 | string Name 9 | { 10 | get; set; 11 | } 12 | 13 | string FullName 14 | { 15 | get; set; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /samples/Zongsoft.Samples.Models/Models/IUserEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Collections.Generic; 4 | 5 | namespace Zongsoft.Samples.Models 6 | { 7 | [Zongsoft.Data.Model("Security.User")] 8 | public interface IUserEntity : IPerson 9 | { 10 | [Zongsoft.Data.Conditional(ConverterType = typeof(object))] 11 | uint UserId 12 | { 13 | get; set; 14 | } 15 | 16 | //[DefaultValue("Zongsoft")] 17 | string Namespace 18 | { 19 | get; set; 20 | } 21 | 22 | string Email 23 | { 24 | get; set; 25 | } 26 | 27 | string PhoneNumber 28 | { 29 | get; set; 30 | } 31 | 32 | [Zongsoft.Data.Model.Property(Data.Model.PropertyImplementationMode.Extension, typeof(UserExtension))] 33 | string Avatar 34 | { 35 | get; set; 36 | } 37 | 38 | //[DefaultValue("xoxo")] 39 | [Zongsoft.Data.Model.Property(Data.Model.PropertyImplementationMode.Extension, typeof(UserExtension))] 40 | string AvatarUrl 41 | { 42 | get; 43 | } 44 | 45 | //[DefaultValue(typeof(List))] 46 | //[DefaultValue(typeof(UserExtension))] 47 | //[Zongsoft.Data.Entity.Property(Data.Entity.PropertyImplementationMode.Singleton, typeof(UserExtension))] 48 | ICollection Assets 49 | { 50 | get; 51 | } 52 | 53 | //[Zongsoft.Data.Entity.Property(IsExplicitImplementation = true)] 54 | byte Status 55 | { 56 | get; set; 57 | } 58 | 59 | DateTime? StatusTimestamp 60 | { 61 | get; set; 62 | } 63 | 64 | string PrincipalId 65 | { 66 | get; set; 67 | } 68 | 69 | DateTime CreatedTime 70 | { 71 | get; set; 72 | } 73 | 74 | string Description 75 | { 76 | get; set; 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /samples/Zongsoft.Samples.Models/Models/UserExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Zongsoft.Samples.Models 5 | { 6 | public static class UserExtension 7 | { 8 | public static string GetAvatar(IUserEntity user, string value) 9 | { 10 | return value; 11 | } 12 | 13 | //public static bool SetAvatar(IUserEntity user, string value, out string result) 14 | //{ 15 | // result = value; 16 | // return true; 17 | //} 18 | 19 | //public static bool SetAvatar(IUserEntity user, string oldValue, string newValue, out string result) 20 | //{ 21 | // result = newValue; 22 | // return true; 23 | //} 24 | 25 | public static string GetAvatarUrl(IUserEntity user, string value = null) 26 | { 27 | var avatar = user.Avatar; 28 | 29 | if(string.IsNullOrEmpty(avatar)) 30 | return string.Empty; 31 | 32 | return "url:" + avatar; 33 | } 34 | 35 | public static ICollection GetAssets(IUserEntity user) 36 | { 37 | return new System.Collections.ObjectModel.ObservableCollection(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /samples/Zongsoft.Samples.Models/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Zongsoft.Samples.DataEntity")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Zongsoft.Samples.DataEntity")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("83d92987-b84d-479a-ad5d-bed18fdfdce2")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /samples/Zongsoft.Samples.Models/PropertyToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Zongsoft.Samples.Models 4 | { 5 | internal struct PropertyToken 6 | { 7 | public PropertyToken(int ordinal, Func getter, Action setter) 8 | { 9 | this.Ordinal = ordinal; 10 | this.Getter = getter; 11 | this.Setter = setter; 12 | } 13 | 14 | public readonly int Ordinal; 15 | public readonly Func Getter; 16 | public readonly Action Setter; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /samples/Zongsoft.Samples.Models/Zongsoft.Samples.Models.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27703.2018 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zongsoft.Samples.Models", "Zongsoft.Samples.Models.csproj", "{83D92987-B84D-479A-AD5D-BED18FDFDCE2}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {83D92987-B84D-479A-AD5D-BED18FDFDCE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {83D92987-B84D-479A-AD5D-BED18FDFDCE2}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {83D92987-B84D-479A-AD5D-BED18FDFDCE2}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {83D92987-B84D-479A-AD5D-BED18FDFDCE2}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {8141FA1E-23C1-485A-866B-E9B9FC83CB6B} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /samples/Zongsoft.Services.Samples/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("Zongsoft.Examples.Daemon")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("Zongsoft.Examples.Daemon")] 10 | [assembly: AssemblyCopyright("Copyright © 2013-2015")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | 15 | [assembly: AssemblyVersion("1.0.0.*")] 16 | [assembly: AssemblyFileVersion("1.0.0.0")] 17 | -------------------------------------------------------------------------------- /samples/Zongsoft.Services.Samples/Zongsoft.Services.Samples.plugin: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | -------------------------------------------------------------------------------- /samples/Zongsoft.Services.Samples/Zongsoft.Services.Samples.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zongsoft.Services.Samples", "Zongsoft.Services.Samples.csproj", "{9B54D558-4294-4F97-AD29-03D2288B24DF}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {9B54D558-4294-4F97-AD29-03D2288B24DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {9B54D558-4294-4F97-AD29-03D2288B24DF}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {9B54D558-4294-4F97-AD29-03D2288B24DF}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {9B54D558-4294-4F97-AD29-03D2288B24DF}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /src/Collections/HashSetExtension.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Collections 31 | { 32 | public static class HashSetExtension 33 | { 34 | public static T[] ToArray(this HashSet hashset) 35 | { 36 | if(hashset == null) 37 | return null; 38 | 39 | T[] result = new T[hashset.Count]; 40 | hashset.CopyTo(result); 41 | return result; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Collections/IFindable.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2018 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Collections 30 | { 31 | /// 32 | /// 表示提供查找功能的接口。 33 | /// 34 | public interface IFindable 35 | { 36 | /// 37 | /// 查找方法。 38 | /// 39 | /// 指定的查找参数。 40 | /// 输出参数,表示查找成果的结果。 41 | /// 返回真(True)表示查找成果,否则表示查找失败。 42 | bool Find(object parameter, out object result); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Collections/IFindable`1.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2018 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Collections 30 | { 31 | /// 32 | /// 表示提供查找功能的接口。 33 | /// 34 | /// 指示查找元素的泛型参数。 35 | public interface IFindable : IFindable 36 | { 37 | /// 38 | /// 查找方法。 39 | /// 40 | /// 指定的查找参数。 41 | /// 输出参数,表示查找成果的结果。 42 | /// 返回真(True)表示查找成果,否则表示查找失败。 43 | bool Find(object parameter, out T result); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Collections/IMatchable.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Collections 30 | { 31 | /// 32 | /// 提供一种特定于类型的通用匹配方法,某些同类型的类通过实现此接口对其进行更进一步的匹配。 33 | /// 34 | public interface IMatchable 35 | { 36 | /// 37 | /// 指示当前对象是否匹配指定参数的条件约束。 38 | /// 39 | /// 指定是否匹配逻辑的参数。 40 | /// 如果当前对象符合参数的匹配规则,则为真(true);否则为假(false)。 41 | bool IsMatch(object parameter); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Collections/IMatchable`1.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Collections 30 | { 31 | public interface IMatchable : IMatchable 32 | { 33 | bool IsMatch(T parameter); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Collections/IMatcher.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Collections 31 | { 32 | public interface IMatcher 33 | { 34 | bool Match(object target, object parameter); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Collections/IMatcher`1.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Collections 31 | { 32 | public interface IMatcher : IMatcher 33 | { 34 | bool Match(object target, T parameter); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Collections/IQueueProvider.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Collections 31 | { 32 | public interface IQueueProvider 33 | { 34 | IQueue GetQueue(string name); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Common/IEventHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Common 30 | { 31 | /// 32 | /// 关于事件处理程序的接口。 33 | /// 34 | public interface IEventHandler 35 | { 36 | /// 37 | /// 进行事件处理的方法。 38 | /// 39 | /// 事件来源,即事件的激发者。 40 | /// 事件参数。 41 | void Handle(object source, object parameter); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Common/IEventHandler`1.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Common 30 | { 31 | /// 32 | /// 关于事件处理程序的接口。 33 | /// 34 | public interface IEventHandler : IEventHandler 35 | { 36 | /// 37 | /// 进行事件处理的方法。 38 | /// 39 | /// 事件来源,即事件的激发者。 40 | /// 事件参数。 41 | void Handle(object source, TParameter parameter); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Common/IExecutionFilter.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * _____ ______ 3 | * /_ / ____ ____ ____ _________ / __/ /_ 4 | * / / / __ \/ __ \/ __ \/ ___/ __ \/ /_/ __/ 5 | * / /__/ /_/ / / / / /_/ /\_ \/ /_/ / __/ /_ 6 | * /____/\____/_/ /_/\__ /____/\____/_/ \__/ 7 | * /____/ 8 | * 9 | * Authors: 10 | * 钟峰(Popeye Zhong) 11 | * 12 | * Copyright (C) 2015-2019 Zongsoft Corporation 13 | * 14 | * This file is part of Zongsoft.CoreLibrary. 15 | * 16 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 17 | * modify it under the terms of the GNU Lesser General Public 18 | * License as published by the Free Software Foundation; either 19 | * version 2.1 of the License, or (at your option) any later version. 20 | * 21 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 | * Lesser General Public License for more details. 25 | * 26 | * The above copyright notice and this permission notice shall be 27 | * included in all copies or substantial portions of the Software. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 31 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 32 | */ 33 | 34 | using System; 35 | using System.Collections.Generic; 36 | 37 | namespace Zongsoft.Common 38 | { 39 | public interface IExecutionFilter 40 | { 41 | void OnFiltered(object context); 42 | void OnFiltering(object context); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Common/IValidator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015-2018 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Common 31 | { 32 | /// 33 | /// 表示提供有效性验证功能的接口。 34 | /// 35 | /// 指定 36 | public interface IValidator 37 | { 38 | /// 39 | /// 验证指定的数据是否有效。 40 | /// 41 | /// 指定的待验证的数据。 42 | /// 当内部验证失败的回调处理函数,传入的字符串参数表示验证失败的消息文本。 43 | /// 如果验证通过则返回真(True),否则返回假(False)。 44 | bool Validate(T data, Action failure = null); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Communication/Composition/ExecutedEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Communication.Composition 31 | { 32 | public class ExecutedEventArgs : ExecutionEventArgs 33 | { 34 | #region 构造函数 35 | public ExecutedEventArgs(IExecutionContext context) : base(context) 36 | { 37 | } 38 | #endregion 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Communication/Composition/ExecutionFilterCollection.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using System.Collections.ObjectModel; 30 | 31 | namespace Zongsoft.Communication.Composition 32 | { 33 | public class ExecutionFilterCollection : Zongsoft.Collections.NamedCollectionBase 34 | { 35 | #region 构造函数 36 | public ExecutionFilterCollection() 37 | { 38 | } 39 | #endregion 40 | 41 | #region 重写方法 42 | protected override string GetKeyForItem(IExecutionFilter item) 43 | { 44 | return item.Name; 45 | } 46 | #endregion 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Communication/Composition/ExecutionPipelineExecutedEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Communication.Composition 31 | { 32 | public class ExecutionPipelineExecutedEventArgs : ExecutionEventArgs 33 | { 34 | public ExecutionPipelineExecutedEventArgs(IExecutionPipelineContext context) : base(context) 35 | { 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Communication/Composition/IExecutionCombiner.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Communication.Composition 31 | { 32 | public interface IExecutionCombiner 33 | { 34 | object Combine(IEnumerable contexts); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Communication/Composition/IExecutionPipelineSelector.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Communication.Composition 31 | { 32 | public interface IExecutionPipelineSelector 33 | { 34 | IEnumerable SelectPipelines(IExecutionContext context, IEnumerable pipelines); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Communication/IChannelContext.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Communication 30 | { 31 | public interface IChannelContext : Composition.IExecutionContext 32 | { 33 | /// 34 | /// 获取当前通讯的通道。 35 | /// 36 | IChannel Channel 37 | { 38 | get; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Communication/IListener.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2011-2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Net; 29 | 30 | namespace Zongsoft.Communication 31 | { 32 | /// 33 | /// 提供关于通讯侦听的功能的接口。 34 | /// 35 | public interface IListener : Services.IWorker, IDisposable 36 | { 37 | /// 38 | /// 获取当前是否处于侦听状态。 39 | /// 40 | bool IsListening 41 | { 42 | get; 43 | } 44 | 45 | /// 46 | /// 获取通讯侦听器的信息接收处理器对象。 47 | /// 48 | IReceiver Receiver 49 | { 50 | get; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Communication/IPacketizerFactory.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2011-2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Communication 30 | { 31 | /// 32 | /// 提供获取通讯协议解析器的接口。 33 | /// 34 | public interface IPacketizerFactory 35 | { 36 | /// 37 | /// 获取一个通讯协议解析器对象。 38 | /// 39 | /// 要获取解析器对应的通道。 40 | /// 返回获取的解析器,如果获取失败则返回空(null)。 41 | IPacketizer GetPacketizer(IChannel channel); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Communication/IReceiver.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2011-2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using System.Linq; 30 | using System.Text; 31 | 32 | namespace Zongsoft.Communication 33 | { 34 | public interface IReceiver 35 | { 36 | event EventHandler Failed; 37 | event EventHandler Received; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Communication/SentEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2011-2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Communication 31 | { 32 | [Serializable] 33 | public class SentEventArgs : ChannelAsyncEventArgs 34 | { 35 | #region 构造函数 36 | public SentEventArgs(IChannel channel) : this(channel, null) 37 | { 38 | } 39 | 40 | public SentEventArgs(IChannel channel, object asyncState) : base(channel, asyncState) 41 | { 42 | } 43 | #endregion 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/ComponentModel/CustomBooleanConverter.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zongsoft/Zongsoft.CoreLibrary/b34af1aa94061c00f3a4f6fdca5ddd581f69449c/src/ComponentModel/CustomBooleanConverter.cs -------------------------------------------------------------------------------- /src/ComponentModel/INotifyProgressChanged.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2008-2010 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | using System.Collections.Generic; 30 | 31 | namespace Zongsoft.ComponentModel 32 | { 33 | /// 34 | /// 表示提供进度通知的接口。 35 | /// 36 | public interface INotifyProgressChanged 37 | { 38 | /// 39 | /// 进度发生改变后的通知事件。 40 | /// 41 | event ProgressChangedEventHandler ProgressChanged; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/ComponentModel/SchemaCollection.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2008-2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.ComponentModel 31 | { 32 | public class SchemaCollection : Zongsoft.Collections.NamedCollectionBase 33 | { 34 | #region 构造函数 35 | public SchemaCollection() : base(StringComparer.OrdinalIgnoreCase) 36 | { 37 | } 38 | #endregion 39 | 40 | #region 重写方法 41 | protected override string GetKeyForItem(Schema item) 42 | { 43 | return item.Name; 44 | } 45 | #endregion 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Data/ConditionCombination.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zongsoft/Zongsoft.CoreLibrary/b34af1aa94061c00f3a4f6fdca5ddd581f69449c/src/Data/ConditionCombination.cs -------------------------------------------------------------------------------- /src/Data/ConditionalBehaviors.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2016-2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | 30 | namespace Zongsoft.Data 31 | { 32 | [Flags] 33 | public enum ConditionalBehaviors 34 | { 35 | /// 无特性 36 | None = 0, 37 | 38 | /// 忽略值为空(null)的查询项 39 | IgnoreNull = 1, 40 | 41 | /// 忽略值为空字符串或全空白字符串的查询项 42 | IgnoreEmpty = 2, 43 | 44 | /// 忽略值为空或全空白字符串的查询项 45 | IgnoreNullOrEmpty = 3, 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Data/DataCountedEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2016 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Data 31 | { 32 | /// 33 | /// 为数据访问的计数事件提供数据。 34 | /// 35 | public class DataCountedEventArgs : DataAccessEventArgs 36 | { 37 | #region 构造函数 38 | public DataCountedEventArgs(DataCountContextBase context) : base(context) 39 | { 40 | } 41 | #endregion 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Data/DataDeletedEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2016-2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Data 31 | { 32 | /// 33 | /// 为数据访问的删除事件提供数据。 34 | /// 35 | public class DataDeletedEventArgs : DataAccessEventArgs 36 | { 37 | #region 构造函数 38 | public DataDeletedEventArgs(DataDeleteContextBase context) : base(context) 39 | { 40 | } 41 | #endregion 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Data/DataException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2016 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Data 30 | { 31 | public class DataException : Exception 32 | { 33 | #region 构造函数 34 | public DataException() 35 | { 36 | } 37 | 38 | public DataException(string message) : base(message) 39 | { 40 | } 41 | 42 | public DataException(string message, Exception innerException = null) : base(message, innerException) 43 | { 44 | } 45 | #endregion 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Data/DataExecutedEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2016 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Data 31 | { 32 | /// 33 | /// 为数据访问的执行事件提供数据。 34 | /// 35 | public class DataExecutedEventArgs : DataAccessEventArgs 36 | { 37 | #region 构造函数 38 | public DataExecutedEventArgs(DataExecuteContextBase context) : base(context) 39 | { 40 | } 41 | #endregion 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Data/DataExistedEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Data 30 | { 31 | public class DataExistedEventArgs : DataAccessEventArgs 32 | { 33 | #region 构造函数 34 | public DataExistedEventArgs(DataExistContextBase context) : base(context) 35 | { 36 | } 37 | #endregion 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Data/DataIncrementedEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Data 30 | { 31 | public class DataIncrementedEventArgs : DataAccessEventArgs 32 | { 33 | #region 构造函数 34 | public DataIncrementedEventArgs(DataIncrementContextBase context) : base(context) 35 | { 36 | } 37 | #endregion 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Data/DataInsertedEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2016 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections; 29 | 30 | namespace Zongsoft.Data 31 | { 32 | /// 33 | /// 为数据访问的插入事件提供数据。 34 | /// 35 | public class DataInsertedEventArgs : DataAccessEventArgs 36 | { 37 | #region 构造函数 38 | public DataInsertedEventArgs(DataInsertContextBase context) : base(context) 39 | { 40 | } 41 | #endregion 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Data/DataSelectedEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2016 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections; 29 | 30 | namespace Zongsoft.Data 31 | { 32 | /// 33 | /// 为数据访问的查询事件提供数据。 34 | /// 35 | public class DataSelectedEventArgs : DataAccessEventArgs 36 | { 37 | #region 构造函数 38 | public DataSelectedEventArgs(DataSelectContextBase context) : base(context) 39 | { 40 | } 41 | #endregion 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Data/DataUpdatedEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2016 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections; 29 | 30 | namespace Zongsoft.Data 31 | { 32 | /// 33 | /// 为数据访问的更新事件提供数据。 34 | /// 35 | public class DataUpdatedEventArgs : DataAccessEventArgs 36 | { 37 | #region 构造函数 38 | public DataUpdatedEventArgs(DataUpdateContextBase context) : base(context) 39 | { 40 | } 41 | #endregion 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Data/DataUpsertedEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2016-2018 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections; 29 | 30 | namespace Zongsoft.Data 31 | { 32 | /// 33 | /// 为数据访问的新增或更新事件提供数据。 34 | /// 35 | public class DataUpsertedEventArgs : DataAccessEventArgs 36 | { 37 | #region 构造函数 38 | public DataUpsertedEventArgs(DataUpsertContextBase context) : base(context) 39 | { 40 | } 41 | #endregion 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Data/IConditional.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2016 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Data 30 | { 31 | /// 32 | /// 表示条件设置实体的接口。 33 | /// 34 | [Obsolete] 35 | public interface IConditional : IModel 36 | { 37 | /// 38 | /// 获取或设置条件的组合方式。 39 | /// 40 | ConditionCombination Combination 41 | { 42 | get; 43 | set; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Data/IConditionalConverter.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2016 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Data 31 | { 32 | public interface IConditionalConverter 33 | { 34 | ICondition Convert(ConditionalConverterContext context); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Data/IConditionalRange.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2016-2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Data 30 | { 31 | public interface IConditionalRange 32 | { 33 | bool HasValue 34 | { 35 | get; 36 | } 37 | 38 | Condition ToCondition(string name); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Data/IDataAccessNaming.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Data 31 | { 32 | /// 33 | /// 提供数据访问名映射的接口。 34 | /// 35 | public interface IDataAccessNaming : ICollection> 36 | { 37 | void Map(Type type, string name = null); 38 | void Map(string name = null); 39 | 40 | string Get(Type type); 41 | string Get(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Data/IDataAccessProvider.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2018 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Data 31 | { 32 | /// 33 | /// 表示数据访问提供程序的接口。 34 | /// 35 | public interface IDataAccessProvider 36 | { 37 | /// 38 | /// 获取或创建指定应用的数据访问器。 39 | /// 40 | /// 指定的应用名。 41 | /// 返回指定应用名的数据访问器。 42 | IDataAccess GetAccessor(string name); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Data/IDataSearcherConditioner.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * _____ ______ 3 | * /_ / ____ ____ ____ _________ / __/ /_ 4 | * / / / __ \/ __ \/ __ \/ ___/ __ \/ /_/ __/ 5 | * / /__/ /_/ / / / / /_/ /\_ \/ /_/ / __/ /_ 6 | * /____/\____/_/ /_/\__ /____/\____/_/ \__/ 7 | * /____/ 8 | * 9 | * Authors: 10 | * 钟峰(Popeye Zhong) 11 | * 12 | * Copyright (C) 2016-2019 Zongsoft Corporation 13 | * 14 | * This file is part of Zongsoft.CoreLibrary. 15 | * 16 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 17 | * modify it under the terms of the GNU Lesser General Public 18 | * License as published by the Free Software Foundation; either 19 | * version 2.1 of the License, or (at your option) any later version. 20 | * 21 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 | * Lesser General Public License for more details. 25 | * 26 | * The above copyright notice and this permission notice shall be 27 | * included in all copies or substantial portions of the Software. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 31 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 32 | */ 33 | 34 | using System; 35 | using System.Collections.Generic; 36 | 37 | namespace Zongsoft.Data 38 | { 39 | public interface IDataSearcherConditioner 40 | { 41 | ICondition Resolve(string method, string keyword, IDictionary states); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Data/IPageable.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2016-2019 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Data 30 | { 31 | /// 32 | /// 表示支持分页的接口。 33 | /// 34 | public interface IPageable : System.Collections.IEnumerable 35 | { 36 | /// 37 | /// 表示完成分页的事件。 38 | /// 39 | event EventHandler Paginated; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Data/Metadata/DataCommandType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * _____ ______ 3 | * /_ / ____ ____ ____ _________ / __/ /_ 4 | * / / / __ \/ __ \/ __ \/ ___/ __ \/ /_/ __/ 5 | * / /__/ /_/ / / / / /_/ /\_ \/ /_/ / __/ /_ 6 | * /____/\____/_/ /_/\__ /____/\____/_/ \__/ 7 | * /____/ 8 | * 9 | * Authors: 10 | * 钟峰(Popeye Zhong) 11 | * 12 | * Copyright (C) 2015-2019 Zongsoft Corporation 13 | * 14 | * This file is part of Zongsoft.CoreLibrary. 15 | * 16 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 17 | * modify it under the terms of the GNU Lesser General Public 18 | * License as published by the Free Software Foundation; either 19 | * version 2.1 of the License, or (at your option) any later version. 20 | * 21 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 | * Lesser General Public License for more details. 25 | * 26 | * The above copyright notice and this permission notice shall be 27 | * included in all copies or substantial portions of the Software. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 31 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 32 | */ 33 | 34 | using System; 35 | using System.Collections.Generic; 36 | 37 | namespace Zongsoft.Data.Metadata 38 | { 39 | public enum DataCommandType 40 | { 41 | Text, 42 | Procedure, 43 | View, 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Data/Metadata/IDataMetadataLoader.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * _____ ______ 3 | * /_ / ____ ____ ____ _________ / __/ /_ 4 | * / / / __ \/ __ \/ __ \/ ___/ __ \/ /_/ __/ 5 | * / /__/ /_/ / / / / /_/ /\_ \/ /_/ / __/ /_ 6 | * /____/\____/_/ /_/\__ /____/\____/_/ \__/ 7 | * /____/ 8 | * 9 | * Authors: 10 | * 钟峰(Popeye Zhong) 11 | * 12 | * Copyright (C) 2015-2019 Zongsoft Corporation 13 | * 14 | * This file is part of Zongsoft.CoreLibrary. 15 | * 16 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 17 | * modify it under the terms of the GNU Lesser General Public 18 | * License as published by the Free Software Foundation; either 19 | * version 2.1 of the License, or (at your option) any later version. 20 | * 21 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 | * Lesser General Public License for more details. 25 | * 26 | * The above copyright notice and this permission notice shall be 27 | * included in all copies or substantial portions of the Software. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 31 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 32 | */ 33 | 34 | using System; 35 | using System.Collections.Generic; 36 | 37 | namespace Zongsoft.Data.Metadata 38 | { 39 | public interface IDataMetadataLoader 40 | { 41 | IEnumerable Load(string name); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Diagnostics/Configuration/LoggerElement.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | using Zongsoft.Options; 31 | using Zongsoft.Options.Configuration; 32 | 33 | namespace Zongsoft.Diagnostics.Configuration 34 | { 35 | public class LoggerElement : OptionConfigurationElement 36 | { 37 | #region 公共属性 38 | [OptionConfigurationProperty("")] 39 | public LoggerHandlerElementCollection Handlers 40 | { 41 | get 42 | { 43 | return (LoggerHandlerElementCollection)this[""]; 44 | } 45 | } 46 | #endregion 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Diagnostics/ILogger.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Diagnostics 31 | { 32 | public interface ILogger 33 | { 34 | void Log(LogEntry entry); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Diagnostics/LogLevel.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | 30 | namespace Zongsoft.Diagnostics 31 | { 32 | /// 33 | /// 表示日志的级别。 34 | /// 35 | public enum LogLevel 36 | { 37 | /// 跟踪(1) 38 | Trace = 1, 39 | 40 | /// 调试(2) 41 | Debug, 42 | 43 | /// 信息(3) 44 | Info, 45 | 46 | /// 警告(4) 47 | Warn, 48 | 49 | /// 错误(5) 50 | Error, 51 | 52 | /// 崩溃(6) 53 | Fatal, 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Diagnostics/LoggerHandlerCollection.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Diagnostics 31 | { 32 | public class LoggerHandlerCollection : Zongsoft.Collections.NamedCollectionBase 33 | { 34 | #region 构造函数 35 | public LoggerHandlerCollection() : base(StringComparer.OrdinalIgnoreCase) 36 | { 37 | } 38 | #endregion 39 | 40 | #region 重写方法 41 | protected override string GetKeyForItem(LoggerHandler item) 42 | { 43 | return item.Name; 44 | } 45 | #endregion 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Diagnostics/TextFileLogger.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.IO; 29 | using System.Collections.Generic; 30 | 31 | namespace Zongsoft.Diagnostics 32 | { 33 | public class TextFileLogger : FileLogger 34 | { 35 | #region 重写方法 36 | protected override void WriteLog(LogEntry entry, Stream stream) 37 | { 38 | //注意:此处不能关闭stream参数传入的流,该流由基类确保安全释放! 39 | using(var writer = new StreamWriter(stream, System.Text.Encoding.UTF8, 1024 * 16, true)) 40 | { 41 | writer.WriteLine(entry.ToString()); 42 | } 43 | } 44 | #endregion 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Expressions/ITokenizer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.IO; 29 | 30 | namespace Zongsoft.Expressions 31 | { 32 | /// 33 | /// 表示分词器的接口。 34 | /// 35 | public interface ITokenizer 36 | { 37 | /// 38 | /// 分词操作,从指定的读取器中获取一个特定的词素结果。 39 | /// 40 | /// 指定的文本读取器。 41 | /// 返回的词素提取结果。 42 | TokenResult Tokenize(TextReader reader); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Expressions/SyntaxException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Expressions 30 | { 31 | public class SyntaxException : Exception 32 | { 33 | #region 构造函数 34 | public SyntaxException() 35 | { 36 | } 37 | 38 | public SyntaxException(string message) : base(message) 39 | { 40 | } 41 | 42 | public SyntaxException(string message, Exception innerException) : base(message, innerException) 43 | { 44 | } 45 | #endregion 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Expressions/TokenType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Expressions 30 | { 31 | /// 32 | /// 表示词素的类型。 33 | /// 34 | public enum TokenType 35 | { 36 | /// 常量(包括:字符串、数值、布尔值、空值(null)等) 37 | Constant, 38 | 39 | /// 标识(变量名、参数名、方法名、类名) 40 | Identifier, 41 | 42 | /// 符号 43 | Symbol, 44 | 45 | /// 关键字 46 | Keyword, 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Expressions/Tokenization/BooleanTokenizer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Expressions.Tokenization 30 | { 31 | public class BooleanTokenizer : LiteralTokenizerBase 32 | { 33 | #region 构造函数 34 | public BooleanTokenizer() : base(true, "true", "false") 35 | { 36 | } 37 | #endregion 38 | 39 | #region 重写方法 40 | protected override Token CreateToken(string literal) 41 | { 42 | return bool.Parse(literal) ? Token.True : Token.False; 43 | } 44 | #endregion 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Expressions/Tokenization/KeywordTokenizer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Expressions.Tokenization 30 | { 31 | public class KeywordTokenizer : LiteralTokenizerBase 32 | { 33 | #region 构造函数 34 | public KeywordTokenizer(params string[] keywords) : base(false, keywords) 35 | { 36 | } 37 | #endregion 38 | 39 | #region 重写方法 40 | protected override Token CreateToken(string literal) 41 | { 42 | return new Token(TokenType.Keyword, literal); 43 | } 44 | #endregion 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Expressions/Tokenization/NullTokenizer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Expressions.Tokenization 30 | { 31 | public class NullTokenizer : LiteralTokenizerBase 32 | { 33 | #region 构造函数 34 | public NullTokenizer() : base(true, "null") 35 | { 36 | } 37 | #endregion 38 | 39 | #region 重写方法 40 | protected override Token CreateToken(string literal) 41 | { 42 | return Token.Null; 43 | } 44 | #endregion 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Expressions/Tokenization/SymbolTokenizer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Expressions.Tokenization 30 | { 31 | public class SymbolTokenizer : LiteralTokenizerBase 32 | { 33 | #region 构造函数 34 | public SymbolTokenizer(params string[] symbols) : base(symbols) 35 | { 36 | if(symbols == null || symbols.Length == 0) 37 | base.Literals = SymbolToken.Symbols; 38 | } 39 | #endregion 40 | 41 | #region 重写方法 42 | protected override Token CreateToken(string literal) 43 | { 44 | return SymbolToken.GetToken(literal); 45 | } 46 | #endregion 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/IO/PathAnchor.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2016 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.IO 30 | { 31 | /// 32 | /// 表示关于路径的锚定点。 33 | /// 34 | public enum PathAnchor 35 | { 36 | /// 未锚定 37 | None, 38 | 39 | /// 基于当前位置 40 | Current, 41 | 42 | /// 基于上级节点 43 | Parent, 44 | 45 | /// 从根节点开始 46 | Root, 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/IO/PathException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Runtime.Serialization; 29 | 30 | namespace Zongsoft.IO 31 | { 32 | [Serializable] 33 | public class PathException : ApplicationException 34 | { 35 | #region 构造函数 36 | public PathException(string message) : base(message) 37 | { 38 | } 39 | 40 | public PathException(string message, Exception innerException) : base(message, innerException) 41 | { 42 | } 43 | 44 | protected PathException(SerializationInfo info, StreamingContext context) : base(info, context) 45 | { 46 | } 47 | #endregion 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Messaging/TopicSubscriptionFallbackBehavior.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015-2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Messaging 30 | { 31 | /// 32 | /// 表示主题回调失败重试策略的枚举。 33 | /// 34 | public enum TopicSubscriptionFallbackBehavior 35 | { 36 | /// 退避重试 37 | Backoff, 38 | 39 | /// 指数衰减 40 | ExponentialDecay, 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Options/Configuration/OptionConfigurationPropertyBehavior.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Options.Configuration 30 | { 31 | [Flags] 32 | public enum OptionConfigurationPropertyBehavior 33 | { 34 | None = 0, 35 | IsKey = 3, 36 | IsRequired = 1, 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Options/IOption.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zongsoft/Zongsoft.CoreLibrary/b34af1aa94061c00f3a4f6fdca5ddd581f69449c/src/Options/IOption.cs -------------------------------------------------------------------------------- /src/Options/IOptionLoader.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Options 31 | { 32 | public interface IOptionLoader 33 | { 34 | void Load(IOptionProvider provider); 35 | void Unload(IOptionProvider provider); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Options/IOptionLoaderSelector.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Options 31 | { 32 | public interface IOptionLoaderSelector 33 | { 34 | IOptionLoader GetLoader(IOptionProvider provider); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Options/IOptionProvider.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zongsoft/Zongsoft.CoreLibrary/b34af1aa94061c00f3a4f6fdca5ddd581f69449c/src/Options/IOptionProvider.cs -------------------------------------------------------------------------------- /src/Options/IOptionView.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zongsoft/Zongsoft.CoreLibrary/b34af1aa94061c00f3a4f6fdca5ddd581f69449c/src/Options/IOptionView.cs -------------------------------------------------------------------------------- /src/Options/IOptionViewBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2005-2010 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Options 30 | { 31 | public interface IOptionViewBuilder 32 | { 33 | bool IsValid(IOptionView view); 34 | IOptionView GetView(IOption option); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Options/Option.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zongsoft/Zongsoft.CoreLibrary/b34af1aa94061c00f3a4f6fdca5ddd581f69449c/src/Options/Option.cs -------------------------------------------------------------------------------- /src/Options/OptionLoaderAttribute.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Options 31 | { 32 | [AttributeUsage(AttributeTargets.Class, Inherited = true)] 33 | public class OptionLoaderAttribute : Attribute 34 | { 35 | #region 成员字段 36 | private Type _loaderType; 37 | #endregion 38 | 39 | #region 公共属性 40 | public Type LoaderType 41 | { 42 | get 43 | { 44 | return _loaderType; 45 | } 46 | set 47 | { 48 | _loaderType = value; 49 | } 50 | } 51 | #endregion 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Options/Profiles/Profile.ini: -------------------------------------------------------------------------------- 1 | #comment for the profile 2 | 3 | [Environment] 4 | ApplicationId=Zongsoft.CMS 5 | 6 | [Communication Net] 7 | TcpServer.Address=localhost 8 | TcpServer.Port=7969 9 | 10 | [Communication Net FtpServer Users] 11 | admin=password:{hashedPassword}; 12 | guest=password:{hashedPassword}; 13 | 14 | [Data Sotrages Tables] 15 | Customer 16 | Supplier 17 | Employee 18 | -------------------------------------------------------------------------------- /src/Options/Profiles/ProfileItemType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | 30 | namespace Zongsoft.Options.Profiles 31 | { 32 | public enum ProfileItemType 33 | { 34 | /// 设置条目。 35 | Entry, 36 | /// 设置段。 37 | Section, 38 | /// 注释行。 39 | Comment, 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("Zongsoft.CoreLibrary")] 6 | [assembly: AssemblyDescription("This is a kernel library about Zongsoft development framework.")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("Zongsoft Corporation")] 9 | [assembly: AssemblyProduct("Zongsoft Core Library")] 10 | [assembly: AssemblyCopyright("Copyright(C) Zongsoft Corporation 2010-2016. All rights reserved.")] 11 | [assembly: AssemblyTrademark("Zongsoft is registered trademarks of Zongsoft Corporation in the P.R.C. and/or other countries.")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | 15 | [assembly: AssemblyVersion("4.5.0.1702")] 16 | [assembly: AssemblyFileVersion("4.5.0.1702")] 17 | -------------------------------------------------------------------------------- /src/Reflection/Expressions/MemberExpressionType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2018 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Reflection.Expressions 30 | { 31 | /// 32 | /// 表示成员表达式类型的枚举。 33 | /// 34 | public enum MemberExpressionType 35 | { 36 | /// 常量表达式 37 | Constant, 38 | 39 | /// 标识表达式 40 | Identifier, 41 | 42 | /// 索引器表达式 43 | Indexer, 44 | 45 | /// 方法调用表达式 46 | Method, 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Reflection/MemberGettingResult.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2010-2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Reflection 30 | { 31 | public struct MemberGettingResult 32 | { 33 | public bool Cancel; 34 | public object Value; 35 | 36 | public MemberGettingResult(object value, bool cancel = false) 37 | { 38 | this.Value = value; 39 | this.Cancel = cancel; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Reflection/MemberKind.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2010-2018 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Reflection 30 | { 31 | /// 32 | /// 表示成员种类的枚举。 33 | /// 34 | [Flags] 35 | public enum MemberKind 36 | { 37 | /// 字段成员 38 | Field = 1, 39 | 40 | /// 属性成员 41 | Property = 2, 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Runtime/Caching/BufferManagerSelector.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.IO; 29 | 30 | namespace Zongsoft.Runtime.Caching 31 | { 32 | public class BufferManagerSelector : IBufferManagerSelector 33 | { 34 | public IBufferManager GetBufferManager(long size) 35 | { 36 | return BufferManager.Default; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Runtime/Caching/CacheChangedReason.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2013-2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | 30 | namespace Zongsoft.Runtime.Caching 31 | { 32 | /// 33 | /// 表示缓存项发生改变的原因。 34 | /// 35 | public enum CacheChangedReason 36 | { 37 | /// 系统内部原因。 38 | None, 39 | /// 被手动删除的。 40 | Removed, 41 | /// 被手动更新的。 42 | Updated, 43 | /// 因为过期被删除。 44 | Expired, 45 | /// 因为依赖被删除。 46 | Dependented, 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Runtime/Caching/CacheEntry.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2013-2016 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Runtime.Caching 30 | { 31 | public struct CacheEntry 32 | { 33 | public readonly TimeSpan? Expiry; 34 | public readonly object Value; 35 | 36 | public CacheEntry(object value, TimeSpan? expiry) 37 | { 38 | this.Value = value; 39 | this.Expiry = expiry; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Runtime/Caching/IBufferManagerSelector.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Runtime.Caching 30 | { 31 | /// 32 | /// 提供获取适合特定数据大小的缓存管理器。 33 | /// 34 | public interface IBufferManagerSelector 35 | { 36 | /// 37 | /// 根据指定待缓存的数据大小选取一个合适的缓存管理。 38 | /// 39 | /// 指定的待缓存的数据大小。 40 | /// 返回的缓存管理器。 41 | IBufferManager GetBufferManager(long size); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Runtime/Serialization/IDictionarySerializer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections; 29 | 30 | namespace Zongsoft.Runtime.Serialization 31 | { 32 | public interface IDictionarySerializer 33 | { 34 | IDictionary Serialize(object graph); 35 | void Serialize(object graph, IDictionary dictionary); 36 | 37 | object Deserialize(IDictionary dictionary, Type type); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Runtime/Serialization/ISerializable.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.IO; 29 | 30 | namespace Zongsoft.Runtime.Serialization 31 | { 32 | /// 33 | /// 标识实现者实现的特定序列化程序。 34 | /// 35 | public interface ISerializable 36 | { 37 | /// 38 | /// 将当前实现类序列化到指定的流。 39 | /// 40 | /// 序列化数据的流。此流可以引用多种后备存储区(如文件、网络、内存等)。 41 | void Serialize(Stream serializationStream); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Runtime/Serialization/SerializationBehavior.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | 30 | namespace Zongsoft.Runtime.Serialization 31 | { 32 | [Flags] 33 | public enum SerializationBehavior 34 | { 35 | None = 0, 36 | IgnoreNullValue = 1, 37 | IgnoreDefaultValue = 2, 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Runtime/Serialization/SerializationDirection.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | 30 | namespace Zongsoft.Runtime.Serialization 31 | { 32 | /// 33 | /// 表示序列化方向的枚举。 34 | /// 35 | public enum SerializationDirection 36 | { 37 | /// 未定义。 38 | None, 39 | 40 | /// 输入,即反序列化调用。 41 | Input, 42 | 43 | /// 输出,即序列化调用。 44 | Output, 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Runtime/Serialization/SerializationMemberBehavior.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | 30 | namespace Zongsoft.Runtime.Serialization 31 | { 32 | public enum SerializationMemberBehavior 33 | { 34 | /// 未定义,默认状态。 35 | None, 36 | 37 | /// 忽略序列化对应的成员。 38 | Ignored, 39 | 40 | /// 必须序列化对应的成员。 41 | Required, 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Runtime/Serialization/SerializationMembers.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | 30 | namespace Zongsoft.Runtime.Serialization 31 | { 32 | [Flags] 33 | public enum SerializationMembers 34 | { 35 | All = 3, 36 | Properties = 1, 37 | Fields = 2, 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Security/CensorshipException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Runtime.Serialization; 29 | 30 | namespace Zongsoft.Security 31 | { 32 | [Serializable] 33 | public class CensorshipException : ApplicationException 34 | { 35 | #region 构造函数 36 | public CensorshipException() 37 | { 38 | } 39 | 40 | public CensorshipException(string message) : this(message, null) 41 | { 42 | } 43 | 44 | public CensorshipException(string message, Exception innerException) : base(message, innerException) 45 | { 46 | } 47 | #endregion 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Security/ICensorship.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Security 31 | { 32 | /// 33 | /// 提供单词或词语审查功能的接口。 34 | /// 35 | public interface ICensorship 36 | { 37 | /// 38 | /// 判断指定的词汇是否为非法的。 39 | /// 40 | /// 指定要判断的单词或词语。 41 | /// 指定要判断的单词或词语所属的审查类别。 42 | /// 如果指定的单词或词语是非法的(敏感词)则返回真(True),否则返回假(False)。 43 | bool IsBlocked(string word, params string[] keys); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Security/Membership/MemberType.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zongsoft/Zongsoft.CoreLibrary/b34af1aa94061c00f3a4f6fdca5ddd581f69449c/src/Security/Membership/MemberType.cs -------------------------------------------------------------------------------- /src/Security/Membership/UserIdentityType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2003-2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | 30 | namespace Zongsoft.Security.Membership 31 | { 32 | public enum UserIdentityType 33 | { 34 | Name, 35 | Email, 36 | Phone, 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Security/Membership/UserStatus.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2003-2016 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | 30 | namespace Zongsoft.Security.Membership 31 | { 32 | /// 33 | /// 表示用户状态的枚举。 34 | /// 35 | public enum UserStatus : byte 36 | { 37 | /// 正常可用 38 | Active = 0, 39 | 40 | /// 待审核 41 | Unapproved, 42 | 43 | /// 已停用 44 | Disabled, 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Services/CommandExecutorExecutedEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2016 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Services 30 | { 31 | [Serializable] 32 | public class CommandExecutorExecutedEventArgs : CommandExecutorEventArgs 33 | { 34 | #region 构造函数 35 | public CommandExecutorExecutedEventArgs(CommandExecutorContext context) : base(context) 36 | { 37 | } 38 | #endregion 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Services/CommandOptionMissingException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2011-2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Services 30 | { 31 | public class CommandOptionMissingException : CommandOptionException 32 | { 33 | public CommandOptionMissingException(string optionName) 34 | : base(optionName, Resources.ResourceUtility.GetString("MissingCommandOption", optionName)) 35 | { 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Services/ICommandCompletion.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Services 30 | { 31 | /// 32 | /// 表示命令链执行完成的回调接口。 33 | /// 34 | public interface ICommandCompletion 35 | { 36 | void OnCompleted(CommandCompletionContext context); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Services/ICommandExpressionParser.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2011-2016 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Services 30 | { 31 | /// 32 | /// 提供命令行文本解析功能。 33 | /// 34 | public interface ICommandExpressionParser 35 | { 36 | /// 37 | /// 将指定的命令行文本解析成命令表达式对象。 38 | /// 39 | /// 指定的要解析的命令行文本。 40 | /// 返回解析的命令表达式对象,如果解析失败则返回空(null)。 41 | /// 无效的命令行文本。 42 | CommandExpression Parse(string text); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Services/ICommand`1.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Services 30 | { 31 | public interface ICommand : ICommand 32 | { 33 | bool CanExecute(TContext context); 34 | 35 | object Execute(TContext context); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Services/IPredication.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Services 30 | { 31 | /// 32 | /// 表示条件判断的接口。 33 | /// 34 | public interface IPredication 35 | { 36 | /// 37 | /// 确定指定对象是否符合某种条件。 38 | /// 39 | /// 指定的条件参数对象。 40 | /// 如果符合某种条件则返回真(true),否则返回假(false)。 41 | bool Predicate(object parameter); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Services/IPredication`1.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Services 30 | { 31 | public interface IPredication : IPredication 32 | { 33 | /// 34 | /// 确定指定对象是否符合某种条件。 35 | /// 36 | /// 指定的条件参数对象。 37 | /// 如果符合某种条件则返回真(true),否则返回假(false)。 38 | bool Predicate(T parameter); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Services/IServiceBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Services 31 | { 32 | public interface IServiceBuilder 33 | { 34 | object Build(ServiceEntry entry); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Services/IServiceLifetime.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Services 31 | { 32 | public interface IServiceLifetime 33 | { 34 | bool IsAlive(ServiceEntry entry); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Services/PredicationCombination.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Services 30 | { 31 | /// 32 | /// 表示断言的逻辑组合方式。 33 | /// 34 | public enum PredicationCombination 35 | { 36 | /// 表示如果某个断言返回成功,则不再执行后续断言测试而直接返回成功;如果返回失败,则进行后续断言测试。即整个断言链中所有断言测试均失败则断言链返回失败。 37 | Or, 38 | /// 表示如果某个断言返回成功,则进行下一个断言测试,如果返回失败,则不再执行后续断言测试而直接返回失败。即整个断言链中所有断言测试均成功则断言链返回成功。 39 | And, 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Services/ServiceProvider.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2010-2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Services 31 | { 32 | public class ServiceProvider : ServiceProviderBase 33 | { 34 | #region 构造函数 35 | public ServiceProvider(string name) : base(name) 36 | { 37 | this.Storage = new ServiceStorage(this); 38 | } 39 | 40 | public ServiceProvider(string name, IServiceStorage storage, IServiceBuilder builder = null) : base(name, storage, builder) 41 | { 42 | } 43 | #endregion 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/TaskUtility.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Threading.Tasks; 29 | 30 | namespace Zongsoft 31 | { 32 | internal static class TaskUtility 33 | { 34 | public static T ExecuteTask(Func> thunk) 35 | { 36 | return Task.Run(() => ExecuteTaskDelegate(() => thunk())).Result; 37 | } 38 | 39 | private static async Task ExecuteTaskDelegate(Func> thunk) 40 | { 41 | return await thunk(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Terminals/TerminalStyles.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2011-2013 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Text; 29 | 30 | namespace Zongsoft.Terminals 31 | { 32 | [Flags] 33 | public enum TerminalStyles 34 | { 35 | BackgroundColor = 1, 36 | ForegroundColor = 2, 37 | Color = 3, 38 | FontName = 4, 39 | FontStyle = 8, 40 | FontSize = 16, 41 | Font = 28, 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Text/ITemplateEvaluator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Text 31 | { 32 | public interface ITemplateEvaluator 33 | { 34 | string Scheme 35 | { 36 | get; 37 | } 38 | 39 | object Evaluate(TemplateEvaluatorContext context); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Text/ITextRegular.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Text 30 | { 31 | public interface ITextRegular : Zongsoft.Collections.IMatchable 32 | { 33 | bool IsMatch(string text, out string result); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Text/TextExpressionNodeCollection.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2013-2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Text 31 | { 32 | /// 33 | /// 表示表达式节点的集合类。 34 | /// 35 | [Obsolete()] 36 | public class TextExpressionNodeCollection : System.Collections.ObjectModel.Collection 37 | { 38 | /// 39 | /// 表示一个类型的空集合。 40 | /// 41 | public static readonly TextExpressionNodeCollection Empty = new TextExpressionNodeCollection(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Transactions/EnlistmentPhase.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | 30 | namespace Zongsoft.Transactions 31 | { 32 | /// 33 | /// 表示当前事务处理程序所处的阶段。 34 | /// 35 | public enum EnlistmentPhase 36 | { 37 | /// 准备阶段,表示当前事务被启动。 38 | Prepare, 39 | 40 | /// 提交阶段,表示事务被显式提交。 41 | Commit, 42 | 43 | /// 回滚阶段,表示事务被回滚。 44 | Rollback, 45 | 46 | /// 终止阶段,表示事务因为异常或者被手动终止。 47 | Abort, 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Transactions/IEnlistment.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2014 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Transactions 31 | { 32 | public interface IEnlistment 33 | { 34 | void OnEnlist(EnlistmentContext context); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Transactions/IsolationLevel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Zongsoft.Transactions 4 | { 5 | /// 6 | /// 表示事务的隔离级别。 7 | /// 8 | public enum IsolationLevel 9 | { 10 | /// 可以在事务期间读取和修改可变数据,可以进行脏读。 11 | ReadUncommitted = 0, 12 | 13 | /// 可以在事务期间读取可变数据,但是不可以修改它。在正在读取数据时保持共享锁,以避免脏读,但是在事务结束之前可以更改数据,从而导致不可重复的读取或幻像数据。 14 | ReadCommitted, 15 | 16 | /// 可以在事务期间读取可变数据,但是不可以修改。可以在事务期间添加新数据。防止不可重复的读取,但是仍可以有幻像数据。 17 | RepeatableRead, 18 | 19 | /// 可以在事务期间读取可变数据,但是不可以修改,也不可以添加任何新数据。 20 | Serializable, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Transactions/TransactionBehavior.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | 30 | namespace Zongsoft.Transactions 31 | { 32 | /// 33 | /// 表示事务的传播行为(范围)的枚举。 34 | /// 35 | public enum TransactionBehavior 36 | { 37 | Followed, 38 | Required, 39 | RequiresNew, 40 | Suppress, 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Transactions/TransactionStatus.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) 4 | * 5 | * Copyright (C) 2015 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | 30 | namespace Zongsoft.Transactions 31 | { 32 | /// 33 | /// 表示事务状态的枚举。 34 | /// 35 | public enum TransactionStatus 36 | { 37 | /// 事务活动中。 38 | Active, 39 | 40 | /// 事务已回滚。 41 | Aborted, 42 | 43 | /// 事务已提交。 44 | Committed, 45 | 46 | /// 事务的状态未知。 47 | Undetermined 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Transitions/IStateDiagram.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Transitions 31 | { 32 | public interface IStateDiagram 33 | { 34 | ICollection Triggers 35 | { 36 | get; 37 | } 38 | 39 | void Failed(StateContextBase context); 40 | 41 | bool CanVectoring(State origin, State destination); 42 | bool Transfer(StateContextBase context); 43 | 44 | State GetState(State state); 45 | bool SetState(State state, IDictionary parameters); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Transitions/IStateTransfer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Transitions 30 | { 31 | public interface IStateTransfer 32 | { 33 | bool Enabled 34 | { 35 | get; 36 | } 37 | 38 | bool CanTransfer(StateContextBase context); 39 | void Transfer(StateContextBase context); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Transitions/IStateTrigger.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | 29 | namespace Zongsoft.Transitions 30 | { 31 | public interface IStateTrigger 32 | { 33 | bool Enabled 34 | { 35 | get; 36 | } 37 | 38 | void OnTrigger(StateContextBase context); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Transitions/StateStepEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Zongsoft.Transitions 31 | { 32 | public class StateStepEventArgs : EventArgs 33 | { 34 | #region 成员字段 35 | private StateContextBase _context; 36 | #endregion 37 | 38 | #region 构造函数 39 | public StateStepEventArgs(StateContextBase context) 40 | { 41 | _context = context; 42 | } 43 | #endregion 44 | 45 | #region 公共属性 46 | public StateContextBase Context 47 | { 48 | get 49 | { 50 | return _context; 51 | } 52 | } 53 | #endregion 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Transitions/StateStopReason.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * 钟峰(Popeye Zhong) <9555843@qq.com> 4 | * 5 | * Copyright (C) 2017 Zongsoft Corporation 6 | * 7 | * This file is part of Zongsoft.CoreLibrary. 8 | * 9 | * Zongsoft.CoreLibrary is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * Zongsoft.CoreLibrary is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with Zongsoft.CoreLibrary; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | using System; 28 | using System.ComponentModel; 29 | 30 | namespace Zongsoft.Transitions 31 | { 32 | public enum StateStopReason : byte 33 | { 34 | /// 正常终止 35 | Normal, 36 | 37 | /// 手动终止 38 | Abortion, 39 | 40 | /// 超时终止 41 | Expired, 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Zongsoft.CoreLibrary.nuspec: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $id$ 5 | $version$ 6 | $title$ 7 | $author$ 8 | $author$ 9 | http://www.gnu.org/licenses/lgpl-2.1.html 10 | https://github.com/Zongsoft/Zongsoft.CoreLibrary 11 | https://avatars.githubusercontent.com/u/4804332 12 | true 13 | $description$ 14 | Zongsoft.CoreLibrary 类库提供了.NET开发的常用功能集以及一些相对于.NET BCL中进行了功能强化的实现。采用C#语言开发,支持跨平台。 15 | Zongsoft.CoreLibrary 类库提供了.NET开发的常用功能集以及一些相对于.NET BCL中进行了功能强化的实现。采用C#语言开发,支持跨平台。 16 | $copyright$ 17 | Zongsoft CoreLibrary 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Zongsoft.CoreLibrary.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zongsoft.CoreLibrary", "Zongsoft.CoreLibrary.csproj", "{D8BFAC6F-60BD-4A1A-BB4A-C1FE5043CDA8}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zongsoft.CoreLibrary.Tests", "..\tests\Zongsoft.CoreLibrary.Tests.csproj", "{AF95F5C7-B672-4A08-ABAB-6F677C9E5C58}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {D8BFAC6F-60BD-4A1A-BB4A-C1FE5043CDA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {D8BFAC6F-60BD-4A1A-BB4A-C1FE5043CDA8}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {D8BFAC6F-60BD-4A1A-BB4A-C1FE5043CDA8}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {AF95F5C7-B672-4A08-ABAB-6F677C9E5C58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {AF95F5C7-B672-4A08-ABAB-6F677C9E5C58}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {AF95F5C7-B672-4A08-ABAB-6F677C9E5C58}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {AF95F5C7-B672-4A08-ABAB-6F677C9E5C58}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /tests/Common/BufferTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | using Zongsoft.Common; 8 | 9 | using Xunit; 10 | 11 | namespace Zongsoft.Common.Tests 12 | { 13 | public class BufferTests 14 | { 15 | #region 成员字段 16 | private byte[] _data; 17 | #endregion 18 | 19 | public BufferTests() 20 | { 21 | this.Initialize(); 22 | } 23 | 24 | public void Initialize() 25 | { 26 | _data = new byte[10]; 27 | 28 | for(int i = 0; i < _data.Length; i++) 29 | { 30 | _data[i] = (byte)i; 31 | } 32 | } 33 | 34 | [Fact] 35 | public void CanReadTest() 36 | { 37 | var buffer = new Zongsoft.Common.Buffer(_data); 38 | 39 | Assert.True(buffer.CanRead()); 40 | 41 | Assert.Equal(_data.Length, buffer.Read(_data, 0, _data.Length)); 42 | Assert.Equal(_data.Length, buffer.Position); 43 | Assert.False(buffer.CanRead()); 44 | } 45 | 46 | [Fact] 47 | public void ReadTest() 48 | { 49 | var data = new byte[_data.Length]; 50 | var buffer = new Zongsoft.Common.Buffer(_data, 2); 51 | 52 | Assert.Equal(1, buffer.Read(data, 0, 1)); 53 | Assert.Equal(2, data[0]); 54 | Assert.Equal(7, buffer.Read(data, 0, data.Length)); 55 | 56 | using(var stream = new System.IO.MemoryStream(data)) 57 | { 58 | buffer = new Zongsoft.Common.Buffer(_data, 2); 59 | 60 | Assert.Equal(1, buffer.Read(stream, 1)); 61 | Assert.Equal(7, buffer.Read(stream, data.Length)); 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tests/Common/EnumUtilityTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Zongsoft.Common; 5 | using Zongsoft.Tests; 6 | 7 | using Xunit; 8 | 9 | namespace Zongsoft.Common.Tests 10 | { 11 | public class EnumUtilityTests 12 | { 13 | [Fact] 14 | public void GetEnumEntryTest() 15 | { 16 | var entry = EnumUtility.GetEnumEntry(Gender.Female); 17 | 18 | Assert.Equal("Female", entry.Name); 19 | Assert.Equal(Gender.Female, entry.Value); //注意:entry.Value 为枚举类型 20 | Assert.Equal("F", entry.Alias); 21 | Assert.Equal("女士", entry.Description); 22 | 23 | entry = EnumUtility.GetEnumEntry(Gender.Male, true); 24 | 25 | Assert.Equal("Male", entry.Name); 26 | Assert.Equal(0, entry.Value); //注意:entry.Value 为枚举项的基元类型 27 | Assert.Equal("M", entry.Alias); 28 | Assert.Equal("先生", entry.Description); 29 | } 30 | 31 | [Fact] 32 | public void GetEnumEntriesTest() 33 | { 34 | var entries = EnumUtility.GetEnumEntries(typeof(Gender), true); 35 | 36 | Assert.Equal(2, entries.Length); 37 | Assert.Equal("Male", entries[0].Name); 38 | Assert.Equal("Female", entries[1].Name); 39 | 40 | entries = EnumUtility.GetEnumEntries(typeof(Nullable), true, null, ""); 41 | 42 | Assert.Equal(3, entries.Length); 43 | Assert.Equal("", entries[0].Name); 44 | Assert.Equal(null, entries[0].Value); 45 | Assert.Equal("", entries[0].Description); 46 | 47 | Assert.Equal("Male", entries[1].Name); 48 | Assert.Equal("Female", entries[2].Name); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tests/Common/RandomGeneratorTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | using Xunit; 8 | 9 | namespace Zongsoft.Common.Tests 10 | { 11 | public class RandomGeneratorTests 12 | { 13 | [Fact] 14 | public void TestGenerateString() 15 | { 16 | var data = new string[100]; 17 | 18 | for(int i = 0; i < data.Length; i++) 19 | { 20 | for(int j = 1; j <= 128; j++) 21 | { 22 | data[i] = Zongsoft.Common.Randomizer.GenerateString(j); 23 | 24 | Assert.True(!string.IsNullOrEmpty(data[i]) && data[i].Length == j); 25 | } 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/Common/SequenceTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | using Xunit; 7 | 8 | namespace Zongsoft.Common.Tests 9 | { 10 | public class SequenceTests 11 | { 12 | const int ENTRY_COUNT = 100; 13 | const int CLICK_COUNT = 1000; 14 | 15 | [Fact] 16 | private void Test() 17 | { 18 | var sequence = new MySequence(); 19 | 20 | Parallel.For(0, ENTRY_COUNT, i => 21 | { 22 | var key = "Key-" + i.ToString(); 23 | 24 | Parallel.For(0, CLICK_COUNT, j => 25 | { 26 | sequence.Increment(key); 27 | }); 28 | }); 29 | 30 | for(int i = 0; i < ENTRY_COUNT; i++) 31 | { 32 | var key = "Key-" + i.ToString(); 33 | 34 | Assert.True(sequence.TryGetValue(key, out var value)); 35 | Assert.Equal(CLICK_COUNT, value); 36 | } 37 | } 38 | } 39 | 40 | public class MySequence : SequenceBase 41 | { 42 | private ConcurrentDictionary _cache = new ConcurrentDictionary(); 43 | 44 | protected override void OnReset(string key, int value) 45 | { 46 | _cache[key] = value; 47 | Thread.SpinWait(100); 48 | } 49 | 50 | protected override long OnReserve(string key, int count, int seed) 51 | { 52 | if(count == 0) 53 | { 54 | if(_cache.TryGetValue(key, out var value)) 55 | return value; 56 | else 57 | return seed; 58 | } 59 | 60 | return _cache.AddOrUpdate(key, seed + count, (_, x) => x + count); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /tests/Common/StringExtensionTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Xunit; 6 | 7 | namespace Zongsoft.Common.Tests 8 | { 9 | public class StringExtensionTests 10 | { 11 | [Fact] 12 | public void TestRemoveAny() 13 | { 14 | const string TEXT = @"Read^me??.txt"; 15 | 16 | Assert.Equal("Read^me.txt", StringExtension.RemoveAny(TEXT, '?')); 17 | Assert.Equal("Readme.txt", StringExtension.RemoveAny(TEXT, new[] { '?', '^' })); 18 | } 19 | 20 | [Fact] 21 | public void TestTrimString() 22 | { 23 | Assert.Equal("ContentSuffix", StringExtension.Trim("PrefixPrefixContentSuffix", "Prefix")); 24 | Assert.Equal("PrefixPrefixContent", StringExtension.Trim("PrefixPrefixContentSuffix", "Suffix")); 25 | Assert.Equal("Content", StringExtension.Trim("PrefixPrefixContentSuffix", "Prefix", "Suffix")); 26 | } 27 | 28 | [Fact] 29 | public void TestIsDigits() 30 | { 31 | string digits; 32 | 33 | Assert.True(StringExtension.IsDigits("123", out digits)); 34 | Assert.Equal("123", digits); 35 | 36 | Assert.True(StringExtension.IsDigits(" \t123 ", out digits)); 37 | Assert.Equal("123", digits); 38 | 39 | Assert.False(StringExtension.IsDigits("1 23")); 40 | Assert.False(StringExtension.IsDigits("1#23")); 41 | Assert.False(StringExtension.IsDigits("$123")); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/Data/ConditionalTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Xunit; 5 | 6 | namespace Zongsoft.Data 7 | { 8 | public class ConditionalTest 9 | { 10 | [Fact] 11 | public void Test() 12 | { 13 | var conditional = Model.Build(); 14 | 15 | Assert.Null(conditional.CorporationId); 16 | Assert.Null(conditional.DepartmentId); 17 | Assert.Null(conditional.Name); 18 | Assert.Null(conditional.CreatedTime); 19 | 20 | Assert.Null(conditional.ToCondition()); 21 | Assert.Null(conditional.ToConditions()); 22 | 23 | conditional.CorporationId = 0; 24 | conditional.DepartmentId = null; 25 | Assert.NotNull(conditional.CorporationId); 26 | Assert.Null(conditional.DepartmentId); 27 | Assert.Equal(0, conditional.CorporationId); 28 | 29 | conditional.CreatedTime = new Range(new DateTime(2010, 1, 1), null); 30 | Assert.NotNull(conditional.CreatedTime); 31 | Assert.Equal(new DateTime(2010, 1, 1), conditional.CreatedTime.Value.Minimum); 32 | 33 | var conditions = conditional.ToConditions(); 34 | Assert.NotNull(conditions); 35 | Assert.True(conditions.Count > 0); 36 | } 37 | 38 | public interface IDummyConditional : IModel 39 | { 40 | int? CorporationId 41 | { 42 | get; set; 43 | } 44 | 45 | short? DepartmentId 46 | { 47 | get; set; 48 | } 49 | 50 | [Conditional("Name", "PinYin")] 51 | string Name 52 | { 53 | get; set; 54 | } 55 | 56 | Range? CreatedTime 57 | { 58 | get; set; 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/Data/RangeTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Xunit; 5 | 6 | namespace Zongsoft.Data 7 | { 8 | public class RangeTest 9 | { 10 | [Fact] 11 | public void Test() 12 | { 13 | object min, max; 14 | 15 | var age = new Range(100, 18); 16 | var ageText = age.ToString(); 17 | 18 | var birthdate = new Range(new DateTime(1979, 6, 9), null); 19 | var birthdateText = birthdate.ToString(); 20 | 21 | var range = Range.Parse(ageText); 22 | Assert.NotNull(range); 23 | Assert.Equal(18, range.Minimum); 24 | Assert.Equal(100, range.Maximum); 25 | 26 | Assert.True(Range.TryGetRange(age, out min, out max)); 27 | Assert.Equal(18, (byte)min); 28 | Assert.Equal(100, (byte)max); 29 | 30 | Assert.True(Range.TryGetRange(birthdate, out min, out max)); 31 | Assert.Equal(new DateTime(1979, 6, 9), (DateTime)min); 32 | Assert.Null(max); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/Data/SortingTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Xunit; 4 | 5 | namespace Zongsoft.Data 6 | { 7 | public class SortingTest 8 | { 9 | [Fact] 10 | public void Test() 11 | { 12 | var sorting1 = Sorting.Ascending("Name"); 13 | 14 | Assert.Equal(SortingMode.Ascending, sorting1.Mode); 15 | Assert.Equal("Name", sorting1.Name); 16 | 17 | var sorting2 = Sorting.Descending("Name"); 18 | 19 | Assert.Equal(SortingMode.Descending, sorting2.Mode); 20 | Assert.Equal("Name", sorting2.Name); 21 | 22 | var sortings1 = sorting1 + sorting2; 23 | Assert.Equal(1, sortings1.Length); 24 | 25 | Assert.Equal(SortingMode.Descending, sortings1[0].Mode); 26 | Assert.Equal("Name", sortings1[0].Name); 27 | 28 | var sortings2 = sortings1 + Sorting.Ascending("PhoneNumber"); 29 | Assert.Equal(2, sortings2.Length); 30 | 31 | Assert.Equal(SortingMode.Ascending, sortings2[1].Mode); 32 | Assert.Equal("PhoneNumber", sortings2[1].Name); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("Zongsoft.CoreLibrary.Tests")] 6 | [assembly: AssemblyDescription("Zongsoft.CoreLibrary Tests")] 7 | [assembly: AssemblyCompany("Zongsoft")] 8 | [assembly: AssemblyProduct("Zongsoft.CoreLibrary.Tests")] 9 | [assembly: AssemblyCopyright("Copyright(C) Zongsoft Corporation 2015. All rights reserved.")] 10 | [assembly: AssemblyTrademark("Zongsoft is registered trademarks of Zongsoft Corporation in the P.R.C. and/or other countries.")] 11 | [assembly: AssemblyCulture("")] 12 | 13 | [assembly: ComVisible(false)] 14 | 15 | [assembly: AssemblyVersion("1.0.0.0")] 16 | [assembly: AssemblyFileVersion("1.0.0.0")] 17 | -------------------------------------------------------------------------------- /tests/PropertyToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Zongsoft.Tests 5 | { 6 | public struct PropertyToken 7 | { 8 | public PropertyToken(int ordinal, Func getter, Action setter) 9 | { 10 | this.Ordinal = ordinal; 11 | this.Getter = getter; 12 | this.Setter = setter; 13 | } 14 | 15 | public readonly int Ordinal; 16 | public readonly Func Getter; 17 | public readonly Action Setter; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/Runtime/Caching/MemoryCacheTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Xunit; 4 | 5 | namespace Zongsoft.Runtime.Caching.Tests 6 | { 7 | public class MemoryCacheTest 8 | { 9 | private MemoryCache _cache; 10 | 11 | public MemoryCacheTest() 12 | { 13 | _cache = MemoryCache.Default; 14 | } 15 | 16 | [Fact] 17 | public void RenameTest() 18 | { 19 | _cache.SetValue("Key1", "Value #1"); 20 | _cache.SetValue("Key2", "Value #2"); 21 | _cache.SetValue("Key3", "Value #3"); 22 | 23 | Assert.True(_cache.Exists("Key2")); 24 | Assert.False(_cache.Exists("KeyX")); 25 | 26 | _cache.Rename("Key2", "KeyX"); 27 | 28 | Assert.False(_cache.Exists("Key2")); 29 | Assert.True(_cache.Exists("KeyX")); 30 | } 31 | 32 | [Fact] 33 | public void ChangedEventTest() 34 | { 35 | _cache.Changed += Cache_Changed; 36 | 37 | _cache.SetValue("Key1", "Value #1", TimeSpan.FromSeconds(60)); 38 | _cache.SetValue("Key2", "Value #2"); 39 | _cache.SetValue("Key3", "Value #3"); 40 | 41 | Assert.Equal(3, _cache.Count); 42 | 43 | _cache.Remove("Key2"); 44 | 45 | Assert.Equal(2, _cache.Count); 46 | } 47 | 48 | private void Cache_Changed(object sender, CacheChangedEventArgs e) 49 | { 50 | switch(e.Reason) 51 | { 52 | case CacheChangedReason.Removed: 53 | Assert.Equal("Key2", e.OldKey); 54 | break; 55 | case CacheChangedReason.Expired: 56 | Assert.Equal("Key1", e.OldKey); 57 | break; 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /tests/Runtime/Serialization/DictionarySerializerTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | using Xunit; 8 | 9 | using Zongsoft.Tests; 10 | 11 | namespace Zongsoft.Runtime.Serialization.Tests 12 | { 13 | public class DictionarySerializerTest 14 | { 15 | #region 私有变量 16 | private Department _department; 17 | #endregion 18 | 19 | #region 构造函数 20 | public DictionarySerializerTest() 21 | { 22 | _department = new Department 23 | { 24 | CorporationId = 1, 25 | DepartmentId = 101, 26 | Name = "开发部", 27 | }; 28 | 29 | var employee = new Employee() 30 | { 31 | EmployeeId = 100, 32 | Name = "钟少", 33 | Gender = Gender.Male, 34 | Salary = 30000.5m, 35 | HomeAddress = new Address() 36 | { 37 | CountryId = 86, 38 | City = "武汉市", 39 | Detail = "光谷软件园", 40 | PostalCode = "123456", 41 | }, 42 | OfficeAddress = new Address 43 | { 44 | City = "Shenzhen", 45 | Detail = "Futian", 46 | }, 47 | Department = new Department 48 | { 49 | DepartmentId = 101, 50 | Name = "开发部", 51 | CorporationId = 1, 52 | }, 53 | }; 54 | 55 | _department.Employees.Add(employee); 56 | } 57 | #endregion 58 | 59 | [Fact] 60 | public void SerializeTest() 61 | { 62 | var dictionary = DictionarySerializer.Default.Serialize(_department); 63 | Assert.NotNull(dictionary); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | --------------------------------------------------------------------------------