├── netfusion
├── src
│ ├── Common
│ │ ├── NetFusion.Common.UnitTests
│ │ │ ├── Usings.cs
│ │ │ ├── Entity
│ │ │ │ └── DynamicEntity.cs
│ │ │ └── Extensions
│ │ │ │ ├── TypeExtensions.cs
│ │ │ │ ├── Collections
│ │ │ │ └── SetTests.cs
│ │ │ │ └── ObjectTests.cs
│ │ ├── NetFusion.Common.Base
│ │ │ ├── Validation
│ │ │ │ ├── ValidationTypes.cs
│ │ │ │ ├── IValidatableType.cs
│ │ │ │ ├── ValidationService.cs
│ │ │ │ └── IValidationService.cs
│ │ │ ├── Serialization
│ │ │ │ └── ICustomDeserialize.cs
│ │ │ ├── ContentTypes.cs
│ │ │ ├── Entity
│ │ │ │ ├── IEntityToken.cs
│ │ │ │ └── IAttributedEntity.cs
│ │ │ ├── Logging
│ │ │ │ ├── ITypeLog.cs
│ │ │ │ └── ILogLevelControl.cs
│ │ │ ├── NfExtensions.cs
│ │ │ └── Scripting
│ │ │ │ ├── ScriptPredicate.cs
│ │ │ │ ├── IEntityScriptMetaRepository.cs
│ │ │ │ └── NullEntityScriptingService.cs
│ │ └── NetFusion.Common
│ │ │ ├── Extensions
│ │ │ ├── Collections
│ │ │ │ └── DictionaryExtensions.cs
│ │ │ └── Reflection
│ │ │ │ └── ClassificationExtensions.cs
│ │ │ └── NetFusion.Common.csproj
│ ├── Messaging
│ │ ├── NetFusion.Messaging.UnitTests
│ │ │ ├── Usings.cs
│ │ │ ├── Queries
│ │ │ │ └── Mocks
│ │ │ │ │ └── Queries.cs
│ │ │ ├── Enrichers
│ │ │ │ └── Mocks
│ │ │ │ │ └── Enrichers.cs
│ │ │ ├── Commands
│ │ │ │ └── Mocks
│ │ │ │ │ └── Commands.cs
│ │ │ ├── Logging
│ │ │ │ └── Mocks
│ │ │ │ │ └── LoggingSinks.cs
│ │ │ ├── TestSetup.cs
│ │ │ ├── Messaging
│ │ │ │ ├── Logging
│ │ │ │ │ └── Mocks
│ │ │ │ │ │ └── LoggingSinks.cs
│ │ │ │ └── TestSetupExtensions.cs
│ │ │ └── DomainEvents
│ │ │ │ └── Mocks
│ │ │ │ └── DomainEvents.cs
│ │ ├── NetFusion.Messaging
│ │ │ ├── GlobalUsings.cs
│ │ │ ├── Filters
│ │ │ │ ├── IMessageFilter.cs
│ │ │ │ ├── IPreMessageFilter.cs
│ │ │ │ └── IPostMessageFilter.cs
│ │ │ ├── InProcessHandlerAttribute.cs
│ │ │ ├── IMessageConsumer.cs
│ │ │ ├── IncludeDerivedMessagesAttribute.cs
│ │ │ ├── Routing
│ │ │ │ ├── IRouteMeta.cs
│ │ │ │ └── ConsumerRoute.cs
│ │ │ ├── Logging
│ │ │ │ ├── IMessageLogSink.cs
│ │ │ │ ├── IMessageLogger.cs
│ │ │ │ └── MessageLogger.cs
│ │ │ ├── Enrichers
│ │ │ │ └── IMessageEnricher.cs
│ │ │ ├── Internal
│ │ │ │ ├── IBatchMessagePublisher.cs
│ │ │ │ └── IMessagePublisher.cs
│ │ │ ├── IntegrationTypes.cs
│ │ │ ├── IMessageDispatcherService.cs
│ │ │ └── Exceptions
│ │ │ │ ├── FilterException.cs
│ │ │ │ └── EnricherException.cs
│ │ └── NetFusion.Messaging.Types
│ │ │ ├── Contracts
│ │ │ ├── IDomainEvent.cs
│ │ │ ├── IEventSource.cs
│ │ │ ├── IQuery.cs
│ │ │ ├── IMessageWithResult.cs
│ │ │ └── ICommand.cs
│ │ │ ├── DomainEvent.cs
│ │ │ ├── QueryReadModel.cs
│ │ │ ├── NetFusion.Messaging.Types.csproj
│ │ │ └── MessageNamespaceAttribute.cs
│ ├── Integration
│ │ ├── NetFusion.Integration.UnitTests
│ │ │ ├── Usings.cs
│ │ │ ├── RabbitMQ
│ │ │ │ ├── RpcQueueUnitTests.cs
│ │ │ │ ├── EntitySettingsUnitTests.cs
│ │ │ │ └── Mocks
│ │ │ │ │ ├── TestRabbitEntityModule.cs
│ │ │ │ │ ├── TestRabbitBusModule.cs
│ │ │ │ │ └── TestMessageTypes.cs
│ │ │ └── Bus
│ │ │ │ └── Mocks
│ │ │ │ ├── TestCommand.cs
│ │ │ │ └── TestSerializationManager.cs
│ │ ├── NetFusion.Integration.RabbitMQ
│ │ │ ├── Plugin
│ │ │ │ ├── Configs
│ │ │ │ │ └── RabbitMqConfig.cs
│ │ │ │ ├── Settings
│ │ │ │ │ ├── PublishSettings.cs
│ │ │ │ │ └── HostSettings.cs
│ │ │ │ ├── IBusEntityModule.cs
│ │ │ │ └── IBusModule.cs
│ │ │ ├── Rpc
│ │ │ │ └── Metadata
│ │ │ │ │ ├── RpcQueueMeta.cs
│ │ │ │ │ └── RpcPublishOptions.cs
│ │ │ ├── Bus
│ │ │ │ └── PublishOptions.cs
│ │ │ ├── Internal
│ │ │ │ ├── ReconnectionEventArgs.cs
│ │ │ │ └── ConsumerErrorStrategy.cs
│ │ │ └── GlobalUsings.cs
│ │ ├── NetFusion.AMQP
│ │ │ ├── Publisher
│ │ │ │ ├── AmqpPropContext.cs
│ │ │ │ ├── Queue.cs
│ │ │ │ ├── IHostRegistry.cs
│ │ │ │ └── Internal
│ │ │ │ │ └── IPublisherModule.cs
│ │ │ ├── Subscriber
│ │ │ │ ├── HostAttribute.cs
│ │ │ │ ├── QueueAttribute.cs
│ │ │ │ └── Internal
│ │ │ │ │ └── HostItemAttribute.cs
│ │ │ ├── Settings
│ │ │ │ └── AmqpHostSettings.cs
│ │ │ └── NetFusion.AMQP.csproj
│ │ ├── NetFusion.Integration.ServiceBus
│ │ │ ├── Queues
│ │ │ │ └── Metadata
│ │ │ │ │ ├── QueuePublishOptions.cs
│ │ │ │ │ └── QueueRouteMeta.cs
│ │ │ ├── Rpc
│ │ │ │ └── Metadata
│ │ │ │ │ ├── RpcProcessingOptions.cs
│ │ │ │ │ ├── RpcPublishOptions.cs
│ │ │ │ │ └── RpcQueueMeta.cs
│ │ │ ├── Topics
│ │ │ │ └── Metadata
│ │ │ │ │ └── TopicPublishOptions.cs
│ │ │ ├── Plugin
│ │ │ │ ├── Configs
│ │ │ │ │ └── ServiceBusConfig.cs
│ │ │ │ ├── Settings
│ │ │ │ │ ├── RuleSettings.cs
│ │ │ │ │ ├── BusSettings.cs
│ │ │ │ │ └── TopicSettings.cs
│ │ │ │ ├── INamespaceModule.cs
│ │ │ │ ├── Modules
│ │ │ │ │ └── NamespaceEntityModule.cs
│ │ │ │ └── INamespaceEntityModule.cs
│ │ │ ├── GlobalUsings.cs
│ │ │ ├── Namespaces
│ │ │ │ └── MessageProperties.cs
│ │ │ └── IQueueResponseService.cs
│ │ ├── NetFusion.Integration.Redis
│ │ │ ├── Plugin
│ │ │ │ ├── IBusEntityModule.cs
│ │ │ │ ├── Modules
│ │ │ │ │ ├── ChannelEntityModule.cs
│ │ │ │ │ └── RedisModule.cs
│ │ │ │ └── Settings
│ │ │ │ │ ├── DbEndPoint.cs
│ │ │ │ │ └── RedisSettings.cs
│ │ │ ├── Internal
│ │ │ │ ├── ChannelEntityContext.cs
│ │ │ │ ├── CachedConnection.cs
│ │ │ │ └── RedisLogTextWriter.cs
│ │ │ ├── Subscriber
│ │ │ │ └── ChannelSubscriberEntity.cs
│ │ │ └── Publisher
│ │ │ │ └── ChannelPublisherEntity.cs
│ │ ├── NetFusion.Integration.Bus
│ │ │ ├── Strategies
│ │ │ │ ├── IBusEntityDisposeStrategy.cs
│ │ │ │ ├── IBusEntityCreationStrategy.cs
│ │ │ │ ├── IBusEntitySubscriptionStrategy.cs
│ │ │ │ ├── IBusEntityStrategy.cs
│ │ │ │ └── IBusEntityPublishStrategy.cs
│ │ │ ├── Rpc
│ │ │ │ └── RpcReplyException.cs
│ │ │ ├── IBusRouter.cs
│ │ │ ├── NetFusion.Integration.Bus.csproj
│ │ │ └── MessageExtensions.cs
│ │ └── IntegrationTests
│ │ │ └── RabbitMQ
│ │ │ ├── MockPublisherModule.cs
│ │ │ ├── MockBusModule.cs
│ │ │ └── MockSubscriberModule.cs
│ ├── Core
│ │ ├── NetFusion.Core.UnitTests
│ │ │ ├── Usings.cs
│ │ │ ├── Bootstrap
│ │ │ │ └── Mocks
│ │ │ │ │ ├── MockPluginConfigOne.cs
│ │ │ │ │ ├── MockPluginConfigTwo.cs
│ │ │ │ │ ├── ServiceRegistrationTests.cs
│ │ │ │ │ └── MockPluginModules.cs
│ │ │ ├── Health
│ │ │ │ └── Mocks
│ │ │ │ │ ├── HealthCheckModuleOne.cs
│ │ │ │ │ └── HealthCheckModuleTwo.cs
│ │ │ ├── Settings
│ │ │ │ ├── Mocks
│ │ │ │ │ └── MockSetttings.cs
│ │ │ │ └── Setup
│ │ │ │ │ └── TestSetup.cs
│ │ │ └── Properties
│ │ │ │ └── UrlFilterPropertyTests.cs
│ │ ├── NetFusion.Core.Bootstrap
│ │ │ ├── Plugins
│ │ │ │ ├── IPluginKnownType.cs
│ │ │ │ ├── IPluginConfig.cs
│ │ │ │ ├── IPluginModuleService.cs
│ │ │ │ ├── PluginSummary.cs
│ │ │ │ └── PluginTypes.cs
│ │ │ └── Health
│ │ │ │ ├── IModuleHealthCheckProvider.cs
│ │ │ │ └── HealthCheckResultType.cs
│ │ ├── NetFusion.Core.Settings
│ │ │ ├── IAppSettings.cs
│ │ │ ├── SettingsValidationException.cs
│ │ │ └── ConfigurationSectionAttribute.cs
│ │ └── NetFusion.Core.TestFixtures
│ │ │ ├── Plugins
│ │ │ ├── MockHostPlugin.cs
│ │ │ ├── MockCorePlugin.cs
│ │ │ └── MockAppPlugin.cs
│ │ │ └── NetFusion.Core.TestFixtures.csproj
│ ├── Web
│ │ ├── NetFusion.Web.UnitTests
│ │ │ ├── Rest
│ │ │ │ ├── ApiMetadata
│ │ │ │ │ ├── Server
│ │ │ │ │ │ ├── MetaBodyPost.cs
│ │ │ │ │ │ ├── ResponseModel.cs
│ │ │ │ │ │ ├── MetaResource.cs
│ │ │ │ │ │ ├── QueryParamSource.cs
│ │ │ │ │ │ ├── HeaderParamSource.cs
│ │ │ │ │ │ └── MetaResourceMap.cs
│ │ │ │ │ └── Setup
│ │ │ │ │ │ └── AssertExtensions.cs
│ │ │ │ ├── LinkGeneration
│ │ │ │ │ ├── Server
│ │ │ │ │ │ ├── StateEmbeddedModel.cs
│ │ │ │ │ │ └── StateModel.cs
│ │ │ │ │ └── Client
│ │ │ │ │ │ └── ClientModelStub.cs
│ │ │ │ ├── CodeGeneration
│ │ │ │ │ ├── Server
│ │ │ │ │ │ ├── ApiModelTwo.cs
│ │ │ │ │ │ └── ApiModelOne.cs
│ │ │ │ │ └── Setup
│ │ │ │ │ │ └── TestSetup.cs
│ │ │ │ ├── Resources
│ │ │ │ │ └── Models
│ │ │ │ │ │ ├── ReminderModel.cs
│ │ │ │ │ │ ├── PaymentModel.cs
│ │ │ │ │ │ └── AccountModel.cs
│ │ │ │ ├── ClientRequests
│ │ │ │ │ ├── Server
│ │ │ │ │ │ ├── CustomerModel.cs
│ │ │ │ │ │ ├── AddressModel.cs
│ │ │ │ │ │ ├── CustomerResourceMap.cs
│ │ │ │ │ │ └── ErrorController.cs
│ │ │ │ │ └── Client
│ │ │ │ │ │ ├── CustomerModel.cs
│ │ │ │ │ │ └── AddressModel.cs
│ │ │ │ ├── DocGeneration
│ │ │ │ │ ├── Setup
│ │ │ │ │ │ ├── PluginSetup.cs
│ │ │ │ │ │ └── XmlCommentsSetup.cs
│ │ │ │ │ └── Server
│ │ │ │ │ │ ├── TestRequestModels.cs
│ │ │ │ │ │ ├── DocResourceMap.cs
│ │ │ │ │ │ └── TestResponseModels.cs
│ │ │ │ └── Setup
│ │ │ │ │ ├── NullUnitTestService.cs
│ │ │ │ │ └── MockUnitTestService.cs
│ │ │ ├── Mocks
│ │ │ │ └── IMockedService.cs
│ │ │ └── HalComments.json
│ │ ├── NetFusion.Web.Rest.Resources
│ │ │ ├── IResource.cs
│ │ │ ├── EntryPointModel.cs
│ │ │ ├── ResourceAttribute.cs
│ │ │ ├── NetFusion.Web.Rest.Resources.csproj
│ │ │ └── ResourceExtensions.cs
│ │ ├── NetFusion.Web.Rest.Docs
│ │ │ ├── Core
│ │ │ │ ├── Descriptions
│ │ │ │ │ ├── IDocDescription.cs
│ │ │ │ │ ├── IEmbeddedDescription.cs
│ │ │ │ │ ├── IActionDescription.cs
│ │ │ │ │ ├── IResponseDescription.cs
│ │ │ │ │ ├── IRelationDescription.cs
│ │ │ │ │ └── IParameterDescription.cs
│ │ │ │ ├── ITypeCommentService.cs
│ │ │ │ └── IDocBuilder.cs
│ │ │ ├── Entities
│ │ │ │ ├── HalComments.cs
│ │ │ │ ├── RelationComment.cs
│ │ │ │ └── EmbeddedComment.cs
│ │ │ ├── Models
│ │ │ │ ├── ApiResponseDoc.cs
│ │ │ │ ├── ApiRelationDoc.cs
│ │ │ │ ├── ApiEmbeddedDoc.cs
│ │ │ │ ├── ApiPropertyDoc.cs
│ │ │ │ └── ApiParameterDoc.cs
│ │ │ ├── Plugin
│ │ │ │ ├── IDocModule.cs
│ │ │ │ └── RestDocExtensions.cs
│ │ │ └── Xml
│ │ │ │ └── Descriptions
│ │ │ │ ├── XmlActionComments.cs
│ │ │ │ └── XmlParameterComments.cs
│ │ ├── NetFusion.Web.Common
│ │ │ ├── HttpHeaderNames.cs
│ │ │ ├── InternetMediaTypes.cs
│ │ │ └── NetFusion.Web.Common.csproj
│ │ ├── NetFusion.Web.Rest.CodeGen
│ │ │ ├── Plugin
│ │ │ │ ├── ICodeGenModule.cs
│ │ │ │ └── RestCodeGenExtensions.cs
│ │ │ └── IApiCodeGenService.cs
│ │ ├── NetFusion.Web.Rest.Server
│ │ │ ├── Mappings
│ │ │ │ └── IResourceProvider.cs
│ │ │ ├── Linking
│ │ │ │ ├── TemplateUrlLink.cs
│ │ │ │ ├── ResourceLink.cs
│ │ │ │ └── ControllerExtensions.cs
│ │ │ ├── Plugin
│ │ │ │ └── Modules
│ │ │ │ │ └── ConcurrencyModule.cs
│ │ │ ├── Hal
│ │ │ │ ├── Core
│ │ │ │ │ └── HalResourceMeta.cs
│ │ │ │ └── IHalEmbeddedResourceContext.cs
│ │ │ └── Meta
│ │ │ │ └── IResourceMeta.cs
│ │ ├── NetFusion.Web.Rest.Client
│ │ │ ├── IRestClientFactory.cs
│ │ │ ├── IRestClientService.cs
│ │ │ ├── Core
│ │ │ │ └── RestClientService.cs
│ │ │ └── Settings
│ │ │ │ └── IRequestSettings.cs
│ │ └── NetFusion.Web
│ │ │ ├── Plugin
│ │ │ ├── Modules
│ │ │ │ └── ApiMetadataModule.cs
│ │ │ └── WebMvcPlugin.cs
│ │ │ ├── Metadata
│ │ │ └── ApiResponseMeta.cs
│ │ │ ├── Extensions
│ │ │ └── HttpContextExtensions.cs
│ │ │ └── NetFusion.Web.csproj
│ └── Services
│ │ ├── NetFusion.Services.UnitTests
│ │ ├── Mapping
│ │ │ ├── Entities
│ │ │ │ ├── Summary.cs
│ │ │ │ ├── TestMapTypeOne.cs
│ │ │ │ ├── CarSummary.cs
│ │ │ │ ├── CustomerSummary.cs
│ │ │ │ ├── TestMapTypeTwo.cs
│ │ │ │ ├── TestMapTypeThree.cs
│ │ │ │ ├── Customer.cs
│ │ │ │ └── Car.cs
│ │ │ └── Strategies
│ │ │ │ ├── TestMapStrategyTwoToOne.cs
│ │ │ │ ├── TestMapStrategyOneToThree.cs
│ │ │ │ ├── TestMappingStrategyFactory.cs
│ │ │ │ ├── TestMapStrategyOneToTwo.cs
│ │ │ │ ├── TestMapStrategyThreeToTwo.cs
│ │ │ │ └── TestDerivedStrategyFactory.cs
│ │ ├── Usings.cs
│ │ └── Roslyn
│ │ │ └── DynamicEntity.cs
│ │ ├── NetFusion.Services.Mapping
│ │ ├── MappingException.cs
│ │ ├── Plugin
│ │ │ └── IMappingModule.cs
│ │ ├── IMappingStrategyFactory.cs
│ │ └── NetFusion.Services.Mapping.csproj
│ │ ├── NetFusion.Services.Serialization
│ │ ├── SerializationException.cs
│ │ ├── JsonMessageSerializer.cs
│ │ └── NetFusion.Services.Serialization.csproj
│ │ ├── NetFusion.Services.Messaging
│ │ ├── Enrichers
│ │ │ ├── DateOccurredEnricher.cs
│ │ │ ├── HostEnricher.cs
│ │ │ └── CorrelationEnricher.cs
│ │ └── NetFusion.Services.Messaging.csproj
│ │ ├── NetFusion.Services.Roslyn
│ │ └── Internal
│ │ │ └── ExpressionEvaluator.cs
│ │ └── NetFusion.Services.Serilog
│ │ ├── ServiceCollectionExtensions.cs
│ │ └── EnricherExtensions.cs
├── build
│ ├── netfusion.png
│ ├── credits.md
│ └── common.props
├── NetFusion.sln.DotSettings
└── .editorconfig
├── img
├── RefArch.png
├── netfusionlogo.png
├── project_logo.jpg
├── NetFusionLog-0.PNG
├── NetFusionLog-1.PNG
├── NetFusionLog-2.PNG
├── lightbulb-icon.png
├── Nuget-NetFusion.MongoDB.png
├── Nuget-NetFusion.WebApi.png
├── Nuget-netFusion.Common.png
├── Nuget-NetFusion.Bootstrap.png
├── Nuget-NetFusion.Messaging.png
├── Nuget-NetFusion.RabbitMQ.png
├── Nuget-NetFusion.Settings.png
├── Nuget-NetFusion.Integration.png
├── Nuget-NetFusion.EntityFramework.png
├── Nuget-NetFusion.Logging.Serilog.png
└── Nuget-NetFusion.Settings.MongoDB.png
├── .github
└── workflows
│ └── branches-build.yml
└── LICENSE
/netfusion/src/Common/NetFusion.Common.UnitTests/Usings.cs:
--------------------------------------------------------------------------------
1 | global using Xunit;
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging.UnitTests/Usings.cs:
--------------------------------------------------------------------------------
1 | global using Xunit;
--------------------------------------------------------------------------------
/img/RefArch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/RefArch.png
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.UnitTests/Usings.cs:
--------------------------------------------------------------------------------
1 | global using Xunit;
--------------------------------------------------------------------------------
/img/netfusionlogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/netfusionlogo.png
--------------------------------------------------------------------------------
/img/project_logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/project_logo.jpg
--------------------------------------------------------------------------------
/img/NetFusionLog-0.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/NetFusionLog-0.PNG
--------------------------------------------------------------------------------
/img/NetFusionLog-1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/NetFusionLog-1.PNG
--------------------------------------------------------------------------------
/img/NetFusionLog-2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/NetFusionLog-2.PNG
--------------------------------------------------------------------------------
/img/lightbulb-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/lightbulb-icon.png
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.UnitTests/Usings.cs:
--------------------------------------------------------------------------------
1 | global using Xunit;
2 | global using FluentAssertions;
--------------------------------------------------------------------------------
/netfusion/build/netfusion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/netfusion/build/netfusion.png
--------------------------------------------------------------------------------
/img/Nuget-NetFusion.MongoDB.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/Nuget-NetFusion.MongoDB.png
--------------------------------------------------------------------------------
/img/Nuget-NetFusion.WebApi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/Nuget-NetFusion.WebApi.png
--------------------------------------------------------------------------------
/img/Nuget-netFusion.Common.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/Nuget-netFusion.Common.png
--------------------------------------------------------------------------------
/img/Nuget-NetFusion.Bootstrap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/Nuget-NetFusion.Bootstrap.png
--------------------------------------------------------------------------------
/img/Nuget-NetFusion.Messaging.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/Nuget-NetFusion.Messaging.png
--------------------------------------------------------------------------------
/img/Nuget-NetFusion.RabbitMQ.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/Nuget-NetFusion.RabbitMQ.png
--------------------------------------------------------------------------------
/img/Nuget-NetFusion.Settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/Nuget-NetFusion.Settings.png
--------------------------------------------------------------------------------
/img/Nuget-NetFusion.Integration.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/Nuget-NetFusion.Integration.png
--------------------------------------------------------------------------------
/img/Nuget-NetFusion.EntityFramework.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/Nuget-NetFusion.EntityFramework.png
--------------------------------------------------------------------------------
/img/Nuget-NetFusion.Logging.Serilog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/Nuget-NetFusion.Logging.Serilog.png
--------------------------------------------------------------------------------
/img/Nuget-NetFusion.Settings.MongoDB.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grecosoft/NetFusion/HEAD/img/Nuget-NetFusion.Settings.MongoDB.png
--------------------------------------------------------------------------------
/netfusion/build/credits.md:
--------------------------------------------------------------------------------
1 | Addon icons created by Freepik - Flaticon
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/ApiMetadata/Server/MetaBodyPost.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.UnitTests.Rest.ApiMetadata.Server;
2 |
3 | public class MetaBodyPost;
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/ApiMetadata/Server/ResponseModel.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.UnitTests.Rest.ApiMetadata.Server;
2 |
3 | public class ResponseModel;
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.UnitTests/RabbitMQ/RpcQueueUnitTests.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Integration.UnitTests.RabbitMQ;
2 |
3 | public class RpcQueueUnitTests;
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.UnitTests/RabbitMQ/EntitySettingsUnitTests.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Integration.UnitTests.RabbitMQ;
2 |
3 | public class EntitySettingsUnitTests;
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/ApiMetadata/Server/MetaResource.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.UnitTests.Rest.ApiMetadata.Server;
2 |
3 | public class MetaResource
4 | {
5 | public int Id { get; set; }
6 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Common Bootstrap namespaces:
2 |
3 | // Common Messaging namespaces:
4 | global using NetFusion.Messaging.Internal;
5 | global using NetFusion.Messaging.Types.Contracts;
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Mapping/Entities/Summary.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Services.UnitTests.Mapping.Entities;
2 |
3 | public abstract class Summary
4 | {
5 | public string? Description { get; set; }
6 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Resources/IResource.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.Rest.Resources;
2 |
3 | ///
4 | /// Marker interface used to identity types of resources.
5 | ///
6 | public interface IResource;
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/LinkGeneration/Server/StateEmbeddedModel.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.UnitTests.Rest.LinkGeneration.Server;
2 |
3 | public class StateEmbeddedModel
4 | {
5 | public int Id { get; set; }
6 | }
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Mapping/Entities/TestMapTypeOne.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Services.UnitTests.Mapping.Entities;
2 |
3 | public class TestMapTypeOne
4 | {
5 | public int[] Values { get; set; } = Array.Empty();
6 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.RabbitMQ/Plugin/Configs/RabbitMqConfig.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Integration.RabbitMQ.Plugin.Configs;
2 |
3 | public class RabbitMqConfig : IPluginConfig
4 | {
5 | public bool IsAutoCreateEnabled { get; set; }
6 | }
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Mapping/Entities/CarSummary.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Services.UnitTests.Mapping.Entities;
2 |
3 | public class CarSummary : Summary
4 | {
5 | public string? Make { get; set; }
6 | public string? Model { get; set; }
7 | }
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.Mapping/MappingException.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Common.Base.Exceptions;
2 |
3 | namespace NetFusion.Services.Mapping;
4 |
5 | public class MappingException(string message, string? exceptionId = null) : NetFusionException(message, exceptionId);
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Mapping/Entities/CustomerSummary.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Services.UnitTests.Mapping.Entities;
2 |
3 | public class CustomerSummary : Summary
4 | {
5 | public string? FirstName { get; set; }
6 | public string? LastName { get; set; }
7 | }
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.UnitTests/Bootstrap/Mocks/MockPluginConfigOne.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Core.Bootstrap.Plugins;
2 |
3 | namespace NetFusion.Core.UnitTests.Bootstrap.Mocks;
4 |
5 | public class MockPluginConfigOne : IPluginConfig
6 | {
7 | public string ConfigValue { get; set; }
8 | }
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.UnitTests/Bootstrap/Mocks/MockPluginConfigTwo.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Core.Bootstrap.Plugins;
2 |
3 | namespace NetFusion.Core.UnitTests.Bootstrap.Mocks;
4 |
5 | public class MockPluginConfigTwo : IPluginConfig
6 | {
7 | public string ConfigValue { get; set; }
8 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging/Filters/IMessageFilter.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging.Filters;
2 |
3 | ///
4 | /// Common marker interface representing a class that is invoked
5 | /// during the dispatching of a messing.
6 | ///
7 | public interface IMessageFilter;
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Mapping/Entities/TestMapTypeTwo.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Services.UnitTests.Mapping.Entities;
2 |
3 | public class TestMapTypeTwo
4 | {
5 | public int Sum { get; set; }
6 | public int Max { get; set; }
7 | public int Min { get; set; }
8 | }
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Mapping/Entities/TestMapTypeThree.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Services.UnitTests.Mapping.Entities;
2 |
3 | public class TestMapTypeThree
4 | {
5 | public int MaxAllowedValue { get; set; }
6 | public int[] Values { get; set; } = Array.Empty();
7 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.RabbitMQ/Rpc/Metadata/RpcQueueMeta.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Integration.RabbitMQ.Rpc.Metadata;
2 |
3 | public class RpcQueueMeta(string queueName)
4 | {
5 | public string QueueName { get; } = queueName;
6 | public ushort PrefetchCount { get; set; } = 10;
7 | }
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.Serialization/SerializationException.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Common.Base.Exceptions;
2 |
3 | namespace NetFusion.Services.Serialization;
4 |
5 | public class SerializationException(string message, string? exceptionId = null)
6 | : NetFusionException(message, exceptionId);
--------------------------------------------------------------------------------
/netfusion/src/Common/NetFusion.Common.Base/Validation/ValidationTypes.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Common.Base.Validation;
2 |
3 | ///
4 | /// Possible validation levels.
5 | ///
6 | public enum ValidationTypes
7 | {
8 | Valid = 0,
9 | Info = 1,
10 | Warning = 2,
11 | Error = 3
12 | }
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Usings.cs:
--------------------------------------------------------------------------------
1 | global using FluentAssertions;
2 | global using NetFusion.Core.TestFixtures.Container;
3 | global using NetFusion.Core.TestFixtures.Extensions;
4 | global using NetFusion.Core.TestFixtures.Plugins;
5 | global using Xunit;
6 | global using NetFusion.Messaging.Types;
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.Bootstrap/Plugins/IPluginKnownType.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Core.Bootstrap.Plugins;
2 |
3 | ///
4 | /// A marker interface used to identify types within a plugin that
5 | /// can be implemented by concrete types within other plugins.
6 | ///
7 | public interface IPluginKnownType;
--------------------------------------------------------------------------------
/netfusion/src/Common/NetFusion.Common.Base/Serialization/ICustomDeserialize.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Common.Base.Serialization;
2 |
3 | ///
4 | /// Interface implemented by message to provide custom deserialization.
5 | ///
6 | public interface ICustomDeserialize
7 | {
8 | void Deserialize(byte[] value);
9 | }
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.Bootstrap/Plugins/IPluginConfig.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Core.Bootstrap.Plugins;
2 |
3 | ///
4 | /// Allows plug-ins to define specific configurations that can be initialized by the host
5 | /// application to alter the behavior of the plugin.
6 | ///
7 | public interface IPluginConfig;
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/CodeGeneration/Server/ApiModelTwo.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Rest.Resources;
2 |
3 | namespace NetFusion.Web.UnitTests.Rest.CodeGeneration.Server;
4 |
5 | ///
6 | /// Example model for which code will be generated.
7 | ///
8 | [Resource("ResourceTwo")]
9 | public class ApiModelTwo;
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.AMQP/Publisher/AmqpPropContext.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.AMQP.Publisher
2 | {
3 | ///
4 | /// Marker class used to associate scope with message attributes
5 | /// set and used by this plugin.
6 | ///
7 | public class AmqpPropContext
8 | {
9 |
10 | }
11 | }
--------------------------------------------------------------------------------
/netfusion/src/Common/NetFusion.Common.Base/ContentTypes.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Common.Base;
2 |
3 | ///
4 | /// Common serialization type MIME values.
5 | ///
6 | public static class ContentTypes
7 | {
8 | public const string Json = "application/json";
9 | public const string MessagePack = "application/x-msgpack";
10 | }
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.Settings/IAppSettings.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Core.Settings;
2 |
3 | ///
4 | /// Interface representing a class containing application settings. An instance of
5 | /// the implementing class is created and initialized when injected into a dependent
6 | /// component.
7 | ///
8 | public interface IAppSettings;
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Mapping/Entities/Customer.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Services.UnitTests.Mapping.Entities;
2 |
3 | public class Customer(string firstName, string lastName, int age)
4 | {
5 | public string FirstName { get; } = firstName;
6 | public string LastName { get; } = lastName;
7 | public int Age { get; } = age;
8 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.UnitTests/Bus/Mocks/TestCommand.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Messaging.Types;
2 |
3 | namespace NetFusion.Integration.UnitTests.Bus.Mocks;
4 |
5 | public class TestCommand : Command;
6 |
7 | public class TestCommandConsumer
8 | {
9 | public void OnCommand(TestCommand command)
10 | {
11 |
12 | }
13 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.RabbitMQ/Plugin/Settings/PublishSettings.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Integration.RabbitMQ.Plugin.Settings;
2 |
3 | public class PublishSettings
4 | {
5 | public string? ContentType { get; set; }
6 | public byte? Priority { get; set; }
7 | public bool? IsPersistent { get; set; }
8 | public bool? IsMandatory { get; set; }
9 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/ApiMetadata/Server/QueryParamSource.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc;
2 |
3 | namespace NetFusion.Web.UnitTests.Rest.ApiMetadata.Server;
4 |
5 | public class QueryParamSource
6 | {
7 | [FromQuery]
8 | public string Filter { get; set; }
9 |
10 | [FromQuery]
11 | public string Version { get; set; }
12 | }
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Mapping/Entities/Car.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Services.UnitTests.Mapping.Entities;
2 |
3 | public class Car(string make, string model, string color, int year)
4 | {
5 | public string Make { get; } = make;
6 | public string Model { get; } = model;
7 | public string Color { get; } = color;
8 | public int Year { get; set; } = year;
9 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.RabbitMQ/Plugin/IBusEntityModule.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics.CodeAnalysis;
2 | using NetFusion.Integration.Bus.Entities;
3 |
4 | namespace NetFusion.Integration.RabbitMQ.Plugin;
5 |
6 | public interface IBusEntityModule : IPluginModuleService
7 | {
8 | bool TryGetPublishEntityForMessage(Type messageType, [NotNullWhen(true)] out BusEntity? entity);
9 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging.UnitTests/Queries/Mocks/Queries.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Messaging.Types;
2 |
3 | namespace NetFusion.Messaging.UnitTests.Queries.Mocks;
4 |
5 | public class MockQuery : Query
6 | {
7 | public List QueryAsserts { get; } = [];
8 | public List ThrowInHandlers { get; } = [];
9 | }
10 |
11 | public class MockQueryResult;
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/Resources/Models/ReminderModel.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Rest.Resources;
2 |
3 | namespace NetFusion.Web.UnitTests.Rest.Resources.Models;
4 |
5 | ///
6 | /// Represents a model returned from a REST Api.
7 | ///
8 | [Resource("ReminderResource")]
9 | public class ReminderModel
10 | {
11 | public string Message { get; set; }
12 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging/InProcessHandlerAttribute.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging
2 | {
3 | ///
4 | /// Used to specify that a consumer's message handler method should be
5 | /// invoked by the InProcessMessagePublisher.
6 | ///
7 | [AttributeUsage(AttributeTargets.Method)]
8 | public class InProcessHandlerAttribute : Attribute;
9 | }
10 |
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/ApiMetadata/Server/HeaderParamSource.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.AspNetCore.Mvc;
3 |
4 | namespace NetFusion.Web.UnitTests.Rest.ApiMetadata.Server;
5 |
6 | public class HeaderParamSource
7 | {
8 | [FromHeader]
9 | public string ClientId { get; set; }
10 |
11 | [FromHeader]
12 | public DateTime AsOfDate { get; set; }
13 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/CodeGeneration/Server/ApiModelOne.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Rest.Resources;
2 |
3 | namespace NetFusion.Web.UnitTests.Rest.CodeGeneration.Server;
4 |
5 | ///
6 | /// Example model for which code will be generated.
7 | ///
8 | [Resource("ResourceOne")]
9 | public class ApiModelOne
10 | {
11 | public string ModelOneProp { get; set; }
12 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.ServiceBus/Queues/Metadata/QueuePublishOptions.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Common.Base;
2 |
3 | namespace NetFusion.Integration.ServiceBus.Queues.Metadata;
4 |
5 | ///
6 | /// Options used when a command is published to the queue.
7 | ///
8 | public class QueuePublishOptions
9 | {
10 | public string ContentType { get; set; } = ContentTypes.Json;
11 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/LinkGeneration/Client/ClientModelStub.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.UnitTests.Rest.LinkGeneration.Client;
2 |
3 | ///
4 | /// A model used on the client-side of the tests into which responses
5 | /// are deserialized. When testing links, we only care about the links
6 | /// on the associated resource containing the model.
7 | ///
8 | public class ClientModelStub;
--------------------------------------------------------------------------------
/netfusion/src/Common/NetFusion.Common.Base/Entity/IEntityToken.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Common.Base.Entity;
2 |
3 | ///
4 | /// Interface implemented to indicate optimistic concurrency check
5 | /// is required upon update.
6 | ///
7 | public interface IEntityToken
8 | {
9 | ///
10 | /// The token associated with the current state.
11 | ///
12 | string? Token { get; }
13 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.RabbitMQ/Rpc/Metadata/RpcPublishOptions.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Common.Base;
2 |
3 | namespace NetFusion.Integration.RabbitMQ.Rpc.Metadata;
4 |
5 | public class RpcPublishOptions
6 | {
7 | public int CancelRpcRequestAfterMs { get; set; } = 5_000;
8 | public string ContentType { get; set; } = ContentTypes.Json;
9 | public ushort ResponseQueuePrefetchCount { get; set; } = 1;
10 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Docs/Core/Descriptions/IDocDescription.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.Rest.Docs.Core.Descriptions;
2 |
3 | ///
4 | /// Marker interface identifying a class responsible for adding additional
5 | /// documentation to a REST Api action method document. For example, comments
6 | /// stored within .NET code XML files can be queried and added to the model.
7 | ///
8 | public interface IDocDescription;
--------------------------------------------------------------------------------
/netfusion/src/Common/NetFusion.Common.Base/Logging/ITypeLog.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Common.Base.Logging;
2 |
3 | ///
4 | /// Implemented by a type to determine what state should be logged.
5 | ///
6 | public interface ITypeLog
7 | {
8 | ///
9 | /// Should return subset of a type's state to be logged.
10 | ///
11 | /// State to be logged.
12 | object Log();
13 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.Redis/Plugin/IBusEntityModule.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics.CodeAnalysis;
2 | using NetFusion.Core.Bootstrap.Plugins;
3 | using NetFusion.Integration.Bus.Entities;
4 |
5 | namespace NetFusion.Integration.Redis.Plugin;
6 |
7 | public interface IBusEntityModule : IPluginModuleService
8 | {
9 | bool TryGetPublishEntityForMessage(Type messageType, [NotNullWhen(true)] out BusEntity? entity);
10 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/Resources/Models/PaymentModel.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Rest.Resources;
2 |
3 | namespace NetFusion.Web.UnitTests.Rest.Resources.Models;
4 |
5 | ///
6 | /// Represents a model returned from a REST Api.
7 | ///
8 | [Resource("PaymentResource")]
9 | public class PaymentModel
10 | {
11 | public string PaymentId { get; set; }
12 | public decimal Amount { get; set; }
13 | }
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.TestFixtures/Plugins/MockHostPlugin.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Core.Bootstrap.Plugins;
2 |
3 | namespace NetFusion.Core.TestFixtures.Plugins;
4 |
5 | ///
6 | /// The host plug-in represents the executing host application such as
7 | /// a WebApi or Console host. A container can only have one associated
8 | /// host plug-in.
9 | ///
10 | public class MockHostPlugin() : MockPlugin(PluginTypes.HostPlugin);
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.ServiceBus/Rpc/Metadata/RpcProcessingOptions.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Integration.ServiceBus.Rpc.Metadata;
2 |
3 | ///
4 | /// Options used when processing RPC commands.
5 | ///
6 | public class RpcProcessingOptions
7 | {
8 | public int PrefetchCount { get; set; } = 10;
9 | public int MaxConcurrentCalls { get; set; } = 20;
10 | public string? Identifier { get; set; }
11 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Mocks/IMockedService.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using NetFusion.Web.Rest.Resources;
3 |
4 | namespace NetFusion.Web.UnitTests.Mocks;
5 |
6 | public interface IMockedService
7 | {
8 | HalResource ServerReceivedResource { get; set; }
9 |
10 | IEnumerable GetResources();
11 |
12 | bool TriggerServerSideException { get; set; }
13 |
14 | int ReturnsStatusCode { get; set; }
15 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/Resources/Models/AccountModel.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Rest.Resources;
2 |
3 | namespace NetFusion.Web.UnitTests.Rest.Resources.Models;
4 |
5 | ///
6 | /// Represents a model returned from a REST Api.
7 | ///
8 | [Resource("AccountResource")]
9 | public class AccountModel
10 | {
11 | public string AccountNumber { get; set; }
12 | public decimal AvailableBalance { get; set; }
13 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.RabbitMQ/Bus/PublishOptions.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Common.Base;
2 |
3 | namespace NetFusion.Integration.RabbitMQ.Bus;
4 |
5 | // Options used when publishing a message.
6 | public class PublishOptions
7 | {
8 | public string ContentType { get; set; } = ContentTypes.Json;
9 | public byte? Priority { get; set; }
10 | public bool IsPersistent { get; set; }
11 | public bool IsMandatory { get; set; }
12 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.ServiceBus/Rpc/Metadata/RpcPublishOptions.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Common.Base;
2 |
3 | namespace NetFusion.Integration.ServiceBus.Rpc.Metadata;
4 |
5 | ///
6 | /// Options used when sending a RPC command to a queue.
7 | ///
8 | public class RpcPublishOptions
9 | {
10 | public int CancelRpcRequestAfterMs { get; set; } = 5_000;
11 | public string ContentType { get; set; } = ContentTypes.Json;
12 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Common/HttpHeaderNames.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.Common;
2 |
3 | ///
4 | /// Common HTTP header name constants.
5 | ///
6 | public static class HttpHeaderNames
7 | {
8 | ///
9 | /// Accept
10 | ///
11 | public const string Accept = "Accept";
12 |
13 | ///
14 | /// Content-Type
15 | ///
16 | public const string ContentType = "Content-Type";
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging.UnitTests/Enrichers/Mocks/Enrichers.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Messaging.Enrichers;
2 | using NetFusion.Messaging.Types.Contracts;
3 |
4 | namespace NetFusion.Messaging.UnitTests.Enrichers.Mocks;
5 |
6 | public class MockEnricherWithException : IMessageEnricher
7 | {
8 | public Task EnrichAsync(IMessage message)
9 | {
10 | return Task.Run(() => throw new InvalidOperationException("TestEnricherException"));
11 | }
12 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging/IMessageConsumer.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging
2 | {
3 | ///
4 | /// Identifies component as a message consumer that should be searched when messages are published.
5 | /// This search happens during the bootstrapping of the plug-in and all found components are registered
6 | /// with the service-collection as scoped components.
7 | ///
8 | public interface IMessageConsumer;
9 | }
10 |
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/ApiMetadata/Server/MetaResourceMap.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Rest.Server.Hal;
2 |
3 | namespace NetFusion.Web.UnitTests.Rest.ApiMetadata.Server;
4 |
5 | public class MetaResourceMap : HalResourceMap
6 | {
7 | protected override void OnBuildResourceMap()
8 | {
9 | Map()
10 | .LinkMeta(_ =>
11 | {
12 |
13 | });
14 | }
15 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/ClientRequests/Server/CustomerModel.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.UnitTests.Rest.ClientRequests.Server;
2 |
3 | ///
4 | /// Server side resource returned by the API Controller under-test.
5 | ///
6 | public class CustomerModel
7 | {
8 | public string CustomerId { get; set; }
9 | public string FirstName { get; set; }
10 | public string LastName { get; set; }
11 | public int Age { get; set; }
12 | }
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.Bootstrap/Plugins/IPluginModuleService.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Core.Bootstrap.Plugins;
2 |
3 | ///
4 | /// Marker interface used to identify interfaces implemented by modules providing access to information
5 | /// it manages. All, modules implementing an interface derived from this type will be added to the
6 | /// dependency-injection container as singletons of the derived interface type.
7 | ///
8 | public interface IPluginModuleService;
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/ClientRequests/Client/CustomerModel.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.UnitTests.Rest.ClientRequests.Client;
2 |
3 | ///
4 | /// Client side resource class modeling the corresponding
5 | /// server side returned resource.
6 | ///
7 | public class CustomerModel
8 | {
9 | public string CustomerId { get; set; }
10 | public string FirstName { get; set; }
11 | public string LastName { get; set; }
12 | public int Age { get; set; }
13 | }
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.TestFixtures/Plugins/MockCorePlugin.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Core.Bootstrap.Plugins;
2 |
3 | namespace NetFusion.Core.TestFixtures.Plugins;
4 |
5 | ///
6 | /// Mock core plug-in that can be used for testing. In the composite container,
7 | /// core plug-ins implement cross-cutting concerns and implement specific technical
8 | /// details used to support the application domain.
9 | ///
10 | public class MockCorePlugin() : MockPlugin(PluginTypes.CorePlugin);
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging/IncludeDerivedMessagesAttribute.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging
2 | {
3 | ///
4 | /// Used to specify that message handler method, declared as a base message type,
5 | /// should be called when derived messages are published. This allows a single
6 | /// handler to be invoked for a several derived message types.
7 | ///
8 | [AttributeUsage(AttributeTargets.Parameter)]
9 | public class IncludeDerivedMessagesAttribute : Attribute;
10 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging.UnitTests/Commands/Mocks/Commands.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Messaging.Types;
2 |
3 | namespace NetFusion.Messaging.UnitTests.Commands.Mocks;
4 |
5 | public class MockCommand : Command
6 | {
7 | public List ThrowInHandlers { get; } = [];
8 | }
9 |
10 | public class MockCommandNoResult : Command;
11 |
12 | public class MockCommandNoHandler : Command;
13 |
14 | public class MockCommandResult
15 | {
16 | public string Value { get; set; } = string.Empty;
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging.Types/Contracts/IDomainEvent.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging.Types.Contracts;
2 |
3 | ///
4 | /// Message that can be published to notify application consumers of an occurrence.
5 | /// Domain-events are used to notify one or more consumers of an occurrence of an event.
6 | /// Often, command handlers will publish domain-events used to notify interested subscribers
7 | /// of state changes made by the handling of the command.
8 | ///
9 | public interface IDomainEvent : IMessage;
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.RabbitMQ/Plugin/IBusModule.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Integration.RabbitMQ.Bus;
2 | using NetFusion.Integration.RabbitMQ.Internal;
3 | using NetFusion.Integration.RabbitMQ.Plugin.Configs;
4 |
5 | namespace NetFusion.Integration.RabbitMQ.Plugin;
6 |
7 | public interface IBusModule : IPluginModuleService
8 | {
9 | RabbitMqConfig RabbitMqConfig { get; }
10 |
11 | IBusConnection GetConnection(string busName);
12 |
13 | public event EventHandler? Reconnection;
14 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.ServiceBus/Topics/Metadata/TopicPublishOptions.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Common.Base;
2 |
3 | namespace NetFusion.Integration.ServiceBus.Topics.Metadata;
4 |
5 | ///
6 | /// Default options used when publishing a domain-event to a topic.
7 | ///
8 | public class TopicPublishOptions
9 | {
10 | ///
11 | /// The content-type to use when serializing the domain-event.
12 | ///
13 | public string ContentType { get; set; } = ContentTypes.Json;
14 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.Bus/Strategies/IBusEntityDisposeStrategy.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Integration.Bus.Strategies;
2 |
3 | ///
4 | /// Strategy invoked when the microservice is stopped used
5 | /// to dispose a created service-bus entity.
6 | ///
7 | public interface IBusEntityDisposeStrategy : IBusEntityStrategy
8 | {
9 | ///
10 | /// Called when the entity should be disposed.
11 | ///
12 | /// Future Result.
13 | Task OnDispose();
14 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.UnitTests/RabbitMQ/Mocks/TestRabbitEntityModule.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Integration.Bus;
2 | using NetFusion.Integration.Bus.Entities;
3 | using NetFusion.Integration.RabbitMQ.Plugin.Modules;
4 |
5 | namespace NetFusion.Integration.UnitTests.RabbitMQ.Mocks;
6 |
7 | public class TestRabbitEntityModule : BusEntityModule
8 | {
9 | // Set by bootstrapper:
10 | protected IEnumerable Routers => BusMessageRouters;
11 |
12 | public IEnumerable Entities => BusEntities;
13 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging.Types/Contracts/IEventSource.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging.Types.Contracts;
2 |
3 | ///
4 | /// Implemented by an entity that can have associated domain events.
5 | /// This can be used to decouple domain entities from the infrastructure
6 | /// used to publish the events.
7 | ///
8 | public interface IEventSource
9 | {
10 | ///
11 | /// The domain events associated with the entity.
12 | ///
13 | IEnumerable DomainEvents { get; }
14 | }
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Mapping/Strategies/TestMapStrategyTwoToOne.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Services.Mapping;
2 | using NetFusion.Services.UnitTests.Mapping.Entities;
3 |
4 | namespace NetFusion.Services.UnitTests.Mapping.Strategies;
5 |
6 | public class TestMapStrategyTwoToOne : MappingStrategy
7 | {
8 | protected override TestMapTypeOne SourceToTarget(TestMapTypeTwo target) =>
9 | new()
10 | {
11 | Values = [target.Min, target.Max, target.Sum]
12 | };
13 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/ClientRequests/Client/AddressModel.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.UnitTests.Rest.ClientRequests.Client;
2 |
3 | ///
4 | /// Client side resource class modeling the corresponding
5 | /// server side returned resource.
6 | ///
7 | public class AddressModel
8 | {
9 | public string AddressId { get; set; }
10 | public string CustomerId { get; set; }
11 | public string Street { get; set; }
12 | public string City { get; set; }
13 | public string ZipCode { get; set; }
14 | }
--------------------------------------------------------------------------------
/netfusion/src/Common/NetFusion.Common.Base/NfExtensions.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Common.Base.Logging;
2 |
3 | namespace NetFusion.Common.Base;
4 |
5 | ///
6 | /// Static class containing references to global class instances
7 | /// initialized at the beginning of the bootstrap process.
8 | ///
9 | public static class NfExtensions
10 | {
11 | ///
12 | /// Reference to a logger implementation providing extended logging.
13 | ///
14 | public static IExtendedLogger Logger { get; set; } = new NullExtendedLogger();
15 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.Bus/Strategies/IBusEntityCreationStrategy.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Integration.Bus.Strategies;
2 |
3 | ///
4 | /// Strategy invoked during bootstrapping used to define how an
5 | /// entity is created on the service-bus.
6 | ///
7 | public interface IBusEntityCreationStrategy : IBusEntityStrategy
8 | {
9 | ///
10 | /// Invoked when the entity should be created on the service-bus.
11 | ///
12 | /// Future Result.
13 | Task CreateEntity();
14 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.ServiceBus/Plugin/Configs/ServiceBusConfig.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Integration.ServiceBus.Plugin.Configs;
2 |
3 | ///
4 | /// Configurations associated with the Azure Service Bus plugin.
5 | ///
6 | public class ServiceBusConfig : IPluginConfig
7 | {
8 | ///
9 | /// Determines if queue and topic namespace entities should automatically
10 | /// be created when the microservice bootstraps.
11 | ///
12 | public bool IsAutoCreateEnabled { get; set; } = false;
13 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.Bus/Rpc/RpcReplyException.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Integration.Bus.Rpc;
2 |
3 | ///
4 | /// Exception that is thrown if the RPC reply contains an serialized exception.
5 | ///
6 | public class RpcReplyException : Exception
7 | {
8 | public RpcReplyException(string message)
9 | : base(message)
10 | {
11 |
12 | }
13 |
14 | public RpcReplyException(string message, Exception innerException)
15 | : base(message, innerException)
16 | {
17 |
18 | }
19 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/DocGeneration/Setup/PluginSetup.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Core.Bootstrap.Container;
2 | using NetFusion.Core.TestFixtures.Plugins;
3 | using NetFusion.Web.Rest.Docs.Plugin;
4 |
5 | namespace NetFusion.Web.UnitTests.Rest.DocGeneration.Setup;
6 |
7 | public class PluginSetup
8 | {
9 | public static void WithDefaults(ICompositeContainer container)
10 | {
11 | var hostPlugin = new MockHostPlugin();
12 |
13 | container.RegisterPlugins(hostPlugin);
14 | container.RegisterPlugin();
15 | }
16 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/IntegrationTests/RabbitMQ/MockPublisherModule.cs:
--------------------------------------------------------------------------------
1 | using Moq;
2 | using NetFusion.RabbitMQ.Plugin.Modules;
3 | using NetFusion.RabbitMQ.Publisher.Internal;
4 |
5 | namespace IntegrationTests.RabbitMQ
6 | {
7 | using NetFusion.RabbitMQ.Metadata;
8 |
9 | public class MockPublisherModule : PublisherModule
10 | {
11 | protected override IRpcClient CreateRpcClient(ExchangeMeta definition)
12 | {
13 | Mock mockRpcClient = new Mock();
14 | return mockRpcClient.Object;
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Common/NetFusion.Common.Base/Logging/ILogLevelControl.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Logging;
2 |
3 | namespace NetFusion.Common.Base.Logging;
4 |
5 | ///
6 | /// Interface implemented by a component responsible for changing the log level at runtime.
7 | ///
8 | public interface ILogLevelControl
9 | {
10 | ///
11 | /// Sets the minimum log level at runtime.
12 | ///
13 | /// Log level.
14 | /// The set log level.
15 | string SetMinimumLevel(LogLevel logLevel);
16 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.CodeGen/Plugin/ICodeGenModule.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Core.Bootstrap.Plugins;
2 | using NetFusion.Web.Rest.CodeGen.Plugin.Configs;
3 |
4 | namespace NetFusion.Web.Rest.CodeGen.Plugin;
5 |
6 | ///
7 | /// Plugin module service interface exposing information about the code-generation.
8 | ///
9 | public interface ICodeGenModule : IPluginModuleService
10 | {
11 | ///
12 | /// Reference to the plugin configuration containing code-generation settings.
13 | ///
14 | RestCodeGenConfig CodeGenConfig { get; }
15 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/LinkGeneration/Server/StateModel.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.UnitTests.Rest.LinkGeneration.Server;
2 |
3 | ///
4 | /// Server model returned as a resource to test server-side link generation.
5 | ///
6 | public class StateModel
7 | {
8 | // Model properties used within mappings when specifying resource associated links.
9 | public int Id { get; set; }
10 | public int Value1 { get; set; }
11 | public string Value2 { get; set; }
12 | public int? Value3 { get; set; }
13 | public int Value4 { get; set; }
14 | }
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.TestFixtures/Plugins/MockAppPlugin.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Core.Bootstrap.Plugins;
2 |
3 | namespace NetFusion.Core.TestFixtures.Plugins;
4 |
5 | ///
6 | /// Mock application component plug-in that can be used for testing.
7 | /// The composite container can have multiple associated application
8 | /// components. Components in this type of plug-in are specific
9 | /// to the domain of the application. Domain Entities, Aggregates,
10 | /// and Services such examples.
11 | ///
12 | public class MockAppPlugin() : MockPlugin(PluginTypes.AppPlugin);
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Server/Mappings/IResourceProvider.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.Rest.Server.Mappings;
2 |
3 | ///
4 | /// Applies the resource metadata to a resource for the given media-type.
5 | ///
6 | public interface IResourceProvider
7 | {
8 | ///
9 | /// Uses the cached REST metadata and applies it to a resource instance.
10 | ///
11 | /// Contains the resource and it associated metadata.
12 | /// Plus any needed services.
13 | void ApplyResourceMeta(ResourceContext context);
14 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.Redis/Internal/ChannelEntityContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using NetFusion.Core.Bootstrap.Plugins;
3 | using NetFusion.Integration.Bus.Entities;
4 | using NetFusion.Integration.Redis.Plugin;
5 |
6 | namespace NetFusion.Integration.Redis.Internal;
7 |
8 | public class ChannelEntityContext(IPlugin hostPlugin, IServiceProvider serviceProvider)
9 | : BusEntityContext(hostPlugin, serviceProvider)
10 | {
11 | public IConnectionModule ConnectionModule { get; } = serviceProvider.GetRequiredService();
12 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging.Types/DomainEvent.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Messaging.Types.Contracts;
2 |
3 | namespace NetFusion.Messaging.Types;
4 |
5 | ///
6 | /// Base domain-event that can be published to notify application consumers of an occurrence.
7 | /// Domain-events are used to notify one or more consumers of an occurrence of an event.
8 | /// Often, a command handler will publish domain-events used to notify interested subscribers
9 | /// of state changes made by the handling of the command.
10 | ///
11 | public abstract class DomainEvent : Message, IDomainEvent;
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging/Routing/IRouteMeta.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging.Routing;
2 |
3 | ///
4 | /// Allows additional metadata to be associated with a given route.
5 | ///
6 | public interface IRouteMeta;
7 |
8 | ///
9 | /// Allows additional metadata to be associated with a given route.
10 | ///
11 | /// Message type associated with metadata.
12 | public interface IRouteMeta : IRouteMeta
13 | where TMessage : IMessage
14 | {
15 | public Type MessageType => typeof(TMessage);
16 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Resources/EntryPointModel.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.Rest.Resources;
2 |
3 | ///
4 | /// Model containing information about the Api.
5 | ///
6 | public class EntryPointModel(string version, string apiDocUrl)
7 | {
8 | ///
9 | /// Value indicating the version of the API.
10 | ///
11 | public string Version { get; } = version;
12 |
13 | ///
14 | /// Optional URL to document describing the API.
15 | ///
16 | public string ApiDocUrl { get; } = apiDocUrl;
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.RabbitMQ/Internal/ReconnectionEventArgs.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Integration.RabbitMQ.Plugin.Settings;
2 |
3 | namespace NetFusion.Integration.RabbitMQ.Internal
4 | {
5 | ///
6 | /// Event raised when a connection to a broker is reestablished.
7 | ///
8 | public class ReconnectionEventArgs(ConnectionSettings connection) : EventArgs
9 | {
10 | ///
11 | /// Information about the connection.
12 | ///
13 | public ConnectionSettings Connection { get; } = connection;
14 | }
15 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Docs/Entities/HalComments.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.Rest.Docs.Entities;
2 |
3 | ///
4 | /// Root entity containing HAL related comments.
5 | ///
6 | public class HalComments
7 | {
8 | ///
9 | /// Comments associated with a resource's embedded items.
10 | ///
11 | public EmbeddedComment[] EmbeddedComments { get; set; } = [];
12 |
13 | ///
14 | /// Comments associated with a resource's link relations.
15 | ///
16 | public RelationComment[] RelationComments { get; set; } = [];
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Common/NetFusion.Common.UnitTests/Entity/DynamicEntity.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Common.Base.Entity;
2 |
3 | namespace NetFusion.Common.UnitTests.Entity;
4 |
5 | public class DynamicEntity : IAttributedEntity
6 | {
7 | public IEntityAttributes Attributes { get; } = new EntityAttributes();
8 |
9 | public bool IsActive { get; set; }
10 | public int MaxValue { get; set; }
11 | public int MinValue { get; set; }
12 |
13 | public IDictionary AttributeValues
14 | {
15 | get => Attributes.GetValues();
16 | set => Attributes.SetValues(value);
17 | }
18 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging/Filters/IPreMessageFilter.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging.Filters;
2 |
3 | ///
4 | /// Filter executed before the message is dispatched to the consumer.
5 | ///
6 | public interface IPreMessageFilter : IMessageFilter
7 | {
8 | ///
9 | /// Invoked before the message is dispatched to the consumer.
10 | ///
11 | /// The message being dispatched.
12 | /// The task that will be completed when filter is completed.
13 | Task OnPreFilterAsync(IMessage message);
14 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Server/Linking/TemplateUrlLink.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 |
3 | namespace NetFusion.Web.Rest.Server.Linking;
4 |
5 | ///
6 | /// Represents a link containing an URL template with tokens to be replaced by the calling client.
7 | ///
8 | public class TemplateUrlLink(string relationName, MethodInfo actionMethodInfo) : ResourceLink(relationName)
9 | {
10 | ///
11 | /// The runtime information associated with a selected controller's action.
12 | ///
13 | public MethodInfo ActionMethodInfo { get; } = actionMethodInfo;
14 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.Bus/Strategies/IBusEntitySubscriptionStrategy.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Integration.Bus.Strategies;
2 |
3 | ///
4 | /// Strategy invoked during bootstrap to subscribe to a service-bus entity.
5 | ///
6 | public interface IBusEntitySubscriptionStrategy : IBusEntityStrategy
7 | {
8 | ///
9 | /// Called when the strategy should subscribe a message handler
10 | /// to be called when a message arrives on the service-bus entity.
11 | ///
12 | /// Future Result.
13 | Task SubscribeEntity();
14 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Common/InternetMediaTypes.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.Common;
2 |
3 | ///
4 | /// Common HTTP Media types.
5 | ///
6 | public class InternetMediaTypes
7 | {
8 | ///
9 | /// application/json
10 | ///
11 | public const string Json = "application/json";
12 |
13 | ///
14 | /// application/hal+json
15 | ///
16 | public const string HalJson = "application/hal+json";
17 |
18 | ///
19 | /// text/plain
20 | ///
21 | public const string PlainText = "text/plain";
22 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging/Filters/IPostMessageFilter.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging.Filters;
2 |
3 | ///
4 | /// Filter executed after the message has been dispatched to the consumer.
5 | ///
6 | public interface IPostMessageFilter : IMessageFilter
7 | {
8 | ///
9 | /// Invoked after the message has been dispatched to the consumer.
10 | ///
11 | /// The message being dispatched.
12 | /// The task that will be completed when execution is completed.
13 | Task OnPostFilterAsync(IMessage message);
14 | }
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Mapping/Strategies/TestMapStrategyOneToThree.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Services.Mapping;
2 | using NetFusion.Services.UnitTests.Mapping.Entities;
3 |
4 | namespace NetFusion.Services.UnitTests.Mapping.Strategies;
5 |
6 | public class TestMapStrategyOneToThree : MappingStrategy
7 | {
8 | protected override TestMapTypeThree SourceToTarget(TestMapTypeOne source)
9 | {
10 | return new TestMapTypeThree
11 | {
12 | MaxAllowedValue = source.Values.Max(),
13 | Values = source.Values
14 | };
15 | }
16 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Client/IRestClientFactory.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.Rest.Client;
2 |
3 | ///
4 | /// Responsible for creating IRestClient instances.
5 | ///
6 | public interface IRestClientFactory
7 | {
8 | ///
9 | /// Creates an IRestClient instance configured by the client application.
10 | ///
11 | /// The name of the configured HttpClient.
12 | /// Instance of REST Client providing additional functionality
13 | /// delegating to an inner HttpClient.
14 | IRestClient CreateClient(string name);
15 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/ClientRequests/Server/AddressModel.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Rest.Resources;
2 |
3 | namespace NetFusion.Web.UnitTests.Rest.ClientRequests.Server;
4 |
5 | ///
6 | /// Server side resource returned by the API Controller under-test.
7 | ///
8 | [Resource("cust-address")]
9 | public class AddressModel
10 | {
11 | public string AddressId { get; set; }
12 | public string CustomerId { get; set; }
13 | public string Street { get; set; }
14 | public string City { get; set; }
15 | public string State { get; set; }
16 | public string ZipCode { get; set; }
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Common/NetFusion.Common.Base/Validation/IValidatableType.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Common.Base.Validation;
2 |
3 | ///
4 | /// Implemented by a class to indicate that it should be passed its corresponding
5 | /// validator so validations can be added.
6 | ///
7 | public interface IValidatableType
8 | {
9 | ///
10 | /// Called during the validation process to allow a class instance to apply validations.
11 | ///
12 | /// The validator instance associated with the object being validated.
13 | void Validate(IObjectValidator validator);
14 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.Redis/Plugin/Modules/ChannelEntityModule.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Integration.Bus.Entities;
2 | using NetFusion.Integration.Redis.Internal;
3 |
4 | namespace NetFusion.Integration.Redis.Plugin.Modules;
5 |
6 | ///
7 | /// Extends the base Bus Entity Module and returns a context
8 | /// specific to Redis Pub/Sub.
9 | ///
10 | public class ChannelEntityModule : BusEntityModuleBase,
11 | IBusEntityModule
12 | {
13 | protected override BusEntityContext CreateContext(IServiceProvider services) =>
14 | new ChannelEntityContext(Context.AppHost, services);
15 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/HalComments.json:
--------------------------------------------------------------------------------
1 | {
2 | "embeddedComments": [
3 | {
4 | "embeddedName": "embedded-child", "parentResourceName": "api.root.model", "childResourceName": "api.embedded.model",
5 | "comments": "exact_match_comment"
6 | },
7 | {
8 | "embeddedName": "embedded-child-partial", "comments": "partial_match_comment"
9 | }
10 | ],
11 |
12 | "relationComments": [
13 | { "relationName": "current-child", "resourceName": "resource-with-relation", "comments": "exact_match_comment" },
14 | { "relationName": "self", "comments": "partial_match_comment" }
15 | ]
16 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.AMQP/Publisher/Queue.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.AMQP.Publisher.Internal;
2 | using NetFusion.Messaging.Types.Contracts;
3 |
4 | namespace NetFusion.AMQP.Publisher
5 | {
6 | ///
7 | /// Metadata for a queue defined on a host.
8 | ///
9 | /// The type of command associated with queue.
10 | public class Queue : HostItem
11 | where TCommand : ICommand
12 | {
13 | public Queue(string hostName, string name)
14 | : base( hostName, name)
15 | {
16 |
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.RabbitMQ/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 | global using Microsoft.Extensions.DependencyInjection;
4 | global using Microsoft.Extensions.Logging;
5 | global using NetFusion.Common.Base.Logging;
6 | global using NetFusion.Common.Base.Serialization;
7 | global using NetFusion.Common.Extensions.Reflection;
8 | global using NetFusion.Core.Bootstrap.Plugins;
9 | global using NetFusion.Messaging;
10 | global using NetFusion.Messaging.Internal;
11 | global using NetFusion.Messaging.Routing;
12 | global using NetFusion.Messaging.Types.Attributes;
13 | global using NetFusion.Messaging.Types.Contracts;
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging/Logging/IMessageLogSink.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging.Logging;
2 |
3 | ///
4 | /// Interface implemented by classes and called when message logs are sent to IMessageLogger.
5 | /// The implementation determines where messages should be written.
6 | ///
7 | public interface IMessageLogSink
8 | {
9 | ///
10 | /// Called by MessageLogger when a message log is recorded.
11 | ///
12 | /// Details about the message.
13 | /// Asynchronous task.
14 | Task WriteLogAsync(MessageLog messageLog);
15 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging/Routing/ConsumerRoute.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 |
3 | namespace NetFusion.Messaging.Routing;
4 |
5 | ///
6 | /// Represents a message type and its associated consumer.
7 | ///
8 | internal class ConsumerRoute : MessageRoute
9 | {
10 | public ConsumerRoute(Type messageType, MethodInfo consumer)
11 | : base(messageType)
12 | {
13 | SetConsumer(consumer);
14 | }
15 |
16 | public ConsumerRoute(Type messageType, Type resultType, MethodInfo consumer)
17 | : base(messageType, resultType)
18 | {
19 | SetConsumer(consumer);
20 | }
21 | }
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.Mapping/Plugin/IMappingModule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using NetFusion.Core.Bootstrap.Plugins;
4 | using NetFusion.Services.Mapping.Core;
5 |
6 | namespace NetFusion.Services.Mapping.Plugin;
7 |
8 | ///
9 | /// Interface implemented by a plug-in module responsible for finding all mapping strategies.
10 | ///
11 | public interface IMappingModule : IPluginModuleService
12 | {
13 | ///
14 | /// A lookup keyed by the source type listing all the possible target mappings.
15 | ///
16 | ILookup SourceTypeMappings { get; }
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Mapping/Strategies/TestMappingStrategyFactory.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Services.Mapping;
2 | using NetFusion.Services.UnitTests.Mapping.Entities;
3 |
4 | namespace NetFusion.Services.UnitTests.Mapping.Strategies;
5 |
6 | public class TestMappingStrategyFactory : IMappingStrategyFactory
7 | {
8 | public IEnumerable GetStrategies()
9 | {
10 | yield return DelegateMap.Map((TestMapTypeOne s) => new TestMapTypeTwo
11 | {
12 | Sum = s.Values.Sum(),
13 | Min = s.Values.Min(),
14 | Max = s.Values.Max()
15 | });
16 | }
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Mapping/Strategies/TestMapStrategyOneToTwo.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Services.Mapping;
2 | using NetFusion.Services.UnitTests.Mapping.Entities;
3 |
4 | namespace NetFusion.Services.UnitTests.Mapping.Strategies;
5 |
6 | public class TestMapStrategyOneToTwo : MappingStrategy
7 | {
8 | protected override TestMapTypeTwo SourceToTarget(TestMapTypeOne source)
9 | {
10 | return new TestMapTypeTwo
11 | {
12 | Sum = source.Values.Sum(),
13 | Min = source.Values.Min(),
14 | Max = source.Values.Max()
15 | };
16 | }
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging.Types/Contracts/IQuery.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging.Types.Contracts;
2 |
3 | ///
4 | /// Represents a query request that can be dispatched to a consumer.
5 | ///
6 | public interface IQuery : IMessage;
7 |
8 | ///
9 | /// Represents a query request that can be dispatched to a consumer.
10 | ///
11 | /// The type of the result expected by the query.
12 | public interface IQuery : IQuery
13 | {
14 | ///
15 | /// The result of the query's execution.
16 | ///
17 | TResult Result { get; set; }
18 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging.UnitTests/Logging/Mocks/LoggingSinks.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Messaging.Logging;
2 |
3 | namespace NetFusion.Messaging.UnitTests.Logging.Mocks;
4 |
5 | public class MockLoggingSink : IMessageLogSink
6 | {
7 | private readonly List _receivedLogs = [];
8 |
9 | public MockLoggingSink()
10 | {
11 | ReceivedLogs = _receivedLogs;
12 | }
13 |
14 | public IReadOnlyCollection ReceivedLogs { get; }
15 |
16 | public Task WriteLogAsync(MessageLog messageLog)
17 | {
18 | _receivedLogs.Add(messageLog);
19 | return Task.CompletedTask;
20 | }
21 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging.UnitTests/TestSetup.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Core.Bootstrap.Container;
2 | using NetFusion.Core.TestFixtures.Plugins;
3 | using NetFusion.Messaging.Plugin;
4 |
5 | namespace NetFusion.Messaging.UnitTests;
6 |
7 | public static class TestSetup
8 | {
9 | public static void WithEventHandler(ICompositeContainer container)
10 | {
11 | var appPlugin = new MockAppPlugin();
12 | appPlugin.AddModule();
13 |
14 | container.RegisterPlugin();
15 | container.RegisterPlugins(appPlugin);
16 | container.RegisterPlugin();
17 | }
18 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/DocGeneration/Server/TestRequestModels.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Rest.Resources;
2 |
3 | namespace NetFusion.Web.UnitTests.Rest.DocGeneration.Server;
4 |
5 | ///
6 | /// Example mode populated from the body of a request.
7 | ///
8 | [Resource("TestRequest")]
9 | public class TestRequestModel
10 | {
11 | ///
12 | /// The first name read from the request body.
13 | ///
14 | public string FirstName { get; set; }
15 |
16 | ///
17 | /// The last name read from the request body.
18 | ///
19 | public string LastName { get; set; }
20 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Server/Plugin/Modules/ConcurrencyModule.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using NetFusion.Common.Base.Entity;
3 | using NetFusion.Core.Bootstrap.Plugins;
4 | using NetFusion.Web.Rest.Server.Concurrency;
5 |
6 | namespace NetFusion.Web.Rest.Server.Plugin.Modules;
7 |
8 | public class ConcurrencyModule : PluginModule
9 | {
10 | public override void RegisterServices(IServiceCollection services)
11 | {
12 | services.AddScoped();
13 |
14 | services.AddControllers(options =>
15 | {
16 | options.Filters.Add();
17 | });
18 | }
19 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web/Plugin/Modules/ApiMetadataModule.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using NetFusion.Core.Bootstrap.Plugins;
3 | using NetFusion.Web.Metadata;
4 | using NetFusion.Web.Metadata.Core;
5 |
6 | namespace NetFusion.Web.Plugin.Modules;
7 |
8 | ///
9 | /// Plugin module that registers a service used to query ASP.NET controller action metadata.
10 | ///
11 | public class ApiMetadataModule : PluginModule
12 | {
13 | public override void RegisterServices(IServiceCollection services)
14 | {
15 | services.AddMvc();
16 | services.AddSingleton();
17 | }
18 | }
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.UnitTests/Health/Mocks/HealthCheckModuleOne.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Core.Bootstrap.Health;
2 | using NetFusion.Core.Bootstrap.Plugins;
3 |
4 | namespace NetFusion.Core.UnitTests.Health.Mocks;
5 |
6 | public class HealthCheckModuleOne : PluginModule,
7 | IModuleHealthCheckProvider
8 | {
9 | public HealthCheckStatusType HealthCheckStatus { get; set; } = HealthCheckStatusType.Healthy;
10 |
11 | public Task CheckModuleAspectsAsync(ModuleHealthCheck healthCheck)
12 | {
13 | healthCheck.RecordAspect(HealthAspectCheck.For("ModuleOneAspect", "ModuleOneValue", HealthCheckStatus));
14 | return Task.CompletedTask;
15 | }
16 | }
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.UnitTests/Health/Mocks/HealthCheckModuleTwo.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Core.Bootstrap.Health;
2 | using NetFusion.Core.Bootstrap.Plugins;
3 |
4 | namespace NetFusion.Core.UnitTests.Health.Mocks;
5 |
6 | public class HealthCheckModuleTwo : PluginModule,
7 | IModuleHealthCheckProvider
8 | {
9 | public HealthCheckStatusType HealthCheckStatus { get; set; } = HealthCheckStatusType.Healthy;
10 |
11 | public Task CheckModuleAspectsAsync(ModuleHealthCheck healthCheck)
12 | {
13 | healthCheck.RecordAspect(HealthAspectCheck.For("ModuleTwoAspect", "ModuleTwoValue", HealthCheckStatus));
14 | return Task.CompletedTask;
15 | }
16 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging.UnitTests/Messaging/Logging/Mocks/LoggingSinks.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Messaging.Logging;
2 |
3 | namespace NetFusion.Messaging.UnitTests.Messaging.Logging.Mocks;
4 |
5 | public class MockLoggingSink : IMessageLogSink
6 | {
7 | private readonly List _receivedLogs = [];
8 |
9 | public MockLoggingSink()
10 | {
11 | ReceivedLogs = _receivedLogs;
12 | }
13 |
14 | public IReadOnlyCollection ReceivedLogs { get; }
15 |
16 | public Task WriteLogAsync(MessageLog messageLog)
17 | {
18 | _receivedLogs.Add(messageLog);
19 | return Task.CompletedTask;
20 | }
21 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Server/Hal/Core/HalResourceMeta.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Rest.Server.Meta;
2 |
3 | namespace NetFusion.Web.Rest.Server.Hal.Core;
4 |
5 | ///
6 | /// HAL resource metadata for a given model type.
7 | ///
8 | /// The type of model associated with resource.
9 | public class HalResourceMeta : ResourceMeta>
10 | where TModel : class
11 | {
12 | // ** Addition needed HAL specific methods to record any metadata can be added.
13 | // ** This class derives from ResourceMeta which allows adding links to the
14 | // ** specified resource type.
15 | }
--------------------------------------------------------------------------------
/netfusion/build/common.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | NetFusion Contributors
4 | NetFusion
5 | https://github.com/grecosoft/NetFusion/wiki
6 | https://github.com/grecosoft/NetFusion
7 | http://www.opensource.org/licenses/mit-license.php
8 | git
9 | true
10 | netfusion.png
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/netfusion/src/Common/NetFusion.Common.UnitTests/Extensions/TypeExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using FluentAssertions;
3 | using NetFusion.Common.Extensions.Types;
4 |
5 | namespace NetFusion.Common.UnitTests.Extensions;
6 |
7 | public class TypeExtensions
8 | {
9 | [Fact]
10 | public void CanMapCSharpType_To_JavascriptType()
11 | {
12 | "Test".GetType().GetJsTypeName().Should().Be("String");
13 | DateTime.UtcNow.GetType().GetJsTypeName().Should().Be("Date");
14 | }
15 |
16 | [Fact]
17 | public void IfUnknownCSharpType_ObjectJavascript()
18 | {
19 | new StringBuilder().GetType().GetJsTypeName().Should().Be("Object");
20 | }
21 | }
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.UnitTests/Bootstrap/Mocks/ServiceRegistrationTests.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Core.UnitTests.Bootstrap.Mocks;
2 |
3 | public class ServiceRegistrationTests
4 | {
5 | [Fact]
6 | public void DefaultServices_OverridenBy_OtherPlugins()
7 | {
8 |
9 | }
10 |
11 | [Fact]
12 | public void CoreServices_OverridenBy_ApplicationPlugins()
13 | {
14 |
15 | }
16 |
17 | [Fact]
18 | public void ApplicationServices_OverridenBy_HostServices()
19 | {
20 |
21 | }
22 |
23 | [Fact]
24 | public void RegisteredServices_Overriden_WhenComposing()
25 | {
26 |
27 | }
28 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Docs/Core/ITypeCommentService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using NetFusion.Web.Rest.Docs.Models;
3 |
4 | namespace NetFusion.Web.Rest.Docs.Core;
5 |
6 | ///
7 | /// Service responsible for building documentation for a specific type based on an underlying source.
8 | ///
9 | public interface ITypeCommentService
10 | {
11 | ///
12 | /// Returns documentation for a resource type.
13 | ///
14 | /// The type of the resource to document.
15 | /// Model containing documentation for the resource.
16 | ApiResourceDoc GetResourceDoc(Type resourceType);
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Common/NetFusion.Common.Base/Scripting/ScriptPredicate.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Common.Base.Scripting;
2 |
3 | ///
4 | /// Properties describing a script to be executed and the value of an entity
5 | /// attribute containing the result of the Boolean expression.
6 | ///
7 | /// The name of the script that should be executed against a source object
8 | /// to determine if it meets the criteria of the expression.
9 | /// The entity's Boolean attribute that determines if the source object
10 | /// matches the criteria of the script.
11 | public record ScriptPredicate(string ScriptName, string AttributeName);
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging/Enrichers/IMessageEnricher.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging.Enrichers;
2 |
3 | ///
4 | /// Types implementing this interface are registered within the application's
5 | /// bootstrap configuration and called for each published message. The role
6 | /// of an enricher is to added key/value pairs to the message.
7 | ///
8 | public interface IMessageEnricher
9 | {
10 | ///
11 | /// Implementation should add a key/value pair to the message.
12 | ///
13 | /// The message to enrich.
14 | /// Future Result
15 | Task EnrichAsync(IMessage message);
16 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.ServiceBus/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 | global using Microsoft.Extensions.DependencyInjection;
4 | global using Microsoft.Extensions.Logging;
5 | global using NetFusion.Common.Base.Logging;
6 | global using NetFusion.Common.Base.Serialization;
7 | global using NetFusion.Common.Extensions.Collections;
8 | global using NetFusion.Common.Extensions.Reflection;
9 | global using NetFusion.Core.Bootstrap.Plugins;
10 | global using NetFusion.Messaging;
11 | global using NetFusion.Messaging.Internal;
12 | global using NetFusion.Messaging.Routing;
13 | global using NetFusion.Messaging.Types.Attributes;
14 | global using NetFusion.Messaging.Types.Contracts;
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.ServiceBus/Rpc/Metadata/RpcQueueMeta.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Integration.ServiceBus.Rpc.Metadata;
2 |
3 | ///
4 | /// Metadata used to define a queue on which a microservice receives
5 | /// RPC style of messages.
6 | ///
7 | public class RpcQueueMeta(string queueName) : IRpcQueueMeta
8 | {
9 | public string QueueName { get; } = queueName;
10 | public RpcProcessingOptions ProcessingOptions { get; } = new();
11 |
12 | public TimeSpan? LockDuration { get; set; }
13 | public int? MaxDeliveryCount { get; set; }
14 | public long? MaxSizeInMegabytes { get; set; }
15 | public TimeSpan? DefaultMessageTimeToLive { get; set; }
16 | }
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Roslyn/DynamicEntity.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Common.Base.Entity;
2 |
3 | namespace NetFusion.Services.UnitTests.Roslyn;
4 |
5 | public class DynamicEntity : IAttributedEntity
6 | {
7 | public IEntityAttributes Attributes { get; }
8 |
9 | public DynamicEntity()
10 | {
11 | Attributes = new EntityAttributes();
12 | }
13 |
14 | public bool IsActive { get; set; }
15 | public int MaxValue { get; set; }
16 | public int MinValue { get; set; }
17 |
18 | public IDictionary AttributeValues
19 | {
20 | get => Attributes.GetValues();
21 | set => Attributes.SetValues(value);
22 | }
23 | }
--------------------------------------------------------------------------------
/netfusion/src/Common/NetFusion.Common.Base/Validation/ValidationService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetFusion.Common.Base.Validation;
4 |
5 | ///
6 | /// Service that delegates to ICompositeApp to create an instance
7 | /// of the host provided IObjectValidator used for validation.
8 | ///
9 | public class ValidationService : IValidationService
10 | {
11 | public ValidationResultSet Validate(object obj)
12 | {
13 | if (obj == null) throw new ArgumentNullException(nameof(obj),
14 | "Object to validate cannot be null.");
15 |
16 | ObjectValidator validator = new ObjectValidator(obj);
17 | return validator.Validate();
18 | }
19 | }
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.Bootstrap/Health/IModuleHealthCheckProvider.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace NetFusion.Core.Bootstrap.Health;
4 |
5 | ///
6 | /// Implemented by any IPluginModule derive class to participate in
7 | /// determining the overall health of the composite-application.
8 | ///
9 | public interface IModuleHealthCheckProvider
10 | {
11 | ///
12 | /// Populates a module health-check by recording the health of specific
13 | /// aspects managed by the module.
14 | ///
15 | /// Health check to be populated.
16 | Task CheckModuleAspectsAsync(ModuleHealthCheck healthCheck);
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Docs/Core/IDocBuilder.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Metadata;
2 | using NetFusion.Web.Rest.Docs.Models;
3 |
4 | namespace NetFusion.Web.Rest.Docs.Core;
5 |
6 | ///
7 | /// Contract for a component responsible for building an action documentation
8 | /// model from a WebApi action method metadata.
9 | ///
10 | public interface IDocBuilder
11 | {
12 | ///
13 | /// Creates an action document from associated metadata.
14 | ///
15 | /// The metadata describing the action method.
16 | /// The constructed model.
17 | ApiActionDoc BuildActionDoc(ApiActionMeta actionMeta);
18 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/ClientRequests/Server/CustomerResourceMap.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Common;
2 | using NetFusion.Web.Rest.Server.Hal;
3 |
4 | namespace NetFusion.Web.UnitTests.Rest.ClientRequests.Server;
5 |
6 | ///
7 | /// Resource mapping class used by the unit-tests that will be discovered
8 | /// by the NetFusion container REST/HAL Plug-in.
9 | ///
10 | public class CustomerResourceMap : HalResourceMap
11 | {
12 | protected override void OnBuildResourceMap()
13 | {
14 | Map()
15 | .LinkMeta(meta =>
16 | meta.Url(RelationTypes.Self, (c, r) => c.GetCustomer(r.CustomerId)));
17 | }
18 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/DocGeneration/Server/DocResourceMap.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Rest.Server.Hal;
2 |
3 | namespace NetFusion.Web.UnitTests.Rest.DocGeneration.Server;
4 |
5 | public class DocResourceMap : HalResourceMap
6 | {
7 | protected override void OnBuildResourceMap()
8 | {
9 | Map()
10 | .LinkMeta(
11 | meta => meta.Url("relation-1", (c, r) => c.GetResourceDetails(r.ModelId, r.VersionNumber)));
12 |
13 | Map()
14 | .LinkMeta(
15 | meta => meta.Url("relation-2", (c, r) => c.GetEmbeddedResourceDetails(r.ModelId)));
16 | }
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.Bootstrap/Plugins/PluginSummary.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Core.Bootstrap.Plugins;
2 |
3 | ///
4 | /// Read-only class providing a summary information for a plugin.
5 | ///
6 | public class PluginSummary
7 | {
8 | public string PluginId { get; }
9 | public string Name { get; }
10 | public string AssemblyName { get; }
11 | public string AssemblyVersion { get; }
12 |
13 | public PluginSummary(IPlugin plugin)
14 | {
15 | System.ArgumentNullException.ThrowIfNull(plugin);
16 |
17 | PluginId = plugin.PluginId;
18 | Name = plugin.Name;
19 | AssemblyName = plugin.AssemblyName;
20 | AssemblyVersion = plugin.AssemblyVersion;
21 | }
22 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Client/IRestClientService.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.Rest.Client;
2 |
3 | ///
4 | /// Provides a service that delegates to IRequestClientFactory and provides
5 | /// caching of the underlying HttpClient and other higher level methods.
6 | ///
7 | public interface IRestClientService
8 | {
9 | ///
10 | /// Returns a reference to a configured named client for making
11 | /// HTTP requests.
12 | ///
13 | /// The name of the configured client.
14 | /// Reference to the request client. The same instance
15 | /// of the IRestClient is returned based on name.
16 | IRestClient GetClient(string name);
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Common/NetFusion.Common.Base/Validation/IValidationService.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Common.Base.Validation;
2 |
3 | ///
4 | /// Service for validating objects using the host provided IObjectValidator instance.
5 | /// If the host does not provided a IObjectValidator implementation, a version based
6 | /// on Microsoft's Data Annotations is used.
7 | ///
8 | public interface IValidationService
9 | {
10 | ///
11 | /// Validates the object and all if its children and returns a flattened list
12 | /// containing objects with validations.
13 | ///
14 | /// Result set containing all objects with resulting validations.
15 | ValidationResultSet Validate(object obj);
16 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.Redis/Internal/CachedConnection.cs:
--------------------------------------------------------------------------------
1 | using StackExchange.Redis;
2 |
3 | namespace NetFusion.Integration.Redis.Internal
4 | {
5 | ///
6 | /// Contains a reference to a Redis connection and the configuration
7 | /// options from which it was created.
8 | ///
9 | public class CachedConnection(
10 | ConfigurationOptions configuration,
11 | ConnectionMultiplexer connection)
12 | {
13 | public ConfigurationOptions Configuration { get; } = configuration ?? throw new ArgumentNullException(nameof(configuration));
14 | public ConnectionMultiplexer Connection { get; } = connection ?? throw new ArgumentNullException(nameof(connection));
15 | }
16 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.ServiceBus/Namespaces/MessageProperties.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics.CodeAnalysis;
2 | using Azure.Messaging.ServiceBus;
3 | using NetFusion.Integration.Bus;
4 |
5 | namespace NetFusion.Integration.ServiceBus.Namespaces;
6 |
7 | ///
8 | /// Reading and parsing of message properties.
9 | ///
10 | internal static class MessageProperties
11 | {
12 | public static bool TryParseReplyTo(ProcessMessageEventArgs args,
13 | [MaybeNullWhen(false)]out string busName, [MaybeNullWhen(false)]out string queueName)
14 | {
15 | ArgumentNullException.ThrowIfNull(args);
16 | return MessageExtensions.TryParseReplyTo(args.Message.ReplyTo, out busName, out queueName);
17 | }
18 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.Bus/Strategies/IBusEntityStrategy.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Integration.Bus.Entities;
2 |
3 | namespace NetFusion.Integration.Bus.Strategies;
4 |
5 | ///
6 | /// Base interface form which all strategies derive.
7 | ///
8 | public interface IBusEntityStrategy
9 | {
10 | ///
11 | /// Reference to the entity associated with the strategy.
12 | ///
13 | public BusEntity BusEntity { get; }
14 |
15 | ///
16 | /// Called during bootstrapping to associate a context with the strategy.
17 | ///
18 | /// The context containing cross-cutting services.
19 | void SetContext(BusEntityContext context);
20 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.UnitTests/RabbitMQ/Mocks/TestRabbitBusModule.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Core.Bootstrap.Plugins;
2 | using NetFusion.Integration.RabbitMQ.Bus;
3 | using NetFusion.Integration.RabbitMQ.Internal;
4 | using NetFusion.Integration.RabbitMQ.Plugin;
5 | using NetFusion.Integration.RabbitMQ.Plugin.Configs;
6 |
7 | namespace NetFusion.Integration.UnitTests.RabbitMQ.Mocks;
8 |
9 | public class TestRabbitBusModule : PluginModule,
10 | IBusModule
11 | {
12 | public RabbitMqConfig RabbitMqConfig { get; } = new();
13 |
14 | public IBusConnection GetConnection(string busName)
15 | {
16 | throw new NotImplementedException();
17 | }
18 |
19 | public event EventHandler? Reconnection;
20 | }
--------------------------------------------------------------------------------
/netfusion/src/Services/NetFusion.Services.UnitTests/Mapping/Strategies/TestMapStrategyThreeToTwo.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Services.Mapping;
2 | using NetFusion.Services.UnitTests.Mapping.Entities;
3 |
4 | namespace NetFusion.Services.UnitTests.Mapping.Strategies;
5 |
6 | public class TestMapStrategyThreeToTwo : MappingStrategy
7 | {
8 | protected override TestMapTypeTwo SourceToTarget(TestMapTypeThree source)
9 | {
10 | var validValues = source.Values.Where(v => v <= source.MaxAllowedValue).ToArray();
11 |
12 | return new TestMapTypeTwo
13 | {
14 | Min = validValues.Min(),
15 | Max = validValues.Max(),
16 | Sum = validValues.Sum()
17 | };
18 | }
19 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Client/Core/RestClientService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Concurrent;
3 |
4 | namespace NetFusion.Web.Rest.Client.Core;
5 |
6 | ///
7 | /// Provides caching an other high-level services.
8 | ///
9 | public class RestClientService(IRestClientFactory clientFactory) : IRestClientService
10 | {
11 | private readonly ConcurrentDictionary _restClients = new();
12 |
13 | private readonly IRestClientFactory _clientFactory = clientFactory ??
14 | throw new ArgumentNullException(nameof(clientFactory));
15 |
16 | public IRestClient GetClient(string name)
17 | {
18 | return _restClients.GetOrAdd(name, _clientFactory.CreateClient);
19 | }
20 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging/Internal/IBatchMessagePublisher.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging.Internal;
2 |
3 | ///
4 | /// Optional interface implemented by a message publisher supporting
5 | /// sending batches of domain-events.
6 | ///
7 | public interface IBatchMessagePublisher
8 | {
9 | ///
10 | /// Publishes a list of domain-events in batch.
11 | ///
12 | /// List of domain-events to be published.
13 | /// Cancellation token used to cancel async task.
14 | /// Future Task Result.
15 | Task PublicDomainEventsAsync(IEnumerable domainEvents, CancellationToken cancellationToken);
16 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Resources/ResourceAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetFusion.Web.Rest.Resources;
4 |
5 | ///
6 | /// Used to map a string name to a given resource model. This attribute
7 | /// specifies a name used to identity the resource to clients consuming
8 | /// the REST Api.
9 | ///
10 | [AttributeUsage(AttributeTargets.Class)]
11 | public class ResourceAttribute : Attribute
12 | {
13 | public string ResourceName { get; }
14 |
15 | public ResourceAttribute(string resourceName)
16 | {
17 | if (string.IsNullOrWhiteSpace(resourceName))
18 | throw new ArgumentException("Resource name not specified.", nameof(resourceName));
19 |
20 | ResourceName = resourceName;
21 | }
22 | }
--------------------------------------------------------------------------------
/netfusion/src/Common/NetFusion.Common.Base/Entity/IAttributedEntity.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace NetFusion.Common.Base.Entity;
4 |
5 | ///
6 | /// Identifies an entity having a set of key/value attributes that
7 | /// can be accessed dynamically at runtime.
8 | ///
9 | public interface IAttributedEntity
10 | {
11 | ///
12 | /// Reference to object used to manage an entity's dynamic attributes.
13 | ///
14 | IEntityAttributes Attributes { get; }
15 |
16 | ///
17 | /// A dictionary of the key value pairs associated with the entity
18 | /// in which the dynamic properties are stored.
19 | ///
20 | IDictionary AttributeValues { get; set; }
21 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging.UnitTests/DomainEvents/Mocks/DomainEvents.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Messaging.Types;
2 |
3 | namespace NetFusion.Messaging.UnitTests.DomainEvents.Mocks;
4 |
5 | // --------------------- [Domain Events] ---------------------
6 |
7 | public class MockDomainEvent : DomainEvent
8 | {
9 | public List ThrowInHandlers { get; } = new();
10 | }
11 |
12 | public class MockDomainEventTwo : DomainEvent;
13 |
14 | // ------------------- [Derived Domain Events] ------------------
15 |
16 | public class MockBaseDomainEvent : DomainEvent;
17 |
18 | public class MockDerivedDomainEvent : MockBaseDomainEvent;
19 |
20 | public class MockRuleDomainEvent : DomainEvent
21 | {
22 | public int RuleTestValue { get; set; } = -1;
23 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Common/NetFusion.Web.Common.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | latest
6 | enable
7 |
8 |
9 |
10 |
11 |
12 | NetFusion.Web.Common
13 | NetFusion REST Shared Implementations
14 | Contains implementations shared between the client and server.
15 | netfusion;plugin;rest;hal;http;client;
16 |
17 |
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.Bus/IBusRouter.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Core.Bootstrap.Plugins;
2 | using NetFusion.Integration.Bus.Entities;
3 |
4 | namespace NetFusion.Integration.Bus;
5 |
6 | ///
7 | /// Responsible for defining the service-bus related entities
8 | /// and how messages are routed.
9 | ///
10 | public interface IBusRouter : IPluginKnownType
11 | {
12 | ///
13 | /// The name of the service-bus to which the entities are associated.
14 | ///
15 | public string BusName { get; }
16 |
17 | ///
18 | /// Returns the entities associated with the service-bus.
19 | ///
20 | /// List of bus entities.
21 | IEnumerable GetBusEntities();
22 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.Redis/Plugin/Modules/RedisModule.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using NetFusion.Core.Bootstrap.Plugins;
3 | using NetFusion.Integration.Redis.Internal;
4 | using NetFusion.Integration.Redis.Subscriber;
5 |
6 | namespace NetFusion.Integration.Redis.Plugin.Modules
7 | {
8 | ///
9 | /// Module containing additional Redis component registrations.
10 | ///
11 | public class RedisModule : PluginModule
12 | {
13 | public override void RegisterServices(IServiceCollection services)
14 | {
15 | services.AddSingleton();
16 | services.AddSingleton();
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Docs/Models/ApiResponseDoc.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.Rest.Docs.Models;
2 |
3 | ///
4 | /// Model representing the status code returned from a Web Api method a
5 | /// nd the optional associated response resource.
6 | ///
7 | public class ApiResponseDoc
8 | {
9 | ///
10 | /// The HTTP response status code associated with the response.
11 | ///
12 | public int Status { get; set; }
13 |
14 | ///
15 | /// The documentation associated with the resource that will
16 | /// be returned for the status code. This property will be
17 | /// null if a resource is not returned for the status code.
18 | ///
19 | public ApiResourceDoc ResourceDoc { get; set; }
20 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Docs/Plugin/IDocModule.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Core.Bootstrap.Plugins;
2 | using NetFusion.Web.Rest.Docs.Entities;
3 | using NetFusion.Web.Rest.Docs.Plugin.Configs;
4 |
5 | namespace NetFusion.Web.Rest.Docs.Plugin;
6 |
7 | ///
8 | /// Plugin module responsible for configuring and registering
9 | /// services required to provide REST Api documentation.
10 | ///
11 | public interface IDocModule : IPluginModuleService
12 | {
13 | ///
14 | /// Reference to the REST Documentation configuration settings.
15 | ///
16 | RestDocConfig RestDocConfig { get; }
17 |
18 | ///
19 | /// Reference to HAL specific comments.
20 | ///
21 | HalComments HalComments { get; }
22 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.Redis/Subscriber/ChannelSubscriberEntity.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Integration.Bus.Entities;
2 | using NetFusion.Integration.Redis.Subscriber.Strategies;
3 | using NetFusion.Messaging.Internal;
4 |
5 | namespace NetFusion.Integration.Redis.Subscriber;
6 |
7 | public class ChannelSubscriberEntity : BusEntity
8 | {
9 | public MessageDispatcher Dispatcher { get; }
10 |
11 | public ChannelSubscriberEntity(string busName, string channelName, MessageDispatcher dispatcher) :
12 | base(busName, channelName)
13 | {
14 | Dispatcher = dispatcher;
15 |
16 | AddStrategies(new ChannelSubscriberStrategy(this));
17 | }
18 |
19 | public override IEnumerable Dispatchers => new[] { Dispatcher };
20 | }
--------------------------------------------------------------------------------
/netfusion/src/Core/NetFusion.Core.Bootstrap/Health/HealthCheckResultType.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Core.Bootstrap.Health;
2 |
3 | ///
4 | /// Indicates the health status for specific items used in determining
5 | /// the overall status of the composite-application.
6 | ///
7 | public enum HealthCheckStatusType
8 | {
9 | ///
10 | /// All plugins are operational.
11 | ///
12 | Healthy = 1,
13 |
14 | ///
15 | /// Contains plugins that are not operational but can till process submitted requests.
16 | ///
17 | Degraded = 2,
18 |
19 | ///
20 | /// Plugins required to provide the application's core functionality are not operational.
21 | ///
22 | Unhealthy = 3
23 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Docs/Core/Descriptions/IEmbeddedDescription.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Rest.Docs.Models;
2 |
3 | namespace NetFusion.Web.Rest.Docs.Core.Descriptions;
4 |
5 | ///
6 | /// Interface implemented by a class responsible for describing
7 | /// an embedded resource returned by a controller's action method.
8 | ///
9 | public interface IEmbeddedDescription : IDocDescription
10 | {
11 | ///
12 | /// Adds documentation to an embedded document.
13 | ///
14 | /// The embedded documentation model to describe.
15 | /// The attribute from which the embedded document was created.
16 | void Describe(ApiEmbeddedDoc embeddedDoc, EmbeddedResourceAttribute attribute);
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging.Types/Contracts/IMessageWithResult.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging.Types.Contracts;
2 |
3 | ///
4 | /// Interface used internally to access and set the result of a message.
5 | ///
6 | public interface IMessageWithResult
7 | {
8 | ///
9 | /// The optional result of the command.
10 | ///
11 | object? MessageResult { get; set; }
12 |
13 | ///
14 | /// The type of the result associated with the command.
15 | ///
16 | Type DeclaredResultType { get; }
17 |
18 | ///
19 | /// Sets the optional result associated with the message.
20 | ///
21 | /// Associated result.
22 | void SetResult(object? result);
23 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Docs/Core/Descriptions/IActionDescription.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Metadata;
2 | using NetFusion.Web.Rest.Docs.Models;
3 |
4 | namespace NetFusion.Web.Rest.Docs.Core.Descriptions;
5 |
6 | ///
7 | /// Interface implemented by a class responsible for describing
8 | /// a controller's action method.
9 | ///
10 | public interface IActionDescription : IDocDescription
11 | {
12 | ///
13 | /// Called to add descriptions to the specified action document.
14 | ///
15 | /// The action document to describe.
16 | /// The associated action metadata used
17 | /// to query related information.
18 | void Describe(ApiActionDoc actionDoc, ApiActionMeta actionMeta);
19 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Docs/Entities/RelationComment.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.Rest.Docs.Entities;
2 |
3 | ///
4 | /// Comments associated with a resource's linked relation.
5 | ///
6 | public class RelationComment
7 | {
8 | ///
9 | /// The name of the relation specified when adding a link to a resource.
10 | ///
11 | public string RelationName { get; set; }
12 |
13 | ///
14 | /// The optional resource name identifying the resource containing the named relation.
15 | ///
16 | public string ResourceName { get; set; }
17 |
18 | ///
19 | /// The comments describing how the relation applies to the resource.
20 | ///
21 | public string Comments { get; set; }
22 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.RabbitMQ/Plugin/Settings/HostSettings.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 |
3 | namespace NetFusion.Integration.RabbitMQ.Plugin.Settings
4 | {
5 | ///
6 | /// Settings for a host associated with a specific bus connection.
7 | ///
8 | public class HostSettings
9 | {
10 | ///
11 | /// The name of the host computer running RabbitMQ.
12 | ///
13 | [Required(AllowEmptyStrings = false, ErrorMessage = "HostName Required")]
14 | public string HostName { get; set; } = string.Empty;
15 |
16 | ///
17 | /// The connection port to use. Defaults to 5672.
18 | ///
19 | public ushort Port { get; set; } = 5672;
20 | }
21 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging/IntegrationTypes.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging;
2 |
3 | ///
4 | /// Determines the scope to which a given message publisher
5 | /// sends domain events to interested subscribers.
6 | ///
7 | public enum IntegrationTypes
8 | {
9 | ///
10 | /// Used to specify all integration types apply.
11 | ///
12 | All = 0,
13 |
14 | ///
15 | /// The publisher dispatches the event to subscribers located
16 | /// within the same process as the publisher.
17 | ///
18 | Internal = 1,
19 |
20 | ///
21 | /// The publisher dispatches the event to subscribers located
22 | /// external to the publisher via a central message bus.
23 | ///
24 | External = 2
25 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/DocGeneration/Server/TestResponseModels.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Rest.Resources;
2 |
3 | namespace NetFusion.Web.UnitTests.Rest.DocGeneration.Server;
4 |
5 | public class TestResponseModel;
6 |
7 | public class TestCreatedResponseModel;
8 |
9 | [Resource("api.sample.model")]
10 | public class ModelWithExposedName;
11 |
12 | public class ModelWithoutExposedName;
13 |
14 | [Resource("api.root.model")]
15 | public class RootResponseModel;
16 |
17 | [Resource("api.embedded.model")]
18 | public class EmbeddedChildModel;
19 |
20 | public class ModelWithResourceLinks
21 | {
22 | public string ModelId { get; set; }
23 | public int VersionNumber { get; set; }
24 | }
25 |
26 | public class EmbeddedModelWithResourceLinks
27 | {
28 | public string ModelId { get; set; }
29 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Docs/Plugin/RestDocExtensions.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Builder;
2 |
3 | namespace NetFusion.Web.Rest.Docs.Plugin;
4 |
5 | ///
6 | /// Application builder configuration extensions.
7 | ///
8 | public static class RestDocExtensions
9 | {
10 | ///
11 | /// Adds the middleware exposing an endpoint used to query WebApi documentation.
12 | ///
13 | /// The builder to be configured.
14 | /// Reference to the builder.
15 | public static IApplicationBuilder UseRestDocs(this IApplicationBuilder builder)
16 | {
17 | System.ArgumentNullException.ThrowIfNull(builder);
18 |
19 | builder.UseMiddleware();
20 | return builder;
21 | }
22 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.ServiceBus/IQueueResponseService.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Integration.ServiceBus;
2 |
3 | ///
4 | /// Service allowing a correlated reply to a previously received message.
5 | ///
6 | public interface IQueueResponseService
7 | {
8 | ///
9 | /// Sends a response to the originating request. An exception is thrown if the message
10 | /// properties are missing any values required from the original sender to correlate the
11 | /// response.
12 | ///
13 | /// The command originally received.
14 | /// The response corresponding to the request.
15 | /// Future Result
16 | Task RespondToSenderAsync(ICommand command, ICommand response);
17 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web/Metadata/ApiResponseMeta.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetFusion.Web.Metadata;
4 |
5 | ///
6 | /// Information about a WebApi method response.
7 | ///
8 | public class ApiResponseMeta
9 | {
10 | ///
11 | /// The HTTP status code associated with the response.
12 | ///
13 | public int Status { get; }
14 |
15 | ///
16 | /// The optional model type associated with the HTTP status code.
17 | ///
18 | public Type? ModelType { get; set; }
19 |
20 | public ApiResponseMeta(int status, Type modelType)
21 | {
22 | ArgumentNullException.ThrowIfNull(modelType);
23 |
24 | Status = status;
25 | ModelType = modelType == typeof(void) ? null : modelType;
26 | }
27 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging.Types/Contracts/ICommand.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging.Types.Contracts;
2 |
3 | ///
4 | /// Represents a message that can have one and only one consumer. A command expresses
5 | /// an action that is to take place resulting in a change to an application's state.
6 | ///
7 | public interface ICommand : IMessage;
8 |
9 | ///
10 | /// Represents a message that can have one and only one consumer. The handling consumer
11 | /// can associate a result after processing the message. This type of message tells the
12 | /// consumer to take an action.
13 | ///
14 | /// The response set by the consumer that processed the message.
15 | public interface ICommand : ICommand
16 | {
17 | TResult Result { get; set; }
18 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Docs/Core/Descriptions/IResponseDescription.cs:
--------------------------------------------------------------------------------
1 | using NetFusion.Web.Metadata;
2 | using NetFusion.Web.Rest.Docs.Models;
3 |
4 | namespace NetFusion.Web.Rest.Docs.Core.Descriptions;
5 |
6 | ///
7 | /// Interface implemented by a class responsible for describing
8 | /// a controller's action responses.
9 | ///
10 | public interface IResponseDescription : IDocDescription
11 | {
12 | ///
13 | /// Called to add documentation to the response document model.
14 | ///
15 | /// The response document to describe.
16 | /// The associated document metadata from which
17 | /// the document model was created.
18 | void Describe(ApiResponseDoc responseDoc, ApiResponseMeta responseMeta);
19 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.UnitTests/Rest/Setup/NullUnitTestService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Microsoft.AspNetCore.Http;
4 | using NetFusion.Web.Rest.Resources;
5 | using NetFusion.Web.UnitTests.Mocks;
6 | using NetFusion.Web.UnitTests.Rest.ClientRequests.Server;
7 |
8 | namespace NetFusion.Web.UnitTests.Rest.Setup;
9 |
10 | public class NullUnitTestService : IMockedService
11 | {
12 | public IEnumerable Customers { get; set; } = Array.Empty();
13 |
14 | public HalResource ServerReceivedResource { get; set; }
15 |
16 | public bool TriggerServerSideException { get; set; } = false;
17 | public int ReturnsStatusCode { get; set; } = StatusCodes.Status200OK;
18 |
19 | public IEnumerable GetResources()
20 | {
21 | return new T[] { };
22 | }
23 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.Integration.Redis/Internal/RedisLogTextWriter.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using Microsoft.Extensions.Logging;
3 |
4 | namespace NetFusion.Integration.Redis.Internal
5 | {
6 | ///
7 | /// Implementation that writes Redis connection logs to
8 | /// the configured logger.
9 | ///
10 | public class RedisLogTextWriter(ILogger logger) : TextWriter
11 | {
12 | private readonly ILogger _logger = logger ?? throw new ArgumentNullException(nameof(logger));
13 | public override Encoding Encoding { get; } = Encoding.UTF8;
14 |
15 | public override void Write(string? value)
16 | {
17 | if (! string.IsNullOrWhiteSpace(value))
18 | {
19 | _logger.LogTrace("Redis Log: {Message}", value);
20 | }
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/netfusion/src/Web/NetFusion.Web.Rest.Docs/Models/ApiRelationDoc.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Web.Rest.Docs.Models;
2 |
3 | ///
4 | /// Model containing a linked relation associated with a resource.
5 | ///
6 | public class ApiRelationDoc
7 | {
8 | ///
9 | /// The name of the relation.
10 | ///
11 | public string Name { get; set; }
12 |
13 | ///
14 | /// The method used to invoke the action associated with the relation.
15 | ///
16 | public string Method { get; set; }
17 |
18 | ///
19 | /// The Url used to invoke the action associated with the relation.
20 | ///
21 | public string HRef { get; set; }
22 |
23 | ///
24 | /// Description of the relation.
25 | ///
26 | public string Description { get; set; }
27 | }
--------------------------------------------------------------------------------
/netfusion/src/Integration/NetFusion.AMQP/Subscriber/HostAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetFusion.AMQP.Subscriber
4 | {
5 | ///
6 | /// Attribute specified on a class implementing the IMessageConsumer marker
7 | /// interface used to specify the Amqp host configuration defined in the
8 | /// application's configuration settings.
9 | ///
10 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
11 | public class HostAttribute : Attribute
12 | {
13 | ///
14 | /// The name of the host specified within the application's settings.
15 | ///
16 | public string HostName { get; }
17 |
18 | public HostAttribute(string hostName)
19 | {
20 | HostName = hostName ?? throw new ArgumentNullException(nameof(hostName));
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/netfusion/src/Messaging/NetFusion.Messaging/IMessageDispatcherService.cs:
--------------------------------------------------------------------------------
1 | namespace NetFusion.Messaging;
2 |
3 | public interface IMessageDispatcherService
4 | {
5 | ///
6 | /// Service used to dispatch messages that are received outside of the
7 | /// scope associated with a given web request such as a message received
8 | /// from a message bus.
9 | ///
10 | /// The dispatcher to be used to deliver message.
11 | /// The message to be dispatched.
12 | /// The cancellation token.
13 | /// Optional message response.
14 | Task