├── stove.png ├── src ├── Stove │ ├── IMessage.cs │ ├── Events │ │ └── Bus │ │ │ ├── EventHandlerBase.cs │ │ │ ├── EventPublishingBehaviour.cs │ │ │ ├── Entities │ │ │ ├── EntityChangeType.cs │ │ │ ├── Envelope.cs │ │ │ ├── IAggregateChangeEventHelper.cs │ │ │ └── AggregateChangeReport.cs │ │ │ ├── Handlers │ │ │ ├── IEventHandler.cs │ │ │ └── IEventHandler{TEvent}.cs │ │ │ ├── Event.cs │ │ │ ├── IEvent.cs │ │ │ └── Factories │ │ │ └── IEventHandlerFactory.cs │ ├── Commands │ │ ├── Command.cs │ │ ├── CommandContext.cs │ │ ├── SequencedCommand.cs │ │ ├── CommandContextAccessorExtensions.cs │ │ └── CommandContextOptions.cs │ ├── Text │ │ └── Formatting │ │ │ ├── FormatStringTokenType.cs │ │ │ └── FormatStringToken.cs │ ├── MQ │ │ ├── ConsumerBase.cs │ │ └── IMessageBus.cs │ ├── Timing │ │ ├── TimingSettingNames.cs │ │ ├── ClockProviders.cs │ │ ├── IDateTimeRange.cs │ │ └── UnspecifiedClockProvider.cs │ ├── Domain │ │ ├── Uow │ │ │ ├── ConnectionStringResolveArgs.cs │ │ │ ├── ICurrentUnitOfWorkProvider.cs │ │ │ ├── IUnitOfWorkFilterExecuter.cs │ │ │ ├── NullUnitOfWorkFilterExecuter.cs │ │ │ ├── StoveDataFilters.cs │ │ │ ├── IConnectionStringResolver.cs │ │ │ └── UnitOfWorkFailedEventArgs.cs │ │ ├── Repositories │ │ │ ├── IStoveRepositoryBaseWithResolver.cs │ │ │ ├── IRepository.cs │ │ │ └── IRepository{TEntity}.cs │ │ ├── Entities │ │ │ ├── IEntity.cs │ │ │ ├── IPassivable.cs │ │ │ ├── ISoftDelete.cs │ │ │ ├── Auditing │ │ │ │ ├── IHasCreationTime.cs │ │ │ │ ├── IHasDeletionTime.cs │ │ │ │ ├── IHasModificationTime.cs │ │ │ │ ├── IFullAudited.cs │ │ │ │ └── IAudited.cs │ │ │ ├── EntityTypeInfo.cs │ │ │ └── IEntity{TPrimaryKey}.cs │ │ └── Services │ │ │ ├── DomainService.cs │ │ │ └── IDomainService.cs │ ├── Runtime │ │ ├── IAmbientDataContext.cs │ │ ├── Session │ │ │ ├── IPrincipalAccessor.cs │ │ │ ├── SessionOverride.cs │ │ │ ├── DefaultPrincipalAccessor.cs │ │ │ └── NullStoveSession.cs │ │ ├── IAmbientScopeProvider.cs │ │ ├── Security │ │ │ └── StoveClaims.cs │ │ └── Caching │ │ │ ├── CacheManagerExtensions.cs │ │ │ ├── Configuration │ │ │ ├── CacheConfigurator.cs │ │ │ └── ICacheConfigurator.cs │ │ │ ├── TypedCacheExtensions.cs │ │ │ └── Memory │ │ │ └── StoveMemoryCacheManager.cs │ ├── Reflection │ │ ├── ITypeFinder.cs │ │ ├── Extensions │ │ │ └── TypeExtensions.cs │ │ └── IStoveAssemblyFinder.cs │ ├── Bootstrapping │ │ ├── IBootsrapper.cs │ │ ├── IStoveBootstrapperManager.cs │ │ └── DependsOn.cs │ ├── Configuration │ │ ├── IModuleConfigurations.cs │ │ └── ModuleConfigurations.cs │ ├── Extensions │ │ ├── DateTimeExtensions.cs │ │ └── ExceptionExtensions.cs │ ├── Data │ │ ├── ActiveTransactionProviderArgs.cs │ │ └── IActiveTransactionProvider.cs │ ├── Orm │ │ └── ISecondaryOrmRegistrar.cs │ ├── Threading │ │ ├── BackgrodunWorkers │ │ │ ├── IBackgroundWorker.cs │ │ │ └── IBackgroundWorkerManager.cs │ │ ├── RunnableExtensions.cs │ │ ├── IRunnable.cs │ │ ├── RunnableBase.cs │ │ └── Extensions │ │ │ └── TaskExtensions.cs │ ├── IGuidGenerator.cs │ ├── IUserIdentifier.cs │ ├── Utils │ │ ├── Etc │ │ │ └── NullDisposable.cs │ │ └── ExpressionUtils.cs │ ├── Log │ │ ├── IHasLogSeverity.cs │ │ ├── NullLoggerRegistrationExtensions.cs │ │ ├── LogHelper.cs │ │ └── LogSeverity.cs │ ├── Stove.csproj.DotSettings │ ├── Application │ │ └── Services │ │ │ └── IApplicationService.cs │ ├── BackgroundJobs │ │ ├── IBackgroundJob.cs │ │ ├── BackgroundJobConfiguration.cs │ │ ├── IBackgroundJobConfiguration.cs │ │ └── BackgroundJobPriority.cs │ ├── RegularGuidGenerator.cs │ ├── Linq │ │ ├── IAsyncQueryableExecuter.cs │ │ └── NullAsyncQueryableExecuter.cs │ ├── IO │ │ ├── Extensions │ │ │ └── StreamExtensions.cs │ │ ├── DeleteIfExists.cs │ │ └── DirectoryHelper.cs │ └── ObjectMapping │ │ └── NullObjectMapper.cs ├── Stove.EntityFrameworkCore │ └── EntityFrameworkCore │ │ ├── Configuration │ │ ├── IStoveEfCoreConfiguration.cs │ │ ├── IStoveDbContextConfigurer.cs │ │ ├── StoveEfCoreConfiguration.cs │ │ ├── StoveAspNetCoreConfigurationExtensions.cs │ │ ├── StoveDbContextConfigurerAction.cs │ │ └── StoveDbContextConfiguration.cs │ │ ├── Repositories │ │ ├── IRepositoryWithDbContext.cs │ │ ├── EfCoreRepositoryBase{TEntity}.cs │ │ ├── EfCoreAutoRepositoryTypes.cs │ │ └── EfCoreRepositoryExtensions.cs │ │ ├── IDbContextProvider.cs │ │ ├── IDbContextResolver.cs │ │ ├── DbContextTypeMatcher.cs │ │ ├── DatabaseFacadeExtensions.cs │ │ ├── SimpleDbContextProvider.cs │ │ ├── Uow │ │ ├── IEfCoreTransactionStrategy.cs │ │ └── ActiveTransactionInfo.cs │ │ ├── Extensions │ │ └── DbContextExtensions.cs │ │ ├── Utils │ │ └── EntityDateTimePropertiesInfo.cs │ │ └── StoveEfCoreServiceCollectionExtensions.cs ├── Stove.Couchbase │ └── Couchbase │ │ ├── ISessionProvider.cs │ │ ├── Configuration │ │ ├── IStoveCouchbaseConfiguration.cs │ │ ├── StoveCouchbaseConfigurationExtensions.cs │ │ └── StoveCouchbaseConfiguration.cs │ │ ├── Filters │ │ └── Action │ │ │ └── ICouchbaseActionFilterExecuter.cs │ │ ├── StoveCouchbaseBootstrapper.cs │ │ └── Uow │ │ ├── UnitOfWorkSessionProvider.cs │ │ └── UnitOfWorkExtensions.cs ├── Stove.RavenDB │ └── RavenDB │ │ ├── ISessionProvider.cs │ │ ├── Configuration │ │ ├── IStoveRavenDBConfiguration.cs │ │ ├── StoveRavenDBConfigurationExtensions.cs │ │ └── StoveRavenDBConfiguration.cs │ │ ├── Filters │ │ ├── Query │ │ │ ├── IRavenQueryFilterExecuter.cs │ │ │ ├── IRavenQueryFilter.cs │ │ │ └── NullRavenQueryFilterExecuter.cs │ │ └── Action │ │ │ ├── IRavenActionFilterExecuter.cs │ │ │ └── NullRavenActionFilterExecuter.cs │ │ ├── Repositories │ │ └── RavenDBRepositoryBase{TEntity}.cs │ │ ├── Uow │ │ ├── UnitOfWorkSessionProvider.cs │ │ └── UnitOfWorkExtensions.cs │ │ └── StoveRavenDBBootstrapper.cs ├── Stove.NHibernate │ └── NHibernate │ │ ├── Repositories │ │ ├── IRepositoryWithSession.cs │ │ └── NhRepositoryBase{TEntity,TPrimaryKey}.cs │ │ ├── Enrichments │ │ ├── ISessionProvider.cs │ │ ├── ISessionFactoryProvider.cs │ │ ├── IStoveSessionSet.cs │ │ ├── NhAutoRepositoryTypes.cs │ │ └── StoveSessionContext.cs │ │ ├── Configuration │ │ └── StoveNHibernateConfigurationExtensions.cs │ │ ├── SessionExtensions.cs │ │ ├── EntityMappings │ │ └── EntityMap{TEntity}.cs │ │ └── Uow │ │ └── UnitOfWorkExtensions.cs ├── Stove.EntityFramework │ └── EntityFramework │ │ ├── Repositories │ │ ├── IRepositoryWithDbContext.cs │ │ ├── EfRepositoryBase{TEntity}.cs │ │ └── EfAutoRepositoryTypes.cs │ │ ├── Uow │ │ ├── IEfUnitOfWorkFilterExecuter.cs │ │ ├── IEfTransactionStrategy.cs │ │ ├── ActiveDbContextInfo.cs │ │ ├── ActiveTransactionInfo.cs │ │ └── UnitOfWorkExtensions.cs │ │ ├── DbContextTypeMatcher.cs │ │ ├── IDbContextResolver.cs │ │ ├── IDbContextProvider.cs │ │ ├── SimpleDbContextProvider.cs │ │ ├── Utils │ │ └── EntityDateTimePropertiesInfo.cs │ │ └── StoveEntityFrameworkBootstrapper.cs ├── Stove.Serilog │ └── Serilog │ │ └── StoveSerilogBootstrapper.cs ├── Stove.NLog │ └── NLog │ │ └── StoveNLogBootstrapper.cs ├── Stove.Dapper │ └── Dapper │ │ ├── Repositories │ │ ├── IDapperRepository{TEntity}.cs │ │ ├── DapperEfRepositoryBase{TDbContext,TEntity}.cs │ │ └── DapperNhRepositoryBase{TStoveSessionContext,TEntity}.cs │ │ ├── StoveDapperBootstrapper.cs │ │ ├── Filters │ │ ├── Query │ │ │ ├── IDapperQueryFilterExecuter.cs │ │ │ ├── IDapperQueryFilter.cs │ │ │ └── NullDapperQueryFilterExecuter.cs │ │ └── Action │ │ │ ├── IDapperActionFilterExecuter.cs │ │ │ └── NullDapperActionFilterExecuter.cs │ │ ├── NhBasedDapperAutoRepositoryTypes.cs │ │ ├── EfBasedDapperAutoRepositoryTypes.cs │ │ └── DapperAutoRepositoryTypeAttribute.cs ├── Stove.EntityFramework.Common │ ├── IDbContextTypeMatcher.cs │ ├── StoveEntityFrameworkCommonBootstrapper.cs │ ├── DefaultDbContextAttribute.cs │ └── IDbContextEntityFinder.cs ├── Stove.Mapster │ └── Mapster │ │ ├── IStoveMapsterConfiguration.cs │ │ ├── AutoMapAttributeBase.cs │ │ ├── MapsterConfigurationExtensions.cs │ │ ├── StoveMapsterConfigurationExtensions.cs │ │ └── StoveMapsterConfiguration.cs ├── Stove.Redis │ └── Redis │ │ ├── Configurations │ │ ├── IStoveRedisCacheConfiguration.cs │ │ └── StoveRedisCacheConfiguration.cs │ │ ├── IStoveRedisCacheDatabaseProvider.cs │ │ └── StoveRedisBootstrapper.cs ├── Stove.HangFire │ └── Hangfire │ │ ├── Configurations │ │ ├── IStoveHangfireConfiguration.cs │ │ ├── StoveHangFireConfiguration.cs │ │ └── StoveHangfireConfigurationExtensions.cs │ │ └── GlobalConfigurationExtensions.cs └── Stove.RabbitMQ │ └── RabbitMQ │ ├── IStoveRabbitMQConfiguration.cs │ └── StoveRabbitMQConfigurationExtensions.cs ├── test ├── Stove.Demo.ConsoleApp │ ├── Db │ │ ├── Stove.mdf │ │ └── Stove_log.ldf │ ├── DemoCacheName.cs │ ├── BackgroundJobs │ │ ├── ISimpleDependency.cs │ │ ├── SimpleDependency.cs │ │ └── SimpleBackgroundJobArgs.cs │ ├── Dto │ │ ├── PersonDto.cs │ │ ├── StorefrontProductCurrencyDto.cs │ │ ├── PersonAnimalDto.cs │ │ └── StorefrontProductPriceDto.cs │ ├── Entities │ │ ├── PersonAnimal.cs │ │ ├── Mappings │ │ │ └── Dapper │ │ │ │ ├── MailMap.cs │ │ │ │ ├── AnimalMap.cs │ │ │ │ ├── PersonMap.cs │ │ │ │ └── ProductMap.cs │ │ ├── Animal.cs │ │ ├── Person.cs │ │ ├── Product.cs │ │ └── Mail.cs │ ├── RabbitMQ │ │ └── Messages │ │ │ └── PersonAddedMessage.cs │ ├── SomeRegistrationExtensions.cs │ ├── ConnectionStringHelper.cs │ └── DbContexes │ │ ├── AnimalDbContext.cs │ │ └── PriceDbContext.cs ├── Stove.Demo.WebApi │ ├── Dtos │ │ ├── AddProductInput.cs │ │ └── AddProductOutput.cs │ ├── AppServices │ │ └── IProductAppService.cs │ ├── Entities │ │ └── Product.cs │ ├── StoveDemoWebApiBootstapper.cs │ ├── Program.cs │ ├── Controllers │ │ ├── ProductController.cs │ │ └── HelpController.cs │ ├── DomainServices │ │ └── ProductDomainService.cs │ └── DbContexts │ │ └── StoveDemoDbContext.cs ├── Stove.Tests │ ├── Domain │ │ └── Entities │ │ │ ├── Manager.cs │ │ │ ├── Worker.cs │ │ │ ├── Department.cs │ │ │ └── EntityHelper_Tests.cs │ ├── Events │ │ └── Bus │ │ │ ├── MyDerivedEvent.cs │ │ │ ├── MySimpleEvent.cs │ │ │ ├── EventBusTestBase.cs │ │ │ ├── MySimpleTransientEventHandler.cs │ │ │ └── TransientDisposableEventHandlerTest.cs │ ├── Json │ │ └── JsonExtensions_Tests.cs │ ├── Utils │ │ └── Etc │ │ │ └── NullDisposableTests.cs │ ├── IO │ │ └── Extensions │ │ │ └── StreamExtensions_Tests.cs │ ├── Threading │ │ ├── AsyncHelper_Tests.cs │ │ └── LockExtensions_Tests.cs │ ├── DisposeAction_Tests.cs │ └── Collections │ │ └── TypeList_Tests.cs ├── Stove.RabbitMQ.Tests │ ├── Contracts │ │ ├── IOrderPlacedEvent.cs │ │ └── OrderPlacedEvent.cs │ ├── RabbitMQTestBootstrapper.cs │ └── Consumers │ │ └── OrderPlacedConsumer.cs ├── Stove.Demo.WebApiCore │ ├── StoveWebApiCoreBootstrapper.cs │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── Program.cs │ ├── Stove.Demo.WebApiCore.csproj │ └── Properties │ │ └── launchSettings.json ├── Stove.Tests.SampleApplication │ ├── Dtos │ │ ├── PersonDto.cs │ │ ├── Person.cs │ │ └── UserDto.cs │ ├── Domain │ │ ├── Events │ │ │ └── CampaignCreatedEvent.cs │ │ ├── Entities │ │ │ ├── Gender.cs │ │ │ ├── Category.cs │ │ │ ├── Brand.cs │ │ │ ├── Campaign.cs │ │ │ ├── Message.cs │ │ │ ├── ProductDetail.cs │ │ │ ├── ProductBrand.cs │ │ │ ├── ProductGender.cs │ │ │ └── ProductCategory.cs │ │ └── Mapping │ │ │ └── ProductBundleMap.cs │ └── SampleApplicationBootstrapper.cs ├── Stove.Serilog.Tests │ ├── StoveSerilogTestBootstrapper.cs │ ├── Serilog_Tests.cs │ └── SerilogTestBase.cs ├── Stove.NLog.Tests │ ├── StoveNLogTestBootstrapper.cs │ ├── NLog_Tests.cs │ └── NLogTestBase.cs ├── Stove.RavenDB.Tests │ ├── RavenDBTestBootstrapper.cs │ ├── Entities │ │ ├── Product.cs │ │ └── Order.cs │ └── Stove.RavenDB.Tests.csproj ├── Stove.Redis.Tests │ ├── StoveRedisTestBootstrapper.cs │ ├── RedisTestBase.cs │ └── StoveRedis_Test.cs ├── Stove.Couchbase.Tests │ ├── CouchbaseTestBootstrapper.cs │ ├── Stove.Couchbase.Tests.csproj │ └── Entities │ │ └── Product.cs ├── Stove.EntityFrameworkCore.Tests │ ├── Ef │ │ ├── IPostRepository.cs │ │ ├── BloggingDbContext.cs │ │ ├── PostRepository.cs │ │ └── ProductDbContext.cs │ ├── Domain │ │ ├── Events │ │ │ └── BlogCreatedEvent.cs │ │ ├── BlogUrlChangedEvent.cs │ │ ├── Ticket.cs │ │ └── Post.cs │ ├── Domain_Product │ │ ├── Events │ │ │ ├── VariantValueAdded.cs │ │ │ └── VariantAdded.cs │ │ └── VariantValue.cs │ └── EntityFrameworkCoreTestBootstrapper.cs ├── Stove.EntityFrameworkCore.Dapper.Tests │ ├── Ef │ │ ├── IPostRepository.cs │ │ ├── BloggingDbContext.cs │ │ └── PostRepository.cs │ ├── Domain │ │ ├── Events │ │ │ └── BlogCreatedEvent.cs │ │ ├── BlogUrlChangedEvent.cs │ │ └── Comment.cs │ └── Dapper │ │ ├── BlogMap.cs │ │ ├── CommentMap.cs │ │ └── PostMap.cs ├── Stove.Demo.ConsoleApp.RavenDB │ ├── StoveRavenDBDemoBootstrapper.cs │ ├── Product.cs │ └── Stove.Demo.ConsoleApp.RavenDB.csproj ├── Stove.Dapper.Tests │ ├── CustomRepositories │ │ ├── IMailRepository.cs │ │ └── MailRepository.cs │ ├── Mappings │ │ ├── MailMap.cs │ │ ├── ProductMap.cs │ │ └── ProductDetailMap.cs │ ├── Entities │ │ ├── Product.cs │ │ ├── Mail.cs │ │ └── ProductDetail.cs │ └── Scripts │ │ └── DestroyScript.sql ├── Stove.NHibernate.Tests │ ├── Sessions │ │ ├── PrimaryStoveSessionContext.cs │ │ └── SecondaryStoveSessionContext.cs │ ├── Entities │ │ ├── Events │ │ │ ├── ProductNameFixed.cs │ │ │ ├── ProductCreatedEvent.cs │ │ │ └── ProductDeletedEvent.cs │ │ ├── ProductMap.cs │ │ ├── CategoryMap.cs │ │ ├── ProductDapperMap.cs │ │ └── Category.cs │ └── SessionFactory_Tests.cs ├── Stove.Demo.ConsoleApp.Nh │ ├── SessionContexts │ │ ├── PrimarySessionContext.cs │ │ └── SecondarySessionContext.cs │ ├── Mappings │ │ ├── Nh │ │ │ ├── ProductMap.cs │ │ │ └── CategoryMap.cs │ │ └── Dapper │ │ │ ├── ProductMap.cs │ │ │ └── CategoryMap.cs │ └── Entities │ │ ├── Product.cs │ │ └── Category.cs ├── Stove.Mapster.Tests │ ├── StoveMapsterTestBootstrapper.cs │ └── StoveMapsterTestApplication.cs └── Stove.Hangfire.Tests │ ├── SimpleJob.cs │ └── HangfireApplicationTestBase.cs └── appveyor.yml /stove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoveproject/Stove/HEAD/stove.png -------------------------------------------------------------------------------- /src/Stove/IMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Stove 2 | { 3 | public interface IMessage 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Db/Stove.mdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoveproject/Stove/HEAD/test/Stove.Demo.ConsoleApp/Db/Stove.mdf -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Db/Stove_log.ldf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoveproject/Stove/HEAD/test/Stove.Demo.ConsoleApp/Db/Stove_log.ldf -------------------------------------------------------------------------------- /src/Stove/Events/Bus/EventHandlerBase.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Events.Bus 2 | { 3 | public abstract class EventHandlerBase : StoveComponentBase 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/Stove/Events/Bus/EventPublishingBehaviour.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Events.Bus 2 | { 3 | public delegate void EventPublishingBehaviour(IEvent @event, Headers headers); 4 | } 5 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/DemoCacheName.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Demo.ConsoleApp 2 | { 3 | public class DemoCacheName 4 | { 5 | public const string Demo = "Demo"; 6 | } 7 | } -------------------------------------------------------------------------------- /src/Stove/Commands/Command.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Commands 2 | { 3 | public abstract class Command : IMessage 4 | { 5 | public string CorrelationId { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/BackgroundJobs/ISimpleDependency.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Demo.ConsoleApp.BackgroundJobs 2 | { 3 | public interface ISimpleDependency 4 | { 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /test/Stove.Demo.WebApi/Dtos/AddProductInput.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Demo.WebApi.Dtos 2 | { 3 | public class AddProductInput 4 | { 5 | public string Name { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/Stove.Tests/Domain/Entities/Manager.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Tests.Domain.Entities 2 | { 3 | public class Manager : Worker 4 | { 5 | public string Title { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/Stove/Text/Formatting/FormatStringTokenType.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Text.Formatting 2 | { 3 | internal enum FormatStringTokenType 4 | { 5 | ConstantText, 6 | DynamicValue 7 | } 8 | } -------------------------------------------------------------------------------- /src/Stove/MQ/ConsumerBase.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | namespace Stove.MQ 4 | { 5 | public abstract class ConsumerBase : StoveComponentBase, ITransientDependency 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Stove/Timing/TimingSettingNames.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Timing 2 | { 3 | public static class TimingSettingNames 4 | { 5 | public const string TimeZone = "Stove.Timing.TimeZone"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Stove/Events/Bus/Entities/EntityChangeType.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Events.Bus.Entities 2 | { 3 | public enum EntityChangeType 4 | { 5 | Created, 6 | Updated, 7 | Deleted 8 | } 9 | } -------------------------------------------------------------------------------- /test/Stove.RabbitMQ.Tests/Contracts/IOrderPlacedEvent.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.RabbitMQ.Tests.Contracts 2 | { 3 | public interface IOrderPlacedEvent 4 | { 5 | int OrderId { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/Configuration/IStoveEfCoreConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.EntityFrameworkCore.Configuration 2 | { 3 | public interface IStoveEfCoreConfiguration 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/Stove.Tests/Domain/Entities/Worker.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | 3 | namespace Stove.Tests.Domain.Entities 4 | { 5 | public class Worker : Entity 6 | { 7 | public string Name { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/Stove.Couchbase/Couchbase/ISessionProvider.cs: -------------------------------------------------------------------------------- 1 | using Couchbase.Linq; 2 | 3 | namespace Stove.Couchbase 4 | { 5 | public interface ISessionProvider 6 | { 7 | IBucketContext Session { get; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Stove/Domain/Uow/ConnectionStringResolveArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Stove.Domain.Uow 4 | { 5 | public class ConnectionStringResolveArgs : Dictionary 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/Stove.RabbitMQ.Tests/Contracts/OrderPlacedEvent.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.RabbitMQ.Tests.Contracts 2 | { 3 | public class OrderPlacedEvent : IOrderPlacedEvent 4 | { 5 | public int OrderId { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/Stove.Demo.WebApiCore/StoveWebApiCoreBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | 3 | namespace Stove.Demo.WebApiCore 4 | { 5 | public class StoveWebApiCoreBootstrapper : StoveBootstrapper 6 | { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/Dtos/PersonDto.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Tests.SampleApplication.Dtos 2 | { 3 | //[AutoMapTo(typeof(Person))] 4 | public class PersonDto 5 | { 6 | public string Name { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.0.{build} 2 | configuration: Release 3 | image: Visual Studio 2017 4 | pull_requests: 5 | do_not_increment_build_number: true 6 | 7 | build_script: 8 | - ps: .\build.ps1 -experimental 9 | 10 | test: off -------------------------------------------------------------------------------- /src/Stove.RavenDB/RavenDB/ISessionProvider.cs: -------------------------------------------------------------------------------- 1 | using Raven.Client.Documents.Session; 2 | 3 | namespace Stove.RavenDB 4 | { 5 | public interface ISessionProvider 6 | { 7 | IDocumentSession Session { get; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Stove/Runtime/IAmbientDataContext.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Runtime 2 | { 3 | public interface IAmbientDataContext 4 | { 5 | void SetData(string key, object value); 6 | 7 | object GetData(string key); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Stove/Reflection/ITypeFinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Reflection 4 | { 5 | public interface ITypeFinder 6 | { 7 | Type[] Find(Func predicate); 8 | 9 | Type[] FindAll(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Stove/Runtime/Session/IPrincipalAccessor.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | 3 | namespace Stove.Runtime.Session 4 | { 5 | public interface IPrincipalAccessor 6 | { 7 | ClaimsPrincipal Principal { get; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/Stove.Tests/Domain/Entities/Department.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | 3 | namespace Stove.Tests.Domain.Entities 4 | { 5 | public class Department : Entity 6 | { 7 | public string Name { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Stove.NHibernate/NHibernate/Repositories/IRepositoryWithSession.cs: -------------------------------------------------------------------------------- 1 | using NHibernate; 2 | 3 | namespace Stove.NHibernate.Repositories 4 | { 5 | public interface IRepositoryWithSession 6 | { 7 | ISession GetSession(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/BackgroundJobs/SimpleDependency.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | namespace Stove.Demo.ConsoleApp.BackgroundJobs 4 | { 5 | public class SimpleDependency : ISimpleDependency, ITransientDependency 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /test/Stove.Demo.WebApi/Dtos/AddProductOutput.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Demo.WebApi.Dtos 2 | { 3 | public class AddProductOutput 4 | { 5 | public string ProductName { get; set; } 6 | 7 | public int ProductId { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Dto/PersonDto.cs: -------------------------------------------------------------------------------- 1 | using Stove.Demo.ConsoleApp.Entities; 2 | using Stove.Mapster; 3 | 4 | namespace Stove.Demo.ConsoleApp.Dto 5 | { 6 | //[AutoMapFrom(typeof(Person))] 7 | public class PersonDto 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/Stove.Demo.WebApiCore/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/Dtos/Person.cs: -------------------------------------------------------------------------------- 1 | using Stove.Mapster; 2 | 3 | namespace Stove.Tests.SampleApplication.Dtos 4 | { 5 | [AutoMap(typeof(PersonDto))] 6 | public class Person 7 | { 8 | public string Name { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /test/Stove.Tests/Events/Bus/MyDerivedEvent.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Tests.Events.Bus 2 | { 3 | public class MyDerivedEvent : MySimpleEvent 4 | { 5 | public MyDerivedEvent(int value) 6 | : base(value) 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/Stove.EntityFramework/EntityFramework/Repositories/IRepositoryWithDbContext.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity; 2 | 3 | namespace Stove.EntityFramework.Repositories 4 | { 5 | public interface IRepositoryWithDbContext 6 | { 7 | DbContext GetDbContext(); 8 | } 9 | } -------------------------------------------------------------------------------- /src/Stove.Serilog/Serilog/StoveSerilogBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | 3 | namespace Stove.Serilog 4 | { 5 | [DependsOn( 6 | typeof(StoveKernelBootstrapper) 7 | )] 8 | public class StoveSerilogBootstrapper : StoveBootstrapper 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Entities/PersonAnimal.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Demo.ConsoleApp.Entities 2 | { 3 | public class PersonAnimal 4 | { 5 | public string PersonName { get; set; } 6 | 7 | public string AnimalName { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Stove.NLog/NLog/StoveNLogBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | 3 | namespace Stove.NLog 4 | { 5 | [DependsOn( 6 | typeof(StoveKernelBootstrapper) 7 | )] 8 | public class StoveNLogBootstrapper : StoveBootstrapper 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Stove/Bootstrapping/IBootsrapper.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Bootstrapping 2 | { 3 | public interface IBootsrapper 4 | { 5 | void PreStart(); 6 | 7 | void Start(); 8 | 9 | void PostStart(); 10 | 11 | void Shutdown(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/Stove.Demo.WebApi/AppServices/IProductAppService.cs: -------------------------------------------------------------------------------- 1 | using Stove.Demo.WebApi.Dtos; 2 | 3 | namespace Stove.Demo.WebApi.AppServices 4 | { 5 | public interface IProductAppService 6 | { 7 | AddProductOutput AddProduct(AddProductInput input); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Stove.Dapper/Dapper/Repositories/IDapperRepository{TEntity}.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | 3 | namespace Stove.Dapper.Repositories 4 | { 5 | public interface IDapperRepository : IDapperRepository where TEntity : class, IEntity 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Stove.Dapper/Dapper/StoveDapperBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | 3 | namespace Stove.Dapper 4 | { 5 | [DependsOn( 6 | typeof(StoveKernelBootstrapper) 7 | )] 8 | public class StoveDapperBootstrapper : StoveBootstrapper 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/Stove.Serilog.Tests/StoveSerilogTestBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | 3 | namespace Stove.Serilog.Tests 4 | { 5 | [DependsOn( 6 | typeof(StoveSerilogBootstrapper) 7 | )] 8 | public class StoveSerilogTestBootstrapper : StoveBootstrapper 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Stove/Configuration/IModuleConfigurations.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | 3 | namespace Stove.Configuration 4 | { 5 | public interface IModuleConfigurations 6 | { 7 | [NotNull] 8 | IStoveStartupConfiguration StoveConfiguration { get; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Stove/Domain/Repositories/IStoveRepositoryBaseWithResolver.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | namespace Stove.Domain.Repositories 4 | { 5 | public interface IStoveRepositoryBaseWithResolver 6 | { 7 | IScopeResolver ScopeResolver { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Stove/Extensions/DateTimeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Extensions 4 | { 5 | /// 6 | /// Extension methods for . 7 | /// 8 | public static class DateTimeExtensions 9 | { 10 | //... 11 | } 12 | } -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/BackgroundJobs/SimpleBackgroundJobArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Demo.ConsoleApp.BackgroundJobs 4 | { 5 | [Serializable] 6 | public class SimpleBackgroundJobArgs 7 | { 8 | public string Message { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/Stove.NLog.Tests/StoveNLogTestBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | 3 | namespace Stove.NLog.Tests 4 | { 5 | [DependsOn( 6 | typeof(StoveNLogBootstrapper) 7 | )] 8 | public class StoveNLogTestBootstrapper : StoveBootstrapper 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/Domain/Events/CampaignCreatedEvent.cs: -------------------------------------------------------------------------------- 1 | using Stove.Events.Bus; 2 | 3 | namespace Stove.Tests.SampleApplication.Domain.Events 4 | { 5 | public class CampaignCreatedEvent : Event 6 | { 7 | public string Name { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/Repositories/IRepositoryWithDbContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | 3 | namespace Stove.EntityFrameworkCore.Repositories 4 | { 5 | public interface IRepositoryWithDbContext 6 | { 7 | DbContext GetDbContext(); 8 | } 9 | } -------------------------------------------------------------------------------- /test/Stove.RavenDB.Tests/RavenDBTestBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | 3 | namespace Stove.RavenDB.Tests 4 | { 5 | [DependsOn( 6 | typeof(StoveRavenDBBootstrapper) 7 | )] 8 | public class RavenDBTestBootstrapper : StoveBootstrapper 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/Stove.Redis.Tests/StoveRedisTestBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | 3 | namespace Stove.Redis.Tests 4 | { 5 | [DependsOn( 6 | typeof(StoveRedisBootstrapper) 7 | )] 8 | public class StoveRedisTestBootstrapper : StoveBootstrapper 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Stove.NHibernate/NHibernate/Enrichments/ISessionProvider.cs: -------------------------------------------------------------------------------- 1 | using NHibernate; 2 | 3 | namespace Stove.NHibernate.Enrichments 4 | { 5 | public interface ISessionProvider 6 | { 7 | ISession GetSession() where TSessionContext : StoveSessionContext; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework.Common/IDbContextTypeMatcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.EntityFramework 4 | { 5 | public interface IDbContextTypeMatcher 6 | { 7 | void Populate(Type[] dbContextTypes); 8 | 9 | Type GetConcreteType(Type sourceDbContextType); 10 | } 11 | } -------------------------------------------------------------------------------- /src/Stove/Runtime/Session/SessionOverride.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Runtime.Session 2 | { 3 | public class SessionOverride 4 | { 5 | public SessionOverride(long? userId) 6 | { 7 | UserId = userId; 8 | } 9 | 10 | public long? UserId { get; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/Stove.Couchbase.Tests/CouchbaseTestBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | 3 | namespace Stove.Couchbase.Tests 4 | { 5 | [DependsOn( 6 | typeof(StoveCouchbaseBootstrapper) 7 | )] 8 | public class CouchbaseTestBootstrapper : StoveBootstrapper 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/Stove.RabbitMQ.Tests/RabbitMQTestBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | 3 | namespace Stove.RabbitMQ.Tests 4 | { 5 | [DependsOn( 6 | typeof(StoveRabbitMQBootstrapper) 7 | )] 8 | public class RabbitMQTestBootstrapper : StoveBootstrapper 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/IDbContextProvider.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | 3 | namespace Stove.EntityFrameworkCore 4 | { 5 | public interface IDbContextProvider 6 | where TDbContext : DbContext 7 | { 8 | TDbContext GetDbContext(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Stove.Couchbase/Couchbase/Configuration/IStoveCouchbaseConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Couchbase.Configuration.Client; 2 | 3 | namespace Stove.Couchbase.Configuration 4 | { 5 | public interface IStoveCouchbaseConfiguration 6 | { 7 | ClientConfiguration ClientConfiguration { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework.Common/StoveEntityFrameworkCommonBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | 3 | namespace Stove.EntityFramework 4 | { 5 | [DependsOn( 6 | typeof(StoveKernelBootstrapper) 7 | )] 8 | public class StoveEntityFrameworkCommonBootstrapper : StoveBootstrapper 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Stove/Domain/Entities/IEntity.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Domain.Entities 2 | { 3 | /// 4 | /// A shortcut of for most used primary key type (). 5 | /// 6 | public interface IEntity : IEntity 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Stove/Runtime/IAmbientScopeProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Runtime 4 | { 5 | public interface IAmbientScopeProvider 6 | where T : class 7 | { 8 | T GetValue(string contextKey); 9 | 10 | IDisposable BeginScope(string contextKey, T value); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Tests/Ef/IPostRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Stove.Domain.Repositories; 4 | using Stove.EntityFrameworkCore.Tests.Domain; 5 | 6 | namespace Stove.EntityFrameworkCore.Tests.Ef 7 | { 8 | public interface IPostRepository : IRepository 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /test/Stove.Demo.WebApiCore/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "Debug": { 5 | "LogLevel": { 6 | "Default": "Warning" 7 | } 8 | }, 9 | "Console": { 10 | "LogLevel": { 11 | "Default": "Warning" 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework.Common/DefaultDbContextAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.EntityFramework 4 | { 5 | /// 6 | /// Used to mark a DbContext as default for a multi db context project. 7 | /// 8 | public class DefaultDbContextAttribute : Attribute 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Stove/Data/ActiveTransactionProviderArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Stove.Data 4 | { 5 | public class ActiveTransactionProviderArgs : Dictionary 6 | { 7 | public static ActiveTransactionProviderArgs Empty = new ActiveTransactionProviderArgs(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Stove/Orm/ISecondaryOrmRegistrar.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Repositories; 2 | 3 | namespace Stove.Orm 4 | { 5 | public interface ISecondaryOrmRegistrar 6 | { 7 | string OrmContextKey { get; } 8 | 9 | void RegisterRepositories(AutoRepositoryTypesAttribute defaultRepositoryTypes); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Stove/Reflection/Extensions/TypeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace Stove.Reflection.Extensions 5 | { 6 | public static class TypeExtensions 7 | { 8 | public static Assembly GetAssembly(this Type type) 9 | { 10 | return type.GetTypeInfo().Assembly; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Stove/Threading/BackgrodunWorkers/IBackgroundWorker.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Threading.BackgrodunWorkers 2 | { 3 | /// 4 | /// Interface for a worker (thread) that runs on background to perform some tasks. 5 | /// 6 | public interface IBackgroundWorker : IRunnable 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Dapper.Tests/Ef/IPostRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Stove.Domain.Repositories; 4 | using Stove.EntityFrameworkCore.Dapper.Tests.Domain; 5 | 6 | namespace Stove.EntityFrameworkCore.Dapper.Tests.Ef 7 | { 8 | public interface IPostRepository : IRepository 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /src/Stove.EntityFramework.Common/IDbContextEntityFinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Stove.Domain.Entities; 5 | 6 | namespace Stove.EntityFramework 7 | { 8 | public interface IDbContextEntityFinder 9 | { 10 | IEnumerable GetEntityTypeInfos(Type dbContextType); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Stove.NHibernate/NHibernate/Enrichments/ISessionFactoryProvider.cs: -------------------------------------------------------------------------------- 1 | using NHibernate; 2 | 3 | namespace Stove.NHibernate.Enrichments 4 | { 5 | public interface ISessionFactoryProvider 6 | { 7 | ISessionFactory GetSessionFactory() where TStoveSessionContext : StoveSessionContext; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Stove.NHibernate/NHibernate/Enrichments/IStoveSessionSet.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.NHibernate.Enrichments 2 | { 3 | public interface IStoveSessionSet where T : class 4 | { 5 | /// 6 | /// Not used and not implemented anywhere. 7 | /// 8 | T Self { get; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Dto/StorefrontProductCurrencyDto.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Demo.ConsoleApp.Dto 2 | { 3 | public class StorefrontProductCurrencyDto 4 | { 5 | public int ProductId { get; set; } 6 | 7 | public int StorefrontId { get; set; } 8 | 9 | public int CurrencyId { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/Stove.Tests/Events/Bus/MySimpleEvent.cs: -------------------------------------------------------------------------------- 1 | using Stove.Events.Bus; 2 | 3 | namespace Stove.Tests.Events.Bus 4 | { 5 | public class MySimpleEvent : Event 6 | { 7 | public int Value { get; set; } 8 | 9 | public MySimpleEvent(int value) 10 | { 11 | Value = value; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Stove/IGuidGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove 4 | { 5 | /// 6 | /// Used to generate Ids. 7 | /// 8 | public interface IGuidGenerator 9 | { 10 | /// 11 | /// Creates a GUID. 12 | /// 13 | Guid Create(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Stove/IUserIdentifier.cs: -------------------------------------------------------------------------------- 1 | namespace Stove 2 | { 3 | /// 4 | /// Interface to get a user identifier. 5 | /// 6 | public interface IUserIdentifier 7 | { 8 | /// 9 | /// Id of the user. 10 | /// 11 | long UserId { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Stove/Events/Bus/Handlers/IEventHandler.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Events.Bus.Handlers 2 | { 3 | /// 4 | /// Undirect base interface for all event handlers. 5 | /// Implement instead of this one. 6 | /// 7 | public interface IEventHandler 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp.RavenDB/StoveRavenDBDemoBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | using Stove.RavenDB; 3 | 4 | namespace Stove.Demo.ConsoleApp.RavenDB 5 | { 6 | [DependsOn( 7 | typeof(StoveRavenDBBootstrapper) 8 | )] 9 | public class StoveRavenDBDemoBootstrapper : StoveBootstrapper 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Stove/Utils/Etc/NullDisposable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Utils.Etc 4 | { 5 | internal sealed class NullDisposable : IDisposable 6 | { 7 | private NullDisposable() 8 | { 9 | } 10 | 11 | public static NullDisposable Instance { get; } = new NullDisposable(); 12 | 13 | public void Dispose() 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/Stove.Tests/Events/Bus/EventBusTestBase.cs: -------------------------------------------------------------------------------- 1 | using Stove.Events.Bus; 2 | 3 | namespace Stove.Tests.Events.Bus 4 | { 5 | public abstract class EventBusTestBase 6 | { 7 | protected IEventBus EventBus; 8 | 9 | protected EventBusTestBase() 10 | { 11 | EventBus = new EventBus(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /test/Stove.Dapper.Tests/CustomRepositories/IMailRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Stove.Dapper.Repositories; 4 | using Stove.Dapper.Tests.Entities; 5 | 6 | namespace Stove.Dapper.Tests.CustomRepositories 7 | { 8 | public interface IMailRepository : IDapperRepository 9 | { 10 | Mail GetMailById(Guid id); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Stove.RavenDB/RavenDB/Configuration/IStoveRavenDBConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Stove.Configuration; 2 | 3 | namespace Stove.RavenDB.Configuration 4 | { 5 | public interface IStoveRavenDBConfiguration 6 | { 7 | string[] Urls { get; set; } 8 | 9 | string DefaultDatabase { get; set; } 10 | 11 | IStoveStartupConfiguration Configuration { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/Stove.NHibernate.Tests/Sessions/PrimaryStoveSessionContext.cs: -------------------------------------------------------------------------------- 1 | using Stove.NHibernate.Enrichments; 2 | using Stove.NHibernate.Tests.Entities; 3 | 4 | namespace Stove.NHibernate.Tests.Sessions 5 | { 6 | public class PrimaryStoveSessionContext : StoveSessionContext 7 | { 8 | public IStoveSessionSet Products { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/Stove.Tests/Json/JsonExtensions_Tests.cs: -------------------------------------------------------------------------------- 1 | using Shouldly; 2 | 3 | using Stove.Json; 4 | 5 | using Xunit; 6 | 7 | namespace Stove.Tests.Json 8 | { 9 | public class JsonExtensions_Tests 10 | { 11 | [Fact] 12 | public void ToJsonString_Test() 13 | { 14 | 42.ToJsonString().ShouldBe("42"); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework/EntityFramework/Uow/IEfUnitOfWorkFilterExecuter.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity; 2 | 3 | using Stove.Domain.Uow; 4 | 5 | namespace Stove.EntityFramework.Uow 6 | { 7 | public interface IEfUnitOfWorkFilterExecuter : IUnitOfWorkFilterExecuter 8 | { 9 | void ApplyCurrentFilters(IUnitOfWork unitOfWork, DbContext dbContext); 10 | } 11 | } -------------------------------------------------------------------------------- /src/Stove/Events/Bus/Event.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Stove.Timing; 4 | 5 | namespace Stove.Events.Bus 6 | { 7 | [Serializable] 8 | public abstract class Event : IEvent 9 | { 10 | protected Event() 11 | { 12 | EventTime = Clock.Now; 13 | } 14 | 15 | public DateTime EventTime { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/Stove.NHibernate.Tests/Sessions/SecondaryStoveSessionContext.cs: -------------------------------------------------------------------------------- 1 | using Stove.NHibernate.Enrichments; 2 | using Stove.NHibernate.Tests.Entities; 3 | 4 | namespace Stove.NHibernate.Tests.Sessions 5 | { 6 | public class SecondaryStoveSessionContext : StoveSessionContext 7 | { 8 | public IStoveSessionSet Categories { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp.Nh/SessionContexts/PrimarySessionContext.cs: -------------------------------------------------------------------------------- 1 | using Stove.Demo.ConsoleApp.Nh.Entities; 2 | using Stove.NHibernate.Enrichments; 3 | 4 | namespace Stove.Demo.ConsoleApp.Nh.SessionContexts 5 | { 6 | public class PrimarySessionContext : StoveSessionContext 7 | { 8 | public IStoveSessionSet Categories { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Dto/PersonAnimalDto.cs: -------------------------------------------------------------------------------- 1 | using Stove.Demo.ConsoleApp.Entities; 2 | using Stove.Mapster; 3 | 4 | namespace Stove.Demo.ConsoleApp.Dto 5 | { 6 | [AutoMapTo(typeof(PersonAnimal))] 7 | public class PersonAnimalDto 8 | { 9 | public string PersonName { get; set; } 10 | 11 | public string AnimalName { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework/EntityFramework/DbContextTypeMatcher.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Uow; 2 | 3 | namespace Stove.EntityFramework 4 | { 5 | public class DbContextTypeMatcher : DbContextTypeMatcher 6 | { 7 | public DbContextTypeMatcher(ICurrentUnitOfWorkProvider currentUnitOfWorkProvider) 8 | : base(currentUnitOfWorkProvider) 9 | { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/Configuration/IStoveDbContextConfigurer.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | 3 | namespace Stove.EntityFrameworkCore.Configuration 4 | { 5 | public interface IStoveDbContextConfigurer where TDbContext : DbContext 6 | { 7 | void Configure(StoveDbContextConfiguration configuration); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/Stove.NHibernate.Tests/Entities/Events/ProductNameFixed.cs: -------------------------------------------------------------------------------- 1 | using Stove.Events.Bus; 2 | 3 | namespace Stove.NHibernate.Tests.Entities.Events 4 | { 5 | public class ProductNameFixed : Event 6 | { 7 | public readonly string Name; 8 | 9 | public ProductNameFixed(string name) 10 | { 11 | Name = name; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework/EntityFramework/IDbContextResolver.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | 3 | namespace Stove.EntityFramework 4 | { 5 | public interface IDbContextResolver 6 | { 7 | TDbContext Resolve(string connectionString); 8 | 9 | TDbContext Resolve(DbConnection existingConnection, bool contextOwnsConnection); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/Stove.NHibernate.Tests/Entities/Events/ProductCreatedEvent.cs: -------------------------------------------------------------------------------- 1 | using Stove.Events.Bus; 2 | 3 | namespace Stove.NHibernate.Tests.Entities.Events 4 | { 5 | public class ProductCreatedEvent : Event 6 | { 7 | public readonly string Name; 8 | 9 | public ProductCreatedEvent(string name) 10 | { 11 | Name = name; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp.Nh/SessionContexts/SecondarySessionContext.cs: -------------------------------------------------------------------------------- 1 | using Stove.Demo.ConsoleApp.Nh.Entities; 2 | using Stove.NHibernate.Enrichments; 3 | 4 | namespace Stove.Demo.ConsoleApp.Nh.SessionContexts 5 | { 6 | public class SecondarySessionContext : StoveSessionContext 7 | { 8 | public IStoveSessionSet Categories { get; set; } 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Tests/Domain/Events/BlogCreatedEvent.cs: -------------------------------------------------------------------------------- 1 | using Stove.Events.Bus; 2 | 3 | namespace Stove.EntityFrameworkCore.Tests.Domain.Events 4 | { 5 | public class BlogCreatedEvent : Event 6 | { 7 | public readonly string Name; 8 | 9 | public BlogCreatedEvent(string name) 10 | { 11 | Name = name; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Stove.RavenDB/RavenDB/Filters/Query/IRavenQueryFilterExecuter.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | using Stove.Domain.Entities; 4 | 5 | namespace Stove.RavenDB.Filters.Query 6 | { 7 | public interface IRavenQueryFilterExecuter 8 | { 9 | IQueryable ExecuteFilter(IQueryable queryable) where TEntity : class, IEntity; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/Stove.NHibernate.Tests/Entities/ProductMap.cs: -------------------------------------------------------------------------------- 1 | using Stove.NHibernate.EntityMappings; 2 | 3 | namespace Stove.NHibernate.Tests.Entities 4 | { 5 | public class ProductMap : EntityMap 6 | { 7 | public ProductMap() : base("Product") 8 | { 9 | this.MapFullAudited(); 10 | 11 | Map(x => x.Name).Not.Nullable(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework/EntityFramework/IDbContextProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity; 2 | 3 | namespace Stove.EntityFramework 4 | { 5 | /// 6 | /// 7 | /// 8 | public interface IDbContextProvider 9 | where TDbContext : DbContext 10 | { 11 | TDbContext GetDbContext(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/IDbContextResolver.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | 3 | using Microsoft.EntityFrameworkCore; 4 | 5 | namespace Stove.EntityFrameworkCore 6 | { 7 | public interface IDbContextResolver 8 | { 9 | TDbContext Resolve(string connectionString, DbConnection existingConnection) 10 | where TDbContext : DbContext; 11 | } 12 | } -------------------------------------------------------------------------------- /src/Stove/Events/Bus/Entities/Envelope.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Events.Bus.Entities 2 | { 3 | public class Envelope 4 | { 5 | public Envelope(IMessage message, Headers headers) 6 | { 7 | Message = message; 8 | Headers = headers; 9 | } 10 | 11 | public Headers Headers { get; } 12 | 13 | public IMessage Message { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Dapper.Tests/Domain/Events/BlogCreatedEvent.cs: -------------------------------------------------------------------------------- 1 | using Stove.Events.Bus; 2 | 3 | namespace Stove.EntityFrameworkCore.Dapper.Tests.Domain.Events 4 | { 5 | public class BlogCreatedEvent : Event 6 | { 7 | public readonly string Name; 8 | 9 | public BlogCreatedEvent(string name) 10 | { 11 | Name = name; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/Stove.NHibernate.Tests/Entities/CategoryMap.cs: -------------------------------------------------------------------------------- 1 | using Stove.NHibernate.EntityMappings; 2 | 3 | namespace Stove.NHibernate.Tests.Entities 4 | { 5 | public class CategoryMap : EntityMap 6 | { 7 | public CategoryMap() : base("Category") 8 | { 9 | this.MapFullAudited(); 10 | 11 | Map(x => x.Name).Not.Nullable(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Stove/Log/IHasLogSeverity.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Log 2 | { 3 | /// 4 | /// Interface to define a property (see ). 5 | /// 6 | public interface IHasLogSeverity 7 | { 8 | /// 9 | /// Log severity. 10 | /// 11 | LogSeverity Severity { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Stove/Timing/ClockProviders.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Timing 2 | { 3 | public static class ClockProviders 4 | { 5 | public static UnspecifiedClockProvider Unspecified { get; } = new UnspecifiedClockProvider(); 6 | 7 | public static LocalClockProvider Local { get; } = new LocalClockProvider(); 8 | 9 | public static UtcClockProvider Utc { get; } = new UtcClockProvider(); 10 | } 11 | } -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/Configuration/StoveEfCoreConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Autofac; 4 | using Autofac.Extras.IocManager; 5 | 6 | using Microsoft.EntityFrameworkCore; 7 | 8 | namespace Stove.EntityFrameworkCore.Configuration 9 | { 10 | public class StoveEfCoreConfiguration : IStoveEfCoreConfiguration, ISingletonDependency 11 | { 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Stove/Events/Bus/IEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Events.Bus 4 | { 5 | /// 6 | /// Defines interface for all Event data classes. 7 | /// 8 | public interface IEvent : IMessage 9 | { 10 | /// 11 | /// The time when the event occured. 12 | /// 13 | DateTime EventTime { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Entities/Mappings/Dapper/MailMap.cs: -------------------------------------------------------------------------------- 1 | using DapperExtensions.Mapper; 2 | 3 | namespace Stove.Demo.ConsoleApp.Entities.Mappings.Dapper 4 | { 5 | public sealed class MailMap : ClassMapper 6 | { 7 | public MailMap() 8 | { 9 | Table("Mails"); 10 | Map(x => x.Id).Key(KeyType.Guid); 11 | AutoMap(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Stove.Mapster/Mapster/IStoveMapsterConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Mapster; 5 | 6 | namespace Stove.Mapster 7 | { 8 | public interface IStoveMapsterConfiguration 9 | { 10 | TypeAdapterConfig Configuration { get; } 11 | 12 | List> Configurators { get; } 13 | 14 | IAdapter Adapter { get; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/Stove.NHibernate.Tests/Entities/ProductDapperMap.cs: -------------------------------------------------------------------------------- 1 | using DapperExtensions.Mapper; 2 | 3 | namespace Stove.NHibernate.Tests.Entities 4 | { 5 | public sealed class ProductDapperMap : ClassMapper 6 | { 7 | public ProductDapperMap() 8 | { 9 | Table("Product"); 10 | Map(x => x.Id).Key(KeyType.Identity); 11 | AutoMap(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/DbContextTypeMatcher.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Uow; 2 | using Stove.EntityFramework; 3 | 4 | namespace Stove.EntityFrameworkCore 5 | { 6 | public class DbContextTypeMatcher : DbContextTypeMatcher 7 | { 8 | public DbContextTypeMatcher(ICurrentUnitOfWorkProvider currentUnitOfWorkProvider) 9 | : base(currentUnitOfWorkProvider) 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Stove/Domain/Repositories/IRepository.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | namespace Stove.Domain.Repositories 4 | { 5 | /// 6 | /// This interface must be implemented by all repositories to identify them by convention. 7 | /// Implement generic version instead of this one. 8 | /// 9 | public interface IRepository : ITransientDependency 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Stove/Domain/Uow/ICurrentUnitOfWorkProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Domain.Uow 2 | { 3 | /// 4 | /// Used to get/set current . 5 | /// 6 | public interface ICurrentUnitOfWorkProvider 7 | { 8 | /// 9 | /// Gets/sets current . 10 | /// 11 | IUnitOfWork Current { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Stove/Domain/Uow/IUnitOfWorkFilterExecuter.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Domain.Uow 2 | { 3 | public interface IUnitOfWorkFilterExecuter 4 | { 5 | void ApplyDisableFilter(IUnitOfWork unitOfWork, string filterName); 6 | 7 | void ApplyEnableFilter(IUnitOfWork unitOfWork, string filterName); 8 | 9 | void ApplyFilterParameterValue(IUnitOfWork unitOfWork, string filterName, string parameterName, object value); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/Stove.Dapper.Tests/Mappings/MailMap.cs: -------------------------------------------------------------------------------- 1 | using DapperExtensions.Mapper; 2 | 3 | using Stove.Dapper.Tests.Entities; 4 | 5 | namespace Stove.Dapper.Tests.Mappings 6 | { 7 | public sealed class MailMap : ClassMapper 8 | { 9 | public MailMap() 10 | { 11 | Table("Mails"); 12 | Map(x => x.Id).Key(KeyType.Guid); 13 | AutoMap(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/Stove.RavenDB.Tests/Entities/Product.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | 3 | namespace Stove.RavenDB.Tests.Entities 4 | { 5 | public class Product : Entity 6 | { 7 | protected Product() 8 | { 9 | } 10 | 11 | public Product(string name) : this() 12 | { 13 | Name = name; 14 | } 15 | 16 | public virtual string Name { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/Dtos/UserDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Tests.SampleApplication.Dtos 4 | { 5 | public class UserDto 6 | { 7 | public virtual string Name { get; set; } 8 | 9 | public virtual string Surname { get; set; } 10 | 11 | public virtual string Email { get; set; } 12 | 13 | public virtual DateTime CreationTime { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Entities/Mappings/Dapper/AnimalMap.cs: -------------------------------------------------------------------------------- 1 | using DapperExtensions.Mapper; 2 | 3 | namespace Stove.Demo.ConsoleApp.Entities.Mappings.Dapper 4 | { 5 | public sealed class AnimalMap : ClassMapper 6 | { 7 | public AnimalMap() 8 | { 9 | Table("Animals"); 10 | Map(x => x.Id).Key(KeyType.Identity); 11 | AutoMap(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Entities/Mappings/Dapper/PersonMap.cs: -------------------------------------------------------------------------------- 1 | using DapperExtensions.Mapper; 2 | 3 | namespace Stove.Demo.ConsoleApp.Entities.Mappings.Dapper 4 | { 5 | public sealed class PersonMap : ClassMapper 6 | { 7 | public PersonMap() 8 | { 9 | Table("Persons"); 10 | Map(x => x.Id).Key(KeyType.Identity); 11 | AutoMap(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Stove/Domain/Services/DomainService.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Domain.Services 2 | { 3 | /// 4 | /// This class can be used as a base class for domain services. 5 | /// 6 | /// 7 | /// 8 | public abstract class DomainService : StoveComponentBase, IDomainService 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Stove/Stove.csproj.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | CSharp71 -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Entities/Mappings/Dapper/ProductMap.cs: -------------------------------------------------------------------------------- 1 | using DapperExtensions.Mapper; 2 | 3 | namespace Stove.Demo.ConsoleApp.Entities.Mappings.Dapper 4 | { 5 | public sealed class ProductMap : ClassMapper 6 | { 7 | public ProductMap() 8 | { 9 | Table("Products"); 10 | Map(x => x.Id).Key(KeyType.Identity); 11 | AutoMap(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Stove/Domain/Entities/IPassivable.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Domain.Entities 2 | { 3 | /// 4 | /// This interface is used to make an entity active/passive. 5 | /// 6 | public interface IPassivable 7 | { 8 | /// 9 | /// True: This entity is active. 10 | /// False: This entity is not active. 11 | /// 12 | bool IsActive { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Stove/Domain/Services/IDomainService.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | namespace Stove.Domain.Services 4 | { 5 | /// 6 | /// This interface must be implemented by all domain services to identify them by convention. 7 | /// 8 | /// 9 | public interface IDomainService : ITransientDependency 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp.Nh/Mappings/Nh/ProductMap.cs: -------------------------------------------------------------------------------- 1 | using Stove.Demo.ConsoleApp.Nh.Entities; 2 | using Stove.NHibernate.EntityMappings; 3 | 4 | namespace Stove.Demo.ConsoleApp.Nh.Mappings.Nh 5 | { 6 | public class ProductMap : EntityMap 7 | { 8 | public ProductMap() : base("Products") 9 | { 10 | this.MapFullAudited(); 11 | 12 | Map(x => x.Name); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Stove.Redis/Redis/Configurations/IStoveRedisCacheConfiguration.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | 3 | using StackExchange.Redis; 4 | 5 | using Stove.Configuration; 6 | 7 | namespace Stove.Redis.Configurations 8 | { 9 | public interface IStoveRedisCacheConfiguration 10 | { 11 | [CanBeNull] 12 | ConfigurationOptions ConfigurationOptions { get; set; } 13 | 14 | IStoveStartupConfiguration StoveConfiguration { get; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Stove/Log/NullLoggerRegistrationExtensions.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | namespace Stove.Log 4 | { 5 | public static class NullLoggerRegistrationExtensions 6 | { 7 | public static IIocBuilder UseNullLogger(this IIocBuilder builder) 8 | { 9 | builder.RegisterServices(r => r.Register(keepDefault: true)); 10 | return builder; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Stove/Text/Formatting/FormatStringToken.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Text.Formatting 2 | { 3 | internal class FormatStringToken 4 | { 5 | public string Text { get; private set; } 6 | 7 | public FormatStringTokenType Type { get; private set; } 8 | 9 | public FormatStringToken(string text, FormatStringTokenType type) 10 | { 11 | Text = text; 12 | Type = type; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /test/Stove.Dapper.Tests/Mappings/ProductMap.cs: -------------------------------------------------------------------------------- 1 | using DapperExtensions.Mapper; 2 | 3 | using Stove.Dapper.Tests.Entities; 4 | 5 | namespace Stove.Dapper.Tests.Mappings 6 | { 7 | public sealed class ProductMap : ClassMapper 8 | { 9 | public ProductMap() 10 | { 11 | Table("Products"); 12 | Map(x => x.Id).Key(KeyType.Identity); 13 | AutoMap(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp.Nh/Mappings/Nh/CategoryMap.cs: -------------------------------------------------------------------------------- 1 | using Stove.Demo.ConsoleApp.Nh.Entities; 2 | using Stove.NHibernate.EntityMappings; 3 | 4 | namespace Stove.Demo.ConsoleApp.Nh.Mappings.Nh 5 | { 6 | public class CategoryMap : EntityMap 7 | { 8 | public CategoryMap() : base("Categories") 9 | { 10 | this.MapFullAudited(); 11 | 12 | Map(x => x.Name); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Tests/Domain/BlogUrlChangedEvent.cs: -------------------------------------------------------------------------------- 1 | using Stove.Events.Bus; 2 | 3 | namespace Stove.EntityFrameworkCore.Tests.Domain 4 | { 5 | public class BlogUrlChangedEvent : Event 6 | { 7 | public Blog Blog; 8 | public string Url; 9 | 10 | public BlogUrlChangedEvent(Blog blog, string url) 11 | { 12 | Blog = blog; 13 | Url = url; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp.RavenDB/Product.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities.Auditing; 2 | 3 | namespace Stove.Demo.ConsoleApp.RavenDB 4 | { 5 | public class Product : FullAuditedEntity 6 | { 7 | protected Product() 8 | { 9 | } 10 | 11 | public Product(string name) : this() 12 | { 13 | Name = name; 14 | } 15 | 16 | public virtual string Name { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Tests/Domain/Ticket.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | 3 | namespace Stove.EntityFrameworkCore.Tests.Domain 4 | { 5 | public class Ticket : Entity, IPassivable 6 | { 7 | public Ticket() 8 | { 9 | IsActive = true; 10 | } 11 | 12 | public virtual string EmailAddress { get; set; } 13 | 14 | public virtual string Message { get; set; } 15 | 16 | public virtual bool IsActive { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Stove.HangFire/Hangfire/Configurations/IStoveHangfireConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Hangfire; 2 | 3 | using Stove.Configuration; 4 | 5 | namespace Stove.Hangfire.Configurations 6 | { 7 | public interface IStoveHangfireConfiguration 8 | { 9 | BackgroundJobServer Server { get; set; } 10 | 11 | IGlobalConfiguration GlobalConfiguration { get; } 12 | 13 | IStoveStartupConfiguration StoveConfiguration { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp.Nh/Entities/Product.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities.Auditing; 2 | 3 | namespace Stove.Demo.ConsoleApp.Nh.Entities 4 | { 5 | public class Product : FullAuditedEntity 6 | { 7 | protected Product() 8 | { 9 | } 10 | 11 | public Product(string name) : this() 12 | { 13 | Name = name; 14 | } 15 | 16 | public virtual string Name { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Stove.NHibernate.Tests/Entities/Category.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities.Auditing; 2 | 3 | namespace Stove.NHibernate.Tests.Entities 4 | { 5 | public class Category : FullAuditedEntity 6 | { 7 | protected Category() 8 | { 9 | } 10 | 11 | public Category(string name) : this() 12 | { 13 | Name = name; 14 | } 15 | 16 | public virtual string Name { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Stove/Commands/CommandContext.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Commands 2 | { 3 | public class CommandContext 4 | { 5 | public string CorrelationId { get; set; } 6 | 7 | public string UserId { get; set; } 8 | 9 | public string BrowserInfo { get; set; } 10 | 11 | public string IpAddress { get; set; } 12 | 13 | public string HostName { get; set; } 14 | 15 | public int Duration { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp.Nh/Entities/Category.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities.Auditing; 2 | 3 | namespace Stove.Demo.ConsoleApp.Nh.Entities 4 | { 5 | public class Category : FullAuditedEntity 6 | { 7 | protected Category() 8 | { 9 | } 10 | 11 | public Category(string name) : this() 12 | { 13 | Name = name; 14 | } 15 | 16 | public virtual string Name { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Dapper.Tests/Domain/BlogUrlChangedEvent.cs: -------------------------------------------------------------------------------- 1 | using Stove.Events.Bus; 2 | 3 | namespace Stove.EntityFrameworkCore.Dapper.Tests.Domain 4 | { 5 | public class BlogUrlChangedEvent : Event 6 | { 7 | public Blog Blog; 8 | public string Url; 9 | 10 | public BlogUrlChangedEvent(Blog blog, string url) 11 | { 12 | Blog = blog; 13 | Url = url; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Dapper.Tests/Domain/Comment.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | 3 | namespace Stove.EntityFrameworkCore.Dapper.Tests.Domain 4 | { 5 | public class Comment : Entity 6 | { 7 | protected Comment() 8 | { 9 | } 10 | 11 | public Comment(string text) : this() 12 | { 13 | Text = text; 14 | } 15 | 16 | public string Text { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Stove.NHibernate.Tests/Entities/Events/ProductDeletedEvent.cs: -------------------------------------------------------------------------------- 1 | using Stove.Events.Bus; 2 | 3 | namespace Stove.NHibernate.Tests.Entities.Events 4 | { 5 | public class ProductDeletedEvent : Event 6 | { 7 | public readonly int Id; 8 | public readonly string Name; 9 | 10 | public ProductDeletedEvent(int id, string name) 11 | { 12 | Id = id; 13 | Name = name; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Stove.RavenDB/RavenDB/Configuration/StoveRavenDBConfigurationExtensions.cs: -------------------------------------------------------------------------------- 1 | using Stove.Configuration; 2 | 3 | namespace Stove.RavenDB.Configuration 4 | { 5 | public static class StoveRavenDBConfigurationExtensions 6 | { 7 | public static IStoveRavenDBConfiguration StoveRavenDB(this IModuleConfigurations modules) 8 | { 9 | return modules.StoveConfiguration.Get(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Stove/Application/Services/IApplicationService.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | namespace Stove.Application.Services 4 | { 5 | /// 6 | /// This interface must be implemented by all application services to identify them by convention. 7 | /// 8 | /// 9 | public interface IApplicationService : ITransientDependency 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Stove/BackgroundJobs/IBackgroundJob.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | 3 | namespace Stove.BackgroundJobs 4 | { 5 | /// 6 | /// Defines interface of a background job. 7 | /// 8 | public interface IBackgroundJob 9 | { 10 | /// 11 | /// Executes the job with the args/>. 12 | /// 13 | /// Job arguments. 14 | void Execute([NotNull] TArgs args); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Stove/Configuration/ModuleConfigurations.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | 3 | namespace Stove.Configuration 4 | { 5 | public class ModuleConfigurations : IModuleConfigurations 6 | { 7 | public ModuleConfigurations([NotNull] IStoveStartupConfiguration stoveConfiguration) 8 | { 9 | StoveConfiguration = stoveConfiguration; 10 | } 11 | 12 | public IStoveStartupConfiguration StoveConfiguration { get; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Stove/Runtime/Security/StoveClaims.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Runtime.Security 2 | { 3 | /// 4 | /// Used to get Stove-specific claim type names. 5 | /// 6 | public static class StoveClaimTypes 7 | { 8 | /// 9 | /// ImpersonatorUserId. 10 | /// 11 | public const string ImpersonatorUserId = "http://www.thestoveproject.com/identity/claims/impersonatorUserId"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/Stove.Dapper.Tests/Mappings/ProductDetailMap.cs: -------------------------------------------------------------------------------- 1 | using DapperExtensions.Mapper; 2 | 3 | using Stove.Dapper.Tests.Entities; 4 | 5 | namespace Stove.Dapper.Tests.Mappings 6 | { 7 | public sealed class ProductDetailMap : ClassMapper 8 | { 9 | public ProductDetailMap() 10 | { 11 | Table("ProductDetails"); 12 | Map(x => x.Id).Key(KeyType.Identity); 13 | AutoMap(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp.Nh/Mappings/Dapper/ProductMap.cs: -------------------------------------------------------------------------------- 1 | using DapperExtensions.Mapper; 2 | 3 | using Stove.Demo.ConsoleApp.Nh.Entities; 4 | 5 | namespace Stove.Demo.ConsoleApp.Nh.Mappings.Dapper 6 | { 7 | public sealed class ProductMap : ClassMapper 8 | { 9 | public ProductMap() 10 | { 11 | Table("Products"); 12 | Map(x => x.Id).Key(KeyType.Identity); 13 | AutoMap(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Stove.Couchbase/Couchbase/Configuration/StoveCouchbaseConfigurationExtensions.cs: -------------------------------------------------------------------------------- 1 | using Stove.Configuration; 2 | 3 | namespace Stove.Couchbase.Configuration 4 | { 5 | public static class StoveCouchbaseConfigurationExtensions 6 | { 7 | public static IStoveCouchbaseConfiguration StoveCouchbase(this IModuleConfigurations modules) 8 | { 9 | return modules.StoveConfiguration.Get(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Stove/RegularGuidGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Autofac.Extras.IocManager; 4 | 5 | namespace Stove 6 | { 7 | /// 8 | /// Implements by using . 9 | /// 10 | public class RegularGuidGenerator : IGuidGenerator, ITransientDependency 11 | { 12 | public virtual Guid Create() 13 | { 14 | return Guid.NewGuid(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp.Nh/Mappings/Dapper/CategoryMap.cs: -------------------------------------------------------------------------------- 1 | using DapperExtensions.Mapper; 2 | 3 | using Stove.Demo.ConsoleApp.Nh.Entities; 4 | 5 | namespace Stove.Demo.ConsoleApp.Nh.Mappings.Dapper 6 | { 7 | public sealed class CategoryMap : ClassMapper 8 | { 9 | public CategoryMap() 10 | { 11 | Table("Products"); 12 | Map(x => x.Id).Key(KeyType.Identity); 13 | AutoMap(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Dapper.Tests/Dapper/BlogMap.cs: -------------------------------------------------------------------------------- 1 | using DapperExtensions.Mapper; 2 | 3 | using Stove.EntityFrameworkCore.Dapper.Tests.Domain; 4 | 5 | namespace Stove.EntityFrameworkCore.Dapper.Tests.Dapper 6 | { 7 | public sealed class BlogMap : ClassMapper 8 | { 9 | public BlogMap() 10 | { 11 | Table("Blogs"); 12 | Map(x => x.Id).Key(KeyType.Identity); 13 | AutoMap(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Stove.RavenDB/RavenDB/Filters/Query/IRavenQueryFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | 4 | using Stove.Domain.Entities; 5 | 6 | namespace Stove.RavenDB.Filters.Query 7 | { 8 | public interface IRavenQueryFilter 9 | { 10 | string FilterName { get; } 11 | 12 | bool IsEnabled { get; } 13 | 14 | Expression> ExecuteFilter() where TEntity : class, IEntity; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Stove.RavenDB/RavenDB/Repositories/RavenDBRepositoryBase{TEntity}.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | using Stove.Domain.Repositories; 3 | 4 | namespace Stove.RavenDB.Repositories 5 | { 6 | public class RavenDBRepositoryBase : RavenDBRepositoryBase, IRepository where TEntity : class, IEntity 7 | { 8 | public RavenDBRepositoryBase(ISessionProvider sessionProvider) : base(sessionProvider) 9 | { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Stove/Bootstrapping/IStoveBootstrapperManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using JetBrains.Annotations; 5 | 6 | namespace Stove.Bootstrapping 7 | { 8 | public interface IStoveBootstrapperManager 9 | { 10 | [NotNull] 11 | IReadOnlyList Bootstrappers { get; } 12 | 13 | void StartBootstrappers([NotNull] Type starterBootStrapperType); 14 | 15 | void ShutdownBootstrappers(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Tests/Domain_Product/Events/VariantValueAdded.cs: -------------------------------------------------------------------------------- 1 | using Stove.Events.Bus; 2 | 3 | namespace Stove.EntityFrameworkCore.Tests.Domain_Product.Events 4 | { 5 | public class VariantValueAdded : Event 6 | { 7 | public int Id { get; } 8 | 9 | public string Value { get; } 10 | 11 | public VariantValueAdded(int id, string value) 12 | { 13 | Id = id; 14 | Value = value; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Stove.Redis/Redis/IStoveRedisCacheDatabaseProvider.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | 3 | using StackExchange.Redis; 4 | 5 | namespace Stove.Redis 6 | { 7 | /// 8 | /// Used to get for Redis cache. 9 | /// 10 | public interface IStoveRedisCacheDatabaseProvider 11 | { 12 | /// 13 | /// Gets the client. 14 | /// 15 | /// 16 | [NotNull] 17 | IDatabase GetDatabase(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Stove/Runtime/Caching/CacheManagerExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Runtime.Caching 2 | { 3 | /// 4 | /// Extension methods for . 5 | /// 6 | public static class CacheManagerExtensions 7 | { 8 | public static ITypedCache GetCache(this ICacheManager cacheManager, string name) 9 | { 10 | return cacheManager.GetCache(name).AsTyped(); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Stove/Runtime/Session/DefaultPrincipalAccessor.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | using System.Threading; 3 | 4 | using Autofac.Extras.IocManager; 5 | 6 | namespace Stove.Runtime.Session 7 | { 8 | public class DefaultPrincipalAccessor : IPrincipalAccessor, ITransientDependency 9 | { 10 | public static DefaultPrincipalAccessor Instance => new DefaultPrincipalAccessor(); 11 | 12 | public virtual ClaimsPrincipal Principal => Thread.CurrentPrincipal as ClaimsPrincipal; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Dapper.Tests/Dapper/CommentMap.cs: -------------------------------------------------------------------------------- 1 | using DapperExtensions.Mapper; 2 | 3 | using Stove.EntityFrameworkCore.Dapper.Tests.Domain; 4 | 5 | namespace Stove.EntityFrameworkCore.Dapper.Tests.Dapper 6 | { 7 | public sealed class CommentMap : ClassMapper 8 | { 9 | public CommentMap() 10 | { 11 | Table("Comments"); 12 | Map(x => x.Id).Key(KeyType.Identity); 13 | AutoMap(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Stove.NHibernate/NHibernate/Configuration/StoveNHibernateConfigurationExtensions.cs: -------------------------------------------------------------------------------- 1 | using Stove.Configuration; 2 | 3 | namespace Stove.NHibernate.Configuration 4 | { 5 | public static class StoveNHibernateConfigurationExtensions 6 | { 7 | public static IStoveNHibernateConfiguration StoveNHibernate(this IModuleConfigurations configurations) 8 | { 9 | return configurations.StoveConfiguration.Get(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/RabbitMQ/Messages/PersonAddedMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using MassTransit; 4 | 5 | namespace Stove.Demo.ConsoleApp.RabbitMQ.Messages 6 | { 7 | public interface IPersonAddedMessage : CorrelatedBy 8 | { 9 | string Name { get; set; } 10 | } 11 | 12 | public class PersonAddedMessage : IPersonAddedMessage 13 | { 14 | public string Name { get; set; } 15 | 16 | public Guid CorrelationId { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/SomeRegistrationExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | using Autofac.Extras.IocManager; 4 | 5 | namespace Stove.Demo.ConsoleApp 6 | { 7 | public static class SomeRegistrationExtensions 8 | { 9 | public static IIocBuilder UseSomeFeature(this IIocBuilder builder) 10 | { 11 | builder.RegisterServices(r => r.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly())); 12 | return builder; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Stove/Commands/SequencedCommand.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Commands 2 | { 3 | public abstract class SequencedCommand : Command 4 | { 5 | public readonly int Position; 6 | public readonly int Size; 7 | 8 | protected SequencedCommand(int position, int size) 9 | { 10 | Position = position; 11 | Size = size; 12 | } 13 | 14 | public bool IsLast() 15 | { 16 | return Position == Size; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Stove/Domain/Repositories/IRepository{TEntity}.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | 3 | namespace Stove.Domain.Repositories 4 | { 5 | /// 6 | /// A shortcut of for most used primary key type (). 7 | /// 8 | /// Entity type 9 | public interface IRepository : IRepository where TEntity : class, IEntity 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Entities/Animal.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations.Schema; 2 | 3 | using Stove.Domain.Entities; 4 | 5 | namespace Stove.Demo.ConsoleApp.Entities 6 | { 7 | [Table("Animals")] 8 | public class Animal : Entity 9 | { 10 | private Animal() 11 | { 12 | } 13 | 14 | public Animal(string name) : this() 15 | { 16 | Name = name; 17 | } 18 | 19 | public virtual string Name { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/Domain/Entities/Gender.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | using Stove.Domain.Entities; 5 | 6 | namespace Stove.Tests.SampleApplication.Domain.Entities 7 | { 8 | [Table("Gender")] 9 | public class Gender : Entity 10 | { 11 | private Gender() 12 | { 13 | } 14 | 15 | [Required] 16 | public virtual string Name { get; protected set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Stove/Domain/Uow/NullUnitOfWorkFilterExecuter.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Domain.Uow 2 | { 3 | public class NullUnitOfWorkFilterExecuter : IUnitOfWorkFilterExecuter 4 | { 5 | public void ApplyDisableFilter(IUnitOfWork unitOfWork, string filterName) 6 | { 7 | } 8 | 9 | public void ApplyEnableFilter(IUnitOfWork unitOfWork, string filterName) 10 | { 11 | } 12 | 13 | public void ApplyFilterParameterValue(IUnitOfWork unitOfWork, string filterName, string parameterName, object value) 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Stove/Commands/CommandContextAccessorExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Commands 4 | { 5 | public static class CommandContextAccessorExtensions 6 | { 7 | public static string GetCorrelationIdOrEmpty(this IStoveCommandContextAccessor accessor) 8 | { 9 | if (accessor.CommandContext != null) 10 | { 11 | return accessor.CommandContext.CorrelationId; 12 | } 13 | 14 | return Guid.Empty.ToString(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/Stove.Demo.WebApi/Entities/Product.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations.Schema; 2 | 3 | using Stove.Domain.Entities.Auditing; 4 | 5 | namespace Stove.Demo.WebApi.Entities 6 | { 7 | [Table("Product")] 8 | public class Product : FullAuditedEntity 9 | { 10 | protected Product() 11 | { 12 | } 13 | 14 | public Product(string name) : this() 15 | { 16 | Name = name; 17 | } 18 | 19 | public virtual string Name { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework/EntityFramework/Uow/IEfTransactionStrategy.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity; 2 | 3 | using Stove.Domain.Uow; 4 | 5 | namespace Stove.EntityFramework.Uow 6 | { 7 | public interface IEfTransactionStrategy 8 | { 9 | void InitOptions(UnitOfWorkOptions options); 10 | 11 | void Commit(); 12 | 13 | void Dispose(); 14 | 15 | DbContext CreateDbContext(string connectionString, IDbContextResolver dbContextResolver) 16 | where TDbContext : DbContext; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp.RavenDB/Stove.Demo.ConsoleApp.RavenDB.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net461 5 | exe 6 | exe 7 | win7-x64 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/Stove.RavenDB.Tests/Entities/Order.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities.Auditing; 2 | 3 | namespace Stove.RavenDB.Tests.Entities 4 | { 5 | public class Order : FullAuditedEntity 6 | { 7 | protected Order() 8 | { 9 | } 10 | 11 | public Order(string address, Product product) : this() 12 | { 13 | Address = address; 14 | Product = product; 15 | } 16 | 17 | public string Address { get; set; } 18 | 19 | public Product Product { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework/EntityFramework/Uow/ActiveDbContextInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity; 2 | 3 | namespace Stove.EntityFramework.Uow 4 | { 5 | public class ActiveDbContextInfo 6 | { 7 | public ActiveDbContextInfo(DbContext dbContext, string nameOrConnectionString) 8 | { 9 | DbContext = dbContext; 10 | NameOrConnectionString = nameOrConnectionString; 11 | } 12 | 13 | public DbContext DbContext { get; } 14 | 15 | public string NameOrConnectionString { get; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Stove/Timing/IDateTimeRange.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Timing 4 | { 5 | /// 6 | /// Defines interface for a DateTime range. 7 | /// 8 | public interface IDateTimeRange 9 | { 10 | /// 11 | /// Start time of the datetime range. 12 | /// 13 | DateTime StartTime { get; set; } 14 | 15 | /// 16 | /// End time of the datetime range. 17 | /// 18 | DateTime EndTime { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove.Couchbase/Couchbase/Configuration/StoveCouchbaseConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | using Couchbase.Configuration.Client; 4 | 5 | namespace Stove.Couchbase.Configuration 6 | { 7 | public class StoveCouchbaseConfiguration : IStoveCouchbaseConfiguration, ISingletonDependency 8 | { 9 | public StoveCouchbaseConfiguration() 10 | { 11 | ClientConfiguration = new ClientConfiguration(); 12 | } 13 | 14 | public ClientConfiguration ClientConfiguration { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/DatabaseFacadeExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Infrastructure; 2 | using Microsoft.EntityFrameworkCore.Storage; 3 | using Microsoft.Extensions.DependencyInjection; 4 | 5 | namespace Stove.EntityFrameworkCore 6 | { 7 | public static class DatabaseFacadeExtensions 8 | { 9 | public static bool IsRelational(this DatabaseFacade database) 10 | { 11 | return database.GetInfrastructure().GetService() != null; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/SimpleDbContextProvider.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | 3 | namespace Stove.EntityFrameworkCore 4 | { 5 | public sealed class SimpleDbContextProvider : IDbContextProvider 6 | where TDbContext : DbContext 7 | { 8 | public SimpleDbContextProvider(TDbContext dbContext) 9 | { 10 | DbContext = dbContext; 11 | } 12 | 13 | public TDbContext DbContext { get; } 14 | 15 | public TDbContext GetDbContext() 16 | { 17 | return DbContext; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove/BackgroundJobs/BackgroundJobConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Stove.Configuration; 2 | 3 | namespace Stove.BackgroundJobs 4 | { 5 | public class BackgroundJobConfiguration : IBackgroundJobConfiguration 6 | { 7 | public BackgroundJobConfiguration(IStoveStartupConfiguration stoveConfiguration) 8 | { 9 | StoveConfiguration = stoveConfiguration; 10 | } 11 | 12 | public bool IsJobExecutionEnabled { get; set; } 13 | 14 | public IStoveStartupConfiguration StoveConfiguration { get; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Stove/Events/Bus/Entities/IAggregateChangeEventHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace Stove.Events.Bus.Entities 5 | { 6 | /// 7 | /// Used to publish entity change events. 8 | /// 9 | public interface IAggregateChangeEventHelper 10 | { 11 | void PublishEvents(AggregateChangeReport aggregateChangeReport); 12 | 13 | Task PublishEventsAsync(AggregateChangeReport aggregateChangeReport, CancellationToken cancellationToken = default); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/Stove.Demo.WebApi/StoveDemoWebApiBootstapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | using Stove.Dapper; 3 | using Stove.EntityFramework; 4 | 5 | namespace Stove.Demo.WebApi 6 | { 7 | [DependsOn( 8 | typeof(StoveEntityFrameworkBootstrapper), 9 | typeof(StoveDapperBootstrapper) 10 | )] 11 | public class StoveDemoWebApiBootstapper : StoveBootstrapper 12 | { 13 | public override void PreStart() 14 | { 15 | StoveConfiguration.DefaultNameOrConnectionString = "Default"; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Dapper.Tests/Dapper/PostMap.cs: -------------------------------------------------------------------------------- 1 | using DapperExtensions.Mapper; 2 | 3 | using Stove.EntityFrameworkCore.Dapper.Tests.Domain; 4 | 5 | namespace Stove.EntityFrameworkCore.Dapper.Tests.Dapper 6 | { 7 | public class PostMap : ClassMapper 8 | { 9 | public PostMap() 10 | { 11 | Table("Posts"); 12 | Map(x => x.Id).Key(KeyType.Guid); 13 | Map(x => x.Blog).Ignore(); 14 | Map(x => x.Comment).Ignore(); 15 | AutoMap(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Stove.Mapster.Tests/StoveMapsterTestBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | 3 | namespace Stove.Mapster.Tests 4 | { 5 | [DependsOn( 6 | typeof(StoveMapsterBootstrapper) 7 | )] 8 | public class StoveMapsterTestBootstrapper : StoveBootstrapper 9 | { 10 | public override void PreStart() 11 | { 12 | StoveConfiguration.Modules.StoveMapster().Configurators.Add(config => 13 | { 14 | config.RequireExplicitMapping = true; 15 | }); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Stove/Domain/Entities/ISoftDelete.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Domain.Entities 2 | { 3 | /// 4 | /// Used to standardize soft deleting entities. 5 | /// Soft-delete entities are not actually deleted, 6 | /// marked as IsDeleted = true in the database, 7 | /// but can not be retrieved to the application. 8 | /// 9 | public interface ISoftDelete 10 | { 11 | /// 12 | /// Used to mark an Entity as 'Deleted'. 13 | /// 14 | bool IsDeleted { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Stove/Linq/IAsyncQueryableExecuter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | namespace Stove.Linq 6 | { 7 | /// 8 | /// This interface is intended to be used by Stove. 9 | /// 10 | public interface IAsyncQueryableExecuter 11 | { 12 | Task CountAsync(IQueryable queryable); 13 | 14 | Task> ToListAsync(IQueryable queryable); 15 | 16 | Task FirstOrDefaultAsync(IQueryable queryable); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Stove.RabbitMQ.Tests/Consumers/OrderPlacedConsumer.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | using MassTransit; 4 | 5 | using Stove.MQ; 6 | using Stove.RabbitMQ.Tests.Contracts; 7 | 8 | namespace Stove.RabbitMQ.Tests.Consumers 9 | { 10 | public class OrderPlacedConsumer : ConsumerBase, IConsumer 11 | { 12 | public Task Consume(ConsumeContext context) 13 | { 14 | int orderId = context.Message.OrderId; 15 | 16 | return Task.FromResult(0); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Dto/StorefrontProductPriceDto.cs: -------------------------------------------------------------------------------- 1 | using Stove.Demo.ConsoleApp.Entities; 2 | using Stove.Mapster; 3 | 4 | namespace Stove.Demo.ConsoleApp.Dto 5 | { 6 | [AutoMap(typeof(StorefrontProductPrice))] 7 | public class StorefrontProductPriceDto 8 | { 9 | public int ProductId { get; set; } 10 | 11 | public int StorefrontId { get; set; } 12 | 13 | public int CurrencyId { get; set; } 14 | 15 | public decimal Msrp { get; set; } 16 | 17 | public decimal SellingPrice { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/Domain/Entities/Category.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | using Stove.Domain.Entities; 5 | 6 | namespace Stove.Tests.SampleApplication.Domain.Entities 7 | { 8 | [Table("Category")] 9 | public class Category : Entity 10 | { 11 | protected Category() 12 | { 13 | } 14 | 15 | public Category(string name) : this() 16 | { 17 | Name = name; 18 | } 19 | 20 | [Required] 21 | public virtual string Name { get; protected set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Tests/Ef/BloggingDbContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | 3 | using Stove.EntityFrameworkCore.Tests.Domain; 4 | 5 | namespace Stove.EntityFrameworkCore.Tests.Ef 6 | { 7 | public class BloggingDbContext : StoveDbContext 8 | { 9 | public DbSet Blogs { get; set; } 10 | 11 | public DbSet Posts { get; set; } 12 | 13 | public BloggingDbContext(DbContextOptions options) 14 | : base(options) 15 | { 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Tests/EntityFrameworkCoreTestBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using System.Transactions; 2 | 3 | using Stove.Bootstrapping; 4 | 5 | namespace Stove.EntityFrameworkCore.Tests 6 | { 7 | [DependsOn( 8 | typeof(StoveEntityFrameworkCoreBootstrapper) 9 | )] 10 | public class EntityFrameworkCoreTestBootstrapper : StoveBootstrapper 11 | { 12 | public override void PreStart() 13 | { 14 | StoveConfiguration.DefaultNameOrConnectionString = "Default"; 15 | StoveConfiguration.UnitOfWork.IsolationLevel = IsolationLevel.Unspecified; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/Domain/Entities/Brand.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | using JetBrains.Annotations; 5 | 6 | using Stove.Domain.Entities; 7 | 8 | namespace Stove.Tests.SampleApplication.Domain.Entities 9 | { 10 | [Table("Brand")] 11 | public class Brand : Entity 12 | { 13 | private Brand() 14 | { 15 | } 16 | 17 | [Required] 18 | [NotNull] 19 | public virtual string Name { get; protected set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/Uow/IEfCoreTransactionStrategy.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | using Microsoft.EntityFrameworkCore; 4 | 5 | using Stove.Domain.Uow; 6 | 7 | namespace Stove.EntityFrameworkCore.Uow 8 | { 9 | public interface IEfCoreTransactionStrategy 10 | { 11 | void InitOptions(UnitOfWorkOptions options); 12 | 13 | DbContext CreateDbContext(string connectionString, IDbContextResolver dbContextResolver) 14 | where TDbContext : DbContext; 15 | 16 | void Commit(); 17 | 18 | void Dispose(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove/Bootstrapping/DependsOn.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JetBrains.Annotations; 4 | 5 | namespace Stove.Bootstrapping 6 | { 7 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 8 | public class DependsOnAttribute : Attribute 9 | { 10 | public DependsOnAttribute([NotNull] params Type[] dependedBootstrapperTypes) 11 | { 12 | DependedBootstrapperTypes = dependedBootstrapperTypes; 13 | } 14 | 15 | [NotNull] 16 | public Type[] DependedBootstrapperTypes { get; private set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Stove.Dapper/Dapper/Filters/Query/IDapperQueryFilterExecuter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | 4 | using DapperExtensions; 5 | 6 | using Stove.Domain.Entities; 7 | 8 | namespace Stove.Dapper.Filters.Query 9 | { 10 | public interface IDapperQueryFilterExecuter 11 | { 12 | IPredicate ExecuteFilter(Expression> predicate) where TEntity : class, IEntity; 13 | 14 | PredicateGroup ExecuteFilter() where TEntity : class, IEntity; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Entities/Person.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations.Schema; 2 | 3 | using Stove.Domain.Entities; 4 | 5 | namespace Stove.Demo.ConsoleApp.Entities 6 | { 7 | [Table("Persons")] 8 | public class Person : Entity, ISoftDelete 9 | { 10 | private Person() 11 | { 12 | } 13 | 14 | public Person(string name) : this() 15 | { 16 | Name = name; 17 | } 18 | 19 | public virtual string Name { get; set; } 20 | 21 | public bool IsDeleted { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/Stove.Demo.WebApiCore/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore; 2 | using Microsoft.AspNetCore.Hosting; 3 | 4 | namespace Stove.Demo.WebApiCore 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | BuildWebHost(args).Run(); 11 | } 12 | 13 | public static IWebHost BuildWebHost(string[] args) 14 | { 15 | return WebHost.CreateDefaultBuilder(args) 16 | .UseStartup() 17 | .Build(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Dapper.Tests/Ef/BloggingDbContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | 3 | using Stove.EntityFrameworkCore.Dapper.Tests.Domain; 4 | 5 | namespace Stove.EntityFrameworkCore.Dapper.Tests.Ef 6 | { 7 | public class BloggingDbContext : StoveDbContext 8 | { 9 | public BloggingDbContext(DbContextOptions options) 10 | : base(options) 11 | { 12 | } 13 | 14 | public DbSet Blogs { get; set; } 15 | 16 | public DbSet Posts { get; set; } 17 | 18 | public DbSet Comments { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove.Redis/Redis/StoveRedisBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | using Stove.Redis.Configurations; 3 | 4 | namespace Stove.Redis 5 | { 6 | [DependsOn( 7 | typeof(StoveKernelBootstrapper) 8 | )] 9 | public class StoveRedisBootstrapper : StoveBootstrapper 10 | { 11 | public override void PreStart() 12 | { 13 | if (StoveConfiguration.IsConfigurerRegistered()) 14 | { 15 | StoveConfiguration.GetConfigurerIfExists().Invoke(StoveConfiguration.Modules.StoveRedis()); 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Stove/Domain/Uow/StoveDataFilters.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | 3 | namespace Stove.Domain.Uow 4 | { 5 | /// 6 | /// Standard filters of Stove. 7 | /// 8 | public static class StoveDataFilters 9 | { 10 | /// 11 | /// "SoftDelete". 12 | /// Soft delete filter. 13 | /// Prevents getting deleted data from database. 14 | /// See interface. 15 | /// 16 | public const string SoftDelete = "SoftDelete"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Stove.NLog.Tests/NLog_Tests.cs: -------------------------------------------------------------------------------- 1 | using Stove.Log; 2 | 3 | using Xunit; 4 | 5 | namespace Stove.NLog.Tests 6 | { 7 | public class NLog_Tests : NLogTestBase 8 | { 9 | public NLog_Tests() 10 | { 11 | Building(builder => { }).Ok(); 12 | } 13 | 14 | [Fact] 15 | public void should_work() 16 | { 17 | The().Debug("Log Me!"); 18 | The().Warn("Log Me!"); 19 | The().Error("Log Me!"); 20 | The().Info("Log Me!"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/Extensions/DbContextExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Infrastructure; 3 | using Microsoft.EntityFrameworkCore.Storage; 4 | 5 | namespace Stove.EntityFrameworkCore.Extensions 6 | { 7 | internal static class DbContextExtensions 8 | { 9 | public static bool HasRelationalTransactionManager(this DbContext dbContext) 10 | { 11 | return dbContext.Database.GetService() is IRelationalTransactionManager; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Stove/Threading/RunnableExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Threading 2 | { 3 | /// 4 | /// Some extension methods for . 5 | /// 6 | public static class RunnableExtensions 7 | { 8 | /// 9 | /// Calls and then . 10 | /// 11 | public static void StopAndWaitToStop(this IRunnable runnable) 12 | { 13 | runnable.Stop(); 14 | runnable.WaitToStop(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Stove/Timing/UnspecifiedClockProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Timing 4 | { 5 | public class UnspecifiedClockProvider : IClockProvider 6 | { 7 | public DateTime Now => DateTime.Now; 8 | 9 | public DateTimeKind Kind => DateTimeKind.Unspecified; 10 | 11 | public bool SupportsMultipleTimezone => false; 12 | 13 | public DateTime Normalize(DateTime dateTime) 14 | { 15 | return dateTime; 16 | } 17 | 18 | internal UnspecifiedClockProvider() 19 | { 20 | 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Stove/Domain/Entities/Auditing/IHasCreationTime.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Domain.Entities.Auditing 4 | { 5 | /// 6 | /// An entity can implement this interface if of this entity must be stored. 7 | /// is automatically set when saving to database. 8 | /// 9 | public interface IHasCreationTime 10 | { 11 | /// 12 | /// Creation time of this entity. 13 | /// 14 | DateTime CreationTime { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /test/Stove.Hangfire.Tests/SimpleJob.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | using Stove.BackgroundJobs; 4 | 5 | namespace Stove.Hangfire.Tests 6 | { 7 | public class SimpleJob : BackgroundJob, ISingletonDependency 8 | { 9 | public int ExecutionCount { get; set; } 10 | 11 | public override void Execute(SimpleJobArgs args) 12 | { 13 | string obj = args.Name; 14 | ExecutionCount++; 15 | } 16 | } 17 | 18 | public class SimpleJobArgs 19 | { 20 | public string Name { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/Stove.NLog.Tests/NLogTestBase.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | using Stove.Reflection.Extensions; 4 | using Stove.TestBase; 5 | 6 | namespace Stove.NLog.Tests 7 | { 8 | public abstract class NLogTestBase : ApplicationTestBase 9 | { 10 | protected NLogTestBase() 11 | { 12 | Building(builder => 13 | { 14 | builder.UseStoveNLog(); 15 | builder.RegisterServices(r => r.RegisterAssemblyByConvention(typeof(NLogTestBase).GetAssembly())); 16 | }); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Stove/Domain/Entities/Auditing/IHasDeletionTime.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Domain.Entities.Auditing 4 | { 5 | /// 6 | /// An entity can implement this interface if of this entity must be stored. 7 | /// is automatically set when deleting . 8 | /// 9 | public interface IHasDeletionTime : ISoftDelete 10 | { 11 | /// 12 | /// Deletion time of this entity. 13 | /// 14 | DateTime? DeletionTime { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /test/Stove.Dapper.Tests/Entities/Product.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | using Stove.Domain.Entities.Auditing; 5 | 6 | namespace Stove.Dapper.Tests.Entities 7 | { 8 | [Table("Products")] 9 | public class Product : FullAuditedEntity 10 | { 11 | protected Product() 12 | { 13 | } 14 | 15 | public Product(string name) : this() 16 | { 17 | Name = name; 18 | } 19 | 20 | [Required] 21 | public string Name { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework/EntityFramework/SimpleDbContextProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity; 2 | 3 | namespace Stove.EntityFramework 4 | { 5 | public sealed class SimpleDbContextProvider : IDbContextProvider 6 | where TDbContext : DbContext 7 | { 8 | public SimpleDbContextProvider(TDbContext dbContext) 9 | { 10 | DbContext = dbContext; 11 | } 12 | 13 | public TDbContext DbContext { get; } 14 | 15 | public TDbContext GetDbContext() 16 | { 17 | return DbContext; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove/Domain/Uow/IConnectionStringResolver.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Domain.Uow 2 | { 3 | /// 4 | /// Used to get connection string when a database connection is needed. 5 | /// 6 | public interface IConnectionStringResolver 7 | { 8 | /// 9 | /// Gets a connection string name (in config file) or a valid connection string. 10 | /// 11 | /// Arguments that can be used while resolving connection string. 12 | string GetNameOrConnectionString(ConnectionStringResolveArgs args); 13 | } 14 | } -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Entities/Product.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | using Stove.Domain.Entities.Auditing; 5 | 6 | namespace Stove.Demo.ConsoleApp.Entities 7 | { 8 | [Table("Products")] 9 | public class Product : FullAuditedEntity 10 | { 11 | protected Product() 12 | { 13 | } 14 | 15 | public Product(string name) : this() 16 | { 17 | Name = name; 18 | } 19 | 20 | [Required] 21 | public string Name { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/Stove.Serilog.Tests/Serilog_Tests.cs: -------------------------------------------------------------------------------- 1 | using Stove.Log; 2 | 3 | using Xunit; 4 | 5 | namespace Stove.Serilog.Tests 6 | { 7 | public class Serilog_Tests : SerilogTestBase 8 | { 9 | public Serilog_Tests() 10 | { 11 | Building(builder => { }).Ok(); 12 | } 13 | 14 | [Fact] 15 | public void should_work() 16 | { 17 | The().Debug("Log Me!"); 18 | The().Warn("Log Me!"); 19 | The().Error("Log Me!"); 20 | The().Info("Log Me!"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Stove.Mapster/Mapster/AutoMapAttributeBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JetBrains.Annotations; 4 | 5 | using Mapster; 6 | 7 | namespace Stove.Mapster 8 | { 9 | public abstract class AutoMapAttributeBase : Attribute 10 | { 11 | protected AutoMapAttributeBase([NotNull] params Type[] targetTypes) 12 | { 13 | TargetTypes = targetTypes; 14 | } 15 | 16 | [NotNull] 17 | public Type[] TargetTypes { get; private set; } 18 | 19 | public abstract void CreateMap([NotNull] TypeAdapterConfig configuration, [NotNull] Type needstoMap); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Stove.RavenDB/RavenDB/Filters/Query/NullRavenQueryFilterExecuter.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | using Stove.Domain.Entities; 4 | 5 | namespace Stove.RavenDB.Filters.Query 6 | { 7 | public class NullRavenQueryFilterExecuter : IRavenQueryFilterExecuter 8 | { 9 | public static readonly NullRavenQueryFilterExecuter Instance = new NullRavenQueryFilterExecuter(); 10 | 11 | public IQueryable ExecuteFilter(IQueryable queryable) where TEntity : class, IEntity 12 | { 13 | return queryable; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Stove.Dapper/Dapper/Filters/Action/IDapperActionFilterExecuter.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | 3 | namespace Stove.Dapper.Filters.Action 4 | { 5 | public interface IDapperActionFilterExecuter 6 | { 7 | void ExecuteCreationAuditFilter(TEntity entity) where TEntity : class, IEntity; 8 | 9 | void ExecuteModificationAuditFilter(TEntity entity) where TEntity : class, IEntity; 10 | 11 | void ExecuteDeletionAuditFilter(TEntity entity) where TEntity : class, IEntity; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/Stove.Dapper.Tests/Entities/Mail.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | using Stove.Domain.Entities.Auditing; 6 | 7 | namespace Stove.Dapper.Tests.Entities 8 | { 9 | [Table("Mails")] 10 | public class Mail : FullAuditedEntity 11 | { 12 | protected Mail() 13 | { 14 | } 15 | 16 | public Mail(string subject) : this() 17 | { 18 | Subject = subject; 19 | } 20 | 21 | [Required] 22 | public string Subject { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Stove.Dapper/Dapper/Repositories/DapperEfRepositoryBase{TDbContext,TEntity}.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | using Stove.Orm; 3 | using Stove.Data; 4 | 5 | namespace Stove.Dapper.Repositories 6 | { 7 | public class DapperEfRepositoryBase : DapperEfRepositoryBase, IDapperRepository 8 | where TEntity : class, IEntity 9 | where TDbContext : class 10 | 11 | { 12 | public DapperEfRepositoryBase(IActiveTransactionProvider activeTransactionProvider) : base(activeTransactionProvider) 13 | { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Stove.RavenDB/RavenDB/Filters/Action/IRavenActionFilterExecuter.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | 3 | namespace Stove.RavenDB.Filters.Action 4 | { 5 | public interface IRavenActionFilterExecuter 6 | { 7 | void ExecuteCreationAuditFilter(TEntity entity) where TEntity : class, IEntity; 8 | 9 | void ExecuteModificationAuditFilter(TEntity entity) where TEntity : class, IEntity; 10 | 11 | void ExecuteDeletionAuditFilter(TEntity entity) where TEntity : class, IEntity; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Stove/Reflection/IStoveAssemblyFinder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Reflection; 3 | 4 | namespace Stove.Reflection 5 | { 6 | /// 7 | /// This interface is used to get assemblies in the application. 8 | /// It may not return all assemblies, but those are related with modules. 9 | /// 10 | public interface IStoveAssemblyFinder 11 | { 12 | /// 13 | /// Gets all assemblies. 14 | /// 15 | /// List of assemblies 16 | List GetAllAssemblies(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/Entities/Mail.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | using Stove.Domain.Entities.Auditing; 6 | 7 | namespace Stove.Demo.ConsoleApp.Entities 8 | { 9 | [Table("Mails")] 10 | public class Mail : FullAuditedEntity 11 | { 12 | protected Mail() 13 | { 14 | } 15 | 16 | public Mail(string subject) : this() 17 | { 18 | Subject = subject; 19 | } 20 | 21 | [Required] 22 | public string Subject { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework/EntityFramework/Utils/EntityDateTimePropertiesInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Reflection; 3 | 4 | namespace Stove.EntityFramework.Utils 5 | { 6 | internal class EntityDateTimePropertiesInfo 7 | { 8 | public List DateTimePropertyInfos { get; set; } 9 | 10 | public List ComplexTypePropertyPaths { get; set; } 11 | 12 | public EntityDateTimePropertiesInfo() 13 | { 14 | DateTimePropertyInfos = new List(); 15 | ComplexTypePropertyPaths = new List(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Stove/Commands/CommandContextOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Commands 2 | { 3 | public class CommandContextOptions 4 | { 5 | public const string DefaultHeader = "X-Correlation-ID"; 6 | 7 | /// 8 | /// The header field name where the correlation ID will be stored. 9 | /// 10 | public string Header { get; set; } = DefaultHeader; 11 | 12 | /// 13 | /// Controls whether the correlation ID is returned in the response headers. 14 | /// 15 | public bool IncludeInResponse { get; set; } = true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Stove/Domain/Entities/Auditing/IHasModificationTime.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Domain.Entities.Auditing 4 | { 5 | /// 6 | /// An entity can implement this interface if of this entity must be stored. 7 | /// is automatically set when updating . 8 | /// 9 | public interface IHasModificationTime 10 | { 11 | /// 12 | /// The last modified time for this entity. 13 | /// 14 | DateTime? LastModificationTime { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Stove.Couchbase/Couchbase/Filters/Action/ICouchbaseActionFilterExecuter.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | 3 | namespace Stove.Couchbase.Filters.Action 4 | { 5 | public interface ICouchbaseActionFilterExecuter 6 | { 7 | void ExecuteCreationAuditFilter(TEntity entity) where TEntity : class, IEntity; 8 | 9 | void ExecuteModificationAuditFilter(TEntity entity) where TEntity : class, IEntity; 10 | 11 | void ExecuteDeletionAuditFilter(TEntity entity) where TEntity : class, IEntity; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Stove.Couchbase/Couchbase/StoveCouchbaseBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Couchbase.Core; 2 | 3 | using Stove.Bootstrapping; 4 | using Stove.Couchbase.Configuration; 5 | 6 | namespace Stove.Couchbase 7 | { 8 | public class StoveCouchbaseBootstrapper : StoveBootstrapper 9 | { 10 | public override void PreStart() 11 | { 12 | StoveConfiguration.GetConfigurerIfExists()(StoveConfiguration.Modules.StoveCouchbase()); 13 | } 14 | 15 | public override void Shutdown() 16 | { 17 | Resolver.Resolve().Dispose(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove.Dapper/Dapper/Repositories/DapperNhRepositoryBase{TStoveSessionContext,TEntity}.cs: -------------------------------------------------------------------------------- 1 | using Stove.Data; 2 | using Stove.Domain.Entities; 3 | 4 | namespace Stove.Dapper.Repositories 5 | { 6 | public class DapperNhRepositoryBase : DapperNhRepositoryBase, IDapperRepository 7 | where TEntity : class, IEntity 8 | where TStoveSessionContext : class 9 | { 10 | public DapperNhRepositoryBase(IActiveTransactionProvider activeTransactionProvider) : base(activeTransactionProvider) 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework/EntityFramework/Repositories/EfRepositoryBase{TEntity}.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity; 2 | 3 | using Stove.Domain.Entities; 4 | using Stove.Domain.Repositories; 5 | 6 | namespace Stove.EntityFramework.Repositories 7 | { 8 | public class EfRepositoryBase : EfRepositoryBase, IRepository 9 | where TEntity : class, IEntity 10 | where TDbContext : DbContext 11 | { 12 | public EfRepositoryBase(IDbContextProvider dbContextProvider) 13 | : base(dbContextProvider) 14 | { 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Stove.Redis/Redis/Configurations/StoveRedisCacheConfiguration.cs: -------------------------------------------------------------------------------- 1 | using StackExchange.Redis; 2 | 3 | using Stove.Configuration; 4 | 5 | namespace Stove.Redis.Configurations 6 | { 7 | public class StoveRedisCacheConfiguration : IStoveRedisCacheConfiguration 8 | { 9 | public StoveRedisCacheConfiguration(IStoveStartupConfiguration configuration) 10 | { 11 | StoveConfiguration = configuration; 12 | ConfigurationOptions = new ConfigurationOptions(); 13 | } 14 | 15 | public ConfigurationOptions ConfigurationOptions { get; set; } 16 | 17 | public IStoveStartupConfiguration StoveConfiguration { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Stove/IO/Extensions/StreamExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | using JetBrains.Annotations; 4 | 5 | namespace Stove.IO.Extensions 6 | { 7 | public static class StreamExtensions 8 | { 9 | [NotNull] 10 | public static byte[] GetAllBytes([NotNull] this Stream stream) 11 | { 12 | byte[] streamBytes; 13 | 14 | using (var memoryStream = new MemoryStream()) 15 | { 16 | stream.CopyTo(memoryStream); 17 | streamBytes = memoryStream.ToArray(); 18 | } 19 | 20 | return streamBytes; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/Stove.Dapper.Tests/Entities/ProductDetail.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | using Stove.Domain.Entities.Auditing; 5 | 6 | namespace Stove.Dapper.Tests.Entities 7 | { 8 | [Table("ProductDetails")] 9 | public class ProductDetail : FullAuditedEntity 10 | { 11 | protected ProductDetail() 12 | { 13 | } 14 | 15 | public ProductDetail(string gender) : this() 16 | { 17 | Gender = gender; 18 | } 19 | 20 | [Required] 21 | public string Gender { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Tests/Domain_Product/Events/VariantAdded.cs: -------------------------------------------------------------------------------- 1 | using Stove.Events.Bus; 2 | 3 | namespace Stove.EntityFrameworkCore.Tests.Domain_Product.Events 4 | { 5 | public class VariantAdded : Event 6 | { 7 | public int ProductId { get; } 8 | 9 | public string Barcode { get; set; } 10 | 11 | public string VariantName { get; set; } 12 | 13 | public VariantAdded(int productId, string barcode, string variantName) 14 | { 15 | ProductId = productId; 16 | Barcode = barcode; 17 | VariantName = variantName; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/Domain/Mapping/ProductBundleMap.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations.Schema; 2 | using System.Data.Entity.ModelConfiguration; 3 | 4 | using Stove.Tests.SampleApplication.Domain.Entities; 5 | 6 | namespace Stove.Tests.SampleApplication.Domain.Mapping 7 | { 8 | public class ProductBundleMap : EntityTypeConfiguration 9 | { 10 | public ProductBundleMap() 11 | { 12 | HasKey(x => x.Id); 13 | 14 | Property(x => x.Name); 15 | 16 | Property(ProductBundle.ProductIdsExpression); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Stove.RavenDB/RavenDB/Uow/UnitOfWorkSessionProvider.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | using Raven.Client.Documents.Session; 4 | 5 | using Stove.Domain.Uow; 6 | 7 | namespace Stove.RavenDB.Uow 8 | { 9 | public class UnitOfWorkSessionProvider : ISessionProvider, ITransientDependency 10 | { 11 | private readonly ICurrentUnitOfWorkProvider _unitOfWorkProvider; 12 | 13 | public UnitOfWorkSessionProvider(ICurrentUnitOfWorkProvider unitOfWorkProvider) 14 | { 15 | _unitOfWorkProvider = unitOfWorkProvider; 16 | } 17 | 18 | public IDocumentSession Session => _unitOfWorkProvider.Current.GetSession(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/Stove.Tests/Utils/Etc/NullDisposableTests.cs: -------------------------------------------------------------------------------- 1 | using Shouldly; 2 | 3 | using Stove.Utils.Etc; 4 | 5 | using Xunit; 6 | 7 | namespace Stove.Tests.Utils.Etc 8 | { 9 | public class NullDisposableTests 10 | { 11 | [Fact] 12 | public void should_be_instantiatable() 13 | { 14 | NullDisposable instance = NullDisposable.Instance; 15 | 16 | instance.ShouldNotBeNull(); 17 | } 18 | 19 | [Fact] 20 | public void should_be_dispose() 21 | { 22 | using (NullDisposable.Instance) 23 | { 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/Utils/EntityDateTimePropertiesInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Reflection; 3 | 4 | namespace Stove.EntityFrameworkCore.Utils 5 | { 6 | internal class EntityDateTimePropertiesInfo 7 | { 8 | public List DateTimePropertyInfos { get; set; } 9 | 10 | public List ComplexTypePropertyPaths { get; set; } 11 | 12 | public EntityDateTimePropertiesInfo() 13 | { 14 | DateTimePropertyInfos = new List(); 15 | ComplexTypePropertyPaths = new List(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /test/Stove.Demo.WebApi/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | // using HibernatingRhinos.Profiler.Appender.EntityFramework; 4 | 5 | using Microsoft.Owin.Hosting; 6 | 7 | namespace Stove.Demo.WebApi 8 | { 9 | public class Program 10 | { 11 | public static void Main() 12 | { 13 | const string localhost = "http://localhost:9000"; 14 | 15 | //EntityFrameworkProfiler.Initialize(); 16 | 17 | using (WebApp.Start(localhost)) 18 | { 19 | Console.WriteLine("Started..."); 20 | Console.Read(); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/Domain/Entities/Campaign.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | using Stove.Tests.SampleApplication.Domain.Events; 3 | 4 | namespace Stove.Tests.SampleApplication.Domain.Entities 5 | { 6 | public class Campaign : AggregateRoot 7 | { 8 | public Campaign(string name) 9 | { 10 | Name = name; 11 | 12 | ApplyChange(new CampaignCreatedEvent { Name = Name }); 13 | } 14 | 15 | public string Name { get; set; } 16 | 17 | public void Apply(CampaignCreatedEvent @event) 18 | { 19 | Name = @event.Name; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Stove/IO/DeleteIfExists.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Stove.IO 4 | { 5 | /// 6 | /// A helper class for File operations. 7 | /// 8 | public static class FileHelper 9 | { 10 | /// 11 | /// Checks and deletes given file if it does exists. 12 | /// 13 | /// Path of the file 14 | public static void DeleteIfExists(string filePath) 15 | { 16 | if (File.Exists(filePath)) 17 | { 18 | File.Delete(filePath); 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Stove/Threading/BackgrodunWorkers/IBackgroundWorkerManager.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Threading.BackgrodunWorkers 2 | { 3 | /// 4 | /// Used to manage background workers. 5 | /// 6 | public interface IBackgroundWorkerManager : IRunnable 7 | { 8 | /// 9 | /// Adds a new worker. Starts the worker immediately if has started. 10 | /// 11 | /// 12 | /// The worker. It should be resolved from IOC. 13 | /// 14 | void Add(IBackgroundWorker worker); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/Domain/Entities/Message.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | using Stove.Domain.Entities.Auditing; 5 | 6 | namespace Stove.Tests.SampleApplication.Domain.Entities 7 | { 8 | [Table(nameof(Message))] 9 | public class Message : FullAuditedEntity 10 | { 11 | protected Message() 12 | { 13 | } 14 | 15 | public Message(string subject) : this() 16 | { 17 | Subject = subject; 18 | } 19 | 20 | [Required] 21 | public string Subject { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Tests/Ef/PostRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Stove.Domain.Repositories; 4 | using Stove.EntityFrameworkCore.Repositories; 5 | using Stove.EntityFrameworkCore.Tests.Domain; 6 | 7 | namespace Stove.EntityFrameworkCore.Tests.Ef 8 | { 9 | public class PostRepository : EfCoreRepositoryBase, IPostRepository 10 | { 11 | public PostRepository(IDbContextProvider dbContextProvider) 12 | : base(dbContextProvider) 13 | { 14 | 15 | } 16 | 17 | public override int Count() 18 | { 19 | throw new Exception("can not get count of posts"); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Tests/Ef/ProductDbContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Stove.EntityFrameworkCore.Tests.Domain_Product; 3 | 4 | namespace Stove.EntityFrameworkCore.Tests.Ef 5 | { 6 | public class ProductDbContext : StoveDbContext 7 | { 8 | public DbSet Products { get; set; } 9 | 10 | public DbSet ProductVariants { get; set; } 11 | 12 | public DbSet VaraintValues { get; set; } 13 | 14 | public ProductDbContext(DbContextOptions options) 15 | : base(options) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Stove/Runtime/Caching/Configuration/CacheConfigurator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Runtime.Caching.Configuration 4 | { 5 | internal class CacheConfigurator : ICacheConfigurator 6 | { 7 | public CacheConfigurator(Action initAction) 8 | { 9 | InitAction = initAction; 10 | } 11 | 12 | public CacheConfigurator(string cacheName, Action initAction) 13 | { 14 | CacheName = cacheName; 15 | InitAction = initAction; 16 | } 17 | 18 | public string CacheName { get; } 19 | 20 | public Action InitAction { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/Stove.Couchbase.Tests/Stove.Couchbase.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework/EntityFramework/Repositories/EfAutoRepositoryTypes.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Repositories; 2 | 3 | namespace Stove.EntityFramework.Repositories 4 | { 5 | public static class EfAutoRepositoryTypes 6 | { 7 | public static AutoRepositoryTypesAttribute Default { get; private set; } 8 | 9 | static EfAutoRepositoryTypes() 10 | { 11 | Default = new AutoRepositoryTypesAttribute( 12 | typeof(IRepository<>), 13 | typeof(IRepository<,>), 14 | typeof(EfRepositoryBase<,>), 15 | typeof(EfRepositoryBase<,,>) 16 | ); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Stove.RavenDB/RavenDB/Configuration/StoveRavenDBConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | using Stove.Configuration; 4 | 5 | namespace Stove.RavenDB.Configuration 6 | { 7 | public class StoveRavenDBConfiguration : IStoveRavenDBConfiguration, ISingletonDependency 8 | { 9 | public StoveRavenDBConfiguration(IStoveStartupConfiguration configuration) 10 | { 11 | Configuration = configuration; 12 | } 13 | 14 | public string[] Urls { get; set; } 15 | 16 | public string DefaultDatabase { get; set; } 17 | 18 | public bool AllowQueriesOnId { get; set; } 19 | 20 | public IStoveStartupConfiguration Configuration { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Stove/BackgroundJobs/IBackgroundJobConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Stove.Configuration; 2 | 3 | namespace Stove.BackgroundJobs 4 | { 5 | /// 6 | /// Used to configure background job system. 7 | /// 8 | public interface IBackgroundJobConfiguration 9 | { 10 | /// 11 | /// Used to enable/disable background job execution. 12 | /// 13 | bool IsJobExecutionEnabled { get; set; } 14 | 15 | /// 16 | /// Gets the Stove configuration object. 17 | /// 18 | IStoveStartupConfiguration StoveConfiguration { get; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/Stove.Serilog.Tests/SerilogTestBase.cs: -------------------------------------------------------------------------------- 1 | using Serilog; 2 | 3 | using Stove.Reflection.Extensions; 4 | using Stove.TestBase; 5 | 6 | namespace Stove.Serilog.Tests 7 | { 8 | public abstract class SerilogTestBase : ApplicationTestBase 9 | { 10 | protected SerilogTestBase() 11 | { 12 | Building(builder => 13 | { 14 | builder.UseStoveSerilog(loggerConfiguration => 15 | { 16 | loggerConfiguration 17 | .WriteTo.Trace() 18 | .MinimumLevel.Debug(); 19 | }); 20 | builder.RegisterServices(r => r.RegisterAssemblyByConvention(typeof(SerilogTestBase).GetAssembly())); 21 | }); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Stove.Couchbase/Couchbase/Uow/UnitOfWorkSessionProvider.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | using Couchbase.Linq; 4 | 5 | using Stove.Domain.Uow; 6 | 7 | namespace Stove.Couchbase.Uow 8 | { 9 | public class UnitOfWorkSessionProvider : ISessionProvider, ITransientDependency 10 | { 11 | private readonly ICurrentUnitOfWorkProvider _unitOfWorkProvider; 12 | 13 | public UnitOfWorkSessionProvider(ICurrentUnitOfWorkProvider unitOfWorkProvider) 14 | { 15 | _unitOfWorkProvider = unitOfWorkProvider; 16 | } 17 | 18 | public IBucketContext Session => _unitOfWorkProvider.Current.GetSession(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove.Dapper/Dapper/Filters/Query/IDapperQueryFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | 4 | using DapperExtensions; 5 | 6 | using Stove.Domain.Entities; 7 | 8 | namespace Stove.Dapper.Filters.Query 9 | { 10 | public interface IDapperQueryFilter 11 | { 12 | string FilterName { get; } 13 | 14 | bool IsEnabled { get; } 15 | 16 | IFieldPredicate ExecuteFilter() where TEntity : class, IEntity; 17 | 18 | Expression> ExecuteFilter(Expression> predicate) where TEntity : class, IEntity; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove.Dapper/Dapper/NhBasedDapperAutoRepositoryTypes.cs: -------------------------------------------------------------------------------- 1 | using Stove.Dapper.Repositories; 2 | 3 | namespace Stove.Dapper 4 | { 5 | public class NhBasedDapperAutoRepositoryTypes 6 | { 7 | static NhBasedDapperAutoRepositoryTypes() 8 | { 9 | Default = new DapperAutoRepositoryTypeAttribute( 10 | typeof(IDapperRepository<>), 11 | typeof(IDapperRepository<,>), 12 | typeof(DapperNhRepositoryBase<,>), 13 | typeof(DapperNhRepositoryBase<,,>) 14 | ); 15 | } 16 | 17 | public static DapperAutoRepositoryTypeAttribute Default { get; private set; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/Repositories/EfCoreRepositoryBase{TEntity}.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | 3 | using Stove.Domain.Entities; 4 | using Stove.Domain.Repositories; 5 | 6 | namespace Stove.EntityFrameworkCore.Repositories 7 | { 8 | public class EfCoreRepositoryBase : EfCoreRepositoryBase, IRepository 9 | where TEntity : class, IEntity 10 | where TDbContext : DbContext 11 | { 12 | public EfCoreRepositoryBase(IDbContextProvider dbContextProvider) 13 | : base(dbContextProvider) 14 | { 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Tests/Domain_Product/VariantValue.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace Stove.EntityFrameworkCore.Tests.Domain_Product 5 | { 6 | public class VariantValue : Entity 7 | { 8 | [Required] 9 | public virtual ProductVariant Variant { get; protected set; } 10 | 11 | public virtual string Value { get; protected set; } 12 | 13 | protected VariantValue() { } 14 | 15 | public VariantValue(ProductVariant variant, string value) 16 | { 17 | Variant = variant; 18 | Value = value; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/Stove.Tests/IO/Extensions/StreamExtensions_Tests.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Text; 3 | 4 | using Shouldly; 5 | 6 | using Stove.IO.Extensions; 7 | 8 | using Xunit; 9 | 10 | namespace Stove.Tests.IO.Extensions 11 | { 12 | public class StreamExtensions_Tests 13 | { 14 | [Fact] 15 | public void GetAllBytes_should_work() 16 | { 17 | byte[] bytes; 18 | using (var whatEverStream = new MemoryStream(Encoding.UTF8.GetBytes("whatever"))) 19 | { 20 | bytes = whatEverStream.GetAllBytes(); 21 | } 22 | 23 | bytes.ShouldNotBeNull(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Stove.Mapster/Mapster/MapsterConfigurationExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | using JetBrains.Annotations; 5 | 6 | using Mapster; 7 | 8 | namespace Stove.Mapster 9 | { 10 | internal static class MapsterConfigurationExtensions 11 | { 12 | public static void CreateAutoAttributeMaps([NotNull] this TypeAdapterConfig configuration, [NotNull] Type type) 13 | { 14 | foreach (AutoMapAttributeBase autoMapAttribute in type.GetTypeInfo().GetCustomAttributes()) 15 | { 16 | autoMapAttribute.CreateMap(configuration, type); 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove.NHibernate/NHibernate/Enrichments/NhAutoRepositoryTypes.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Repositories; 2 | using Stove.NHibernate.Repositories; 3 | 4 | namespace Stove.NHibernate.Enrichments 5 | { 6 | public class NhAutoRepositoryTypes 7 | { 8 | static NhAutoRepositoryTypes() 9 | { 10 | Default = new AutoRepositoryTypesAttribute( 11 | typeof(IRepository<>), 12 | typeof(IRepository<,>), 13 | typeof(NhRepositoryBase<,>), 14 | typeof(NhRepositoryBase<,,>) 15 | ); 16 | } 17 | 18 | public static AutoRepositoryTypesAttribute Default { get; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove.RabbitMQ/RabbitMQ/IStoveRabbitMQConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Stove.Configuration; 2 | 3 | namespace Stove.RabbitMQ 4 | { 5 | public interface IStoveRabbitMQConfiguration 6 | { 7 | string HostAddress { get; set; } 8 | 9 | string Username { get; set; } 10 | 11 | string Password { get; set; } 12 | 13 | string QueueName { get; set; } 14 | 15 | bool UseRetryMechanism { get; set; } 16 | 17 | int MaxRetryCount { get; set; } 18 | 19 | int? PrefetchCount { get; set; } 20 | 21 | int? ConcurrencyLimit { get; set; } 22 | 23 | IStoveStartupConfiguration StoveConfiguration { get; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Stove/Domain/Entities/EntityTypeInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Domain.Entities 4 | { 5 | public class EntityTypeInfo 6 | { 7 | /// 8 | /// Type of the entity. 9 | /// 10 | public Type EntityType { get; private set; } 11 | 12 | /// 13 | /// DbContext type that has DbSet property. 14 | /// 15 | public Type DeclaringType { get; private set; } 16 | 17 | public EntityTypeInfo(Type entityType, Type declaringType) 18 | { 19 | EntityType = entityType; 20 | DeclaringType = declaringType; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /test/Stove.Tests/Events/Bus/MySimpleTransientEventHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | using Stove.Events.Bus.Handlers; 5 | 6 | namespace Stove.Tests.Events.Bus 7 | { 8 | public class MySimpleTransientEventHandler : IEventHandler, IDisposable 9 | { 10 | public static int HandleCount { get; set; } 11 | 12 | public static int DisposeCount { get; set; } 13 | 14 | public void Dispose() 15 | { 16 | ++DisposeCount; 17 | } 18 | 19 | public void Handle(MySimpleEvent @event, Headers headers) 20 | { 21 | ++HandleCount; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Stove/IO/DirectoryHelper.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Stove.IO 4 | { 5 | /// 6 | /// A helper class for Directory operations. 7 | /// 8 | public static class DirectoryHelper 9 | { 10 | /// 11 | /// Creates a new directory if it does not exists. 12 | /// 13 | /// Directory to create 14 | public static void CreateIfNotExists(string directory) 15 | { 16 | if (!Directory.Exists(directory)) 17 | { 18 | Directory.CreateDirectory(directory); 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/Stove.Mapster.Tests/StoveMapsterTestApplication.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | using Stove.Reflection.Extensions; 4 | using Stove.TestBase; 5 | 6 | namespace Stove.Mapster.Tests 7 | { 8 | public class StoveMapsterTestApplication : ApplicationTestBase 9 | { 10 | public StoveMapsterTestApplication() 11 | { 12 | Building(builder => 13 | { 14 | builder 15 | .UseStoveMapster() 16 | .RegisterServices(r => r.RegisterAssemblyByConvention(typeof(StoveMapsterTestApplication).GetAssembly())); 17 | }).Ok(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove.Dapper/Dapper/EfBasedDapperAutoRepositoryTypes.cs: -------------------------------------------------------------------------------- 1 | using Stove.Dapper.Repositories; 2 | 3 | namespace Stove.Dapper 4 | { 5 | public static class EfBasedDapperAutoRepositoryTypes 6 | { 7 | static EfBasedDapperAutoRepositoryTypes() 8 | { 9 | Default = new DapperAutoRepositoryTypeAttribute( 10 | typeof(IDapperRepository<>), 11 | typeof(IDapperRepository<,>), 12 | typeof(DapperEfRepositoryBase<,>), 13 | typeof(DapperEfRepositoryBase<,,>) 14 | ); 15 | } 16 | 17 | public static DapperAutoRepositoryTypeAttribute Default { get; private set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/Repositories/EfCoreAutoRepositoryTypes.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Repositories; 2 | 3 | namespace Stove.EntityFrameworkCore.Repositories 4 | { 5 | public static class EfCoreAutoRepositoryTypes 6 | { 7 | public static AutoRepositoryTypesAttribute Default { get; } 8 | 9 | static EfCoreAutoRepositoryTypes() 10 | { 11 | Default = new AutoRepositoryTypesAttribute( 12 | typeof(IRepository<>), 13 | typeof(IRepository<,>), 14 | typeof(EfCoreRepositoryBase<,>), 15 | typeof(EfCoreRepositoryBase<,,>) 16 | ); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Stove.NHibernate/NHibernate/Enrichments/StoveSessionContext.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | using Stove.Domain.Entities; 4 | 5 | namespace Stove.NHibernate.Enrichments 6 | { 7 | /// 8 | /// This class will be used for seperating the Databases. 9 | /// We can assume that just like as EF's DbContext. Put your entities in here which are inherited from 10 | /// with . 11 | /// Repository generation/registration will be completed automatically. 12 | /// 13 | public abstract class StoveSessionContext : ITransientDependency 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Stove.NHibernate/NHibernate/SessionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | 3 | using NHibernate; 4 | 5 | namespace Stove.NHibernate 6 | { 7 | public static class SessionExtensions 8 | { 9 | public static ISession OpenSessionWithConnection(this ISession session, DbConnection connection) 10 | { 11 | return session.SessionWithOptions().Connection(connection).OpenSession(); 12 | } 13 | 14 | public static ISession OpenSessionWithConnection(this ISessionFactory sessionFactory, DbConnection connection) 15 | { 16 | return sessionFactory.OpenSession().OpenSessionWithConnection(connection); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Stove/Events/Bus/Entities/AggregateChangeReport.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace Stove.Events.Bus.Entities 5 | { 6 | public class AggregateChangeReport 7 | { 8 | public AggregateChangeReport() 9 | { 10 | DomainEvents = new List(); 11 | } 12 | 13 | public List DomainEvents { get; } 14 | 15 | public bool IsEmpty() 16 | { 17 | return !DomainEvents.Any(); 18 | } 19 | 20 | public override string ToString() 21 | { 22 | return $"[AggregateChangeReport] DomainEvents: {DomainEvents.Count}"; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Stove/Log/LogHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Log 4 | { 5 | /// 6 | /// This class can be used to write logs from somewhere where it's a hard to get a reference to the 7 | /// . 8 | /// Normally, use with property injection wherever it's possible. 9 | /// 10 | public static class LogHelper 11 | { 12 | public static void LogException(this ILogger logger, Exception ex) 13 | { 14 | LogSeverity severity = (ex as IHasLogSeverity)?.Severity ?? LogSeverity.Error; 15 | 16 | logger.Log(severity, ex.Message, ex); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Stove/Runtime/Caching/Configuration/ICacheConfigurator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Runtime.Caching.Configuration 4 | { 5 | /// 6 | /// A registered cache configurator. 7 | /// 8 | public interface ICacheConfigurator 9 | { 10 | /// 11 | /// Name of the cache. 12 | /// It will be null if this configurator configures all caches. 13 | /// 14 | string CacheName { get; } 15 | 16 | /// 17 | /// Configuration action. Called just after the cache is created. 18 | /// 19 | Action InitAction { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Dapper.Tests/Ef/PostRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Stove.EntityFrameworkCore.Dapper.Tests.Domain; 4 | using Stove.EntityFrameworkCore.Repositories; 5 | 6 | namespace Stove.EntityFrameworkCore.Dapper.Tests.Ef 7 | { 8 | public class PostRepository : EfCoreRepositoryBase, IPostRepository 9 | { 10 | public PostRepository(IDbContextProvider dbContextProvider) 11 | : base(dbContextProvider) 12 | { 13 | 14 | } 15 | 16 | public override int Count() 17 | { 18 | throw new Exception("can not get count of posts"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Stove/Events/Bus/Handlers/IEventHandler{TEvent}.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Events.Bus.Handlers 2 | { 3 | /// 4 | /// 5 | /// Defines an interface of a class that handles events of type . 6 | /// 7 | /// Event type to handle 8 | public interface IEventHandler : IEventHandler 9 | { 10 | /// 11 | /// Handler handles the event by implementing this method. 12 | /// 13 | /// 14 | /// 15 | void Handle(TEvent @event, Headers headers); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/Stove.Dapper.Tests/Scripts/DestroyScript.sql: -------------------------------------------------------------------------------- 1 | IF(EXISTS ( SELECT * 2 | FROM INFORMATION_SCHEMA.TABLES 3 | WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'Products')) 4 | BEGIN 5 | DROP TABLE dbo.Products 6 | END 7 | 8 | IF(EXISTS ( SELECT * 9 | FROM INFORMATION_SCHEMA.TABLES 10 | WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'ProductDetails')) 11 | BEGIN 12 | DROP TABLE dbo.ProductDetails 13 | END 14 | 15 | 16 | IF(EXISTS ( SELECT * 17 | FROM INFORMATION_SCHEMA.TABLES 18 | WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'Mails')) 19 | BEGIN 20 | DROP TABLE dbo.Mails 21 | END -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/SampleApplicationBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Stove.Bootstrapping; 2 | using Stove.EntityFramework; 3 | using Stove.Mapster; 4 | 5 | namespace Stove.Tests.SampleApplication 6 | { 7 | [DependsOn( 8 | typeof(StoveKernelBootstrapper), 9 | typeof(StoveEntityFrameworkBootstrapper), 10 | typeof(StoveMapsterBootstrapper) 11 | )] 12 | public class SampleApplicationBootstrapper : StoveBootstrapper 13 | { 14 | public override void Start() 15 | { 16 | StoveConfiguration.Modules.StoveMapster().Configurators.Add(config => 17 | { 18 | //add mapping.... 19 | }); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Stove.Couchbase/Couchbase/Uow/UnitOfWorkExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Couchbase.Linq; 4 | 5 | using Stove.Domain.Uow; 6 | 7 | namespace Stove.Couchbase.Uow 8 | { 9 | public static class UnitOfWorkExtensions 10 | { 11 | public static IBucketContext GetSession(this IActiveUnitOfWork unitOfWork) 12 | { 13 | if (unitOfWork == null) throw new ArgumentNullException(nameof(unitOfWork)); 14 | 15 | if (!(unitOfWork is CouchbaseUnitOfWork)) throw new ArgumentException("unitOfWork is not type of " + typeof(CouchbaseUnitOfWork).FullName, nameof(unitOfWork)); 16 | 17 | return ((CouchbaseUnitOfWork)unitOfWork).Session; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove/Data/IActiveTransactionProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | 3 | namespace Stove.Data 4 | { 5 | public interface IActiveTransactionProvider 6 | { 7 | /// 8 | /// Gets the active transaction. 9 | /// 10 | /// 11 | /// 12 | IDbTransaction GetActiveTransaction(ActiveTransactionProviderArgs args); 13 | 14 | /// 15 | /// Gets the active connection. 16 | /// 17 | /// 18 | /// 19 | IDbConnection GetActiveConnection(ActiveTransactionProviderArgs args); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Stove.RavenDB/RavenDB/Uow/UnitOfWorkExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Raven.Client.Documents.Session; 4 | 5 | using Stove.Domain.Uow; 6 | 7 | namespace Stove.RavenDB.Uow 8 | { 9 | internal static class UnitOfWorkExtensions 10 | { 11 | public static IDocumentSession GetSession(this IActiveUnitOfWork unitOfWork) 12 | { 13 | if (unitOfWork == null) throw new ArgumentNullException(nameof(unitOfWork)); 14 | 15 | if (!(unitOfWork is RavenDBUnitOfWork)) throw new ArgumentException("unitOfWork is not type of " + typeof(RavenDBUnitOfWork).FullName, nameof(unitOfWork)); 16 | 17 | return ((RavenDBUnitOfWork)unitOfWork).Session; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove/Log/LogSeverity.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Log 2 | { 3 | /// 4 | /// Indicates severity for log. 5 | /// 6 | public enum LogSeverity 7 | { 8 | /// 9 | /// Debug. 10 | /// 11 | Debug, 12 | 13 | /// 14 | /// Info. 15 | /// 16 | Info, 17 | 18 | /// 19 | /// Warn. 20 | /// 21 | Warn, 22 | 23 | /// 24 | /// Error. 25 | /// 26 | Error, 27 | 28 | /// 29 | /// Fatal. 30 | /// 31 | Fatal 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Stove.Mapster/Mapster/StoveMapsterConfigurationExtensions.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | 3 | using Stove.Configuration; 4 | 5 | namespace Stove.Mapster 6 | { 7 | public static class StoveMapsterConfigurationExtensions 8 | { 9 | /// 10 | /// Stove Mapster Configuration 11 | /// 12 | /// The configurations. 13 | /// 14 | [NotNull] 15 | public static IStoveMapsterConfiguration StoveMapster([NotNull] this IModuleConfigurations configurations) 16 | { 17 | return configurations.StoveConfiguration.Get(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove/Domain/Entities/Auditing/IFullAudited.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Domain.Entities.Auditing 2 | { 3 | /// 4 | /// This interface ads to for a fully audited entity. 5 | /// 6 | public interface IFullAudited : IAudited, IDeletionAudited 7 | { 8 | 9 | } 10 | 11 | /// 12 | /// Adds navigation properties to interface for user. 13 | /// 14 | /// Type of the user 15 | public interface IFullAudited : IAudited, IFullAudited, IDeletionAudited 16 | where TUser : IEntity 17 | { 18 | 19 | } 20 | } -------------------------------------------------------------------------------- /src/Stove.Mapster/Mapster/StoveMapsterConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Mapster; 5 | 6 | namespace Stove.Mapster 7 | { 8 | public class StoveMapsterConfiguration : IStoveMapsterConfiguration 9 | { 10 | public StoveMapsterConfiguration() 11 | { 12 | Configurators = new List>(); 13 | Configuration = TypeAdapterConfig.GlobalSettings; 14 | Adapter = new Adapter(Configuration); 15 | } 16 | 17 | public TypeAdapterConfig Configuration { get; } 18 | 19 | public List> Configurators { get; } 20 | 21 | public IAdapter Adapter { get; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/Stove.RavenDB.Tests/Stove.RavenDB.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/Stove.Tests/Domain/Entities/EntityHelper_Tests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Shouldly; 4 | 5 | using Stove.Domain.Entities; 6 | 7 | using Xunit; 8 | 9 | namespace Stove.Tests.Domain.Entities 10 | { 11 | public class EntityHelper_Tests 12 | { 13 | [Fact] 14 | public void Get_primary_key_type_tests() 15 | { 16 | EntityHelper.GetPrimaryKeyType().ShouldBe(typeof(int)); 17 | EntityHelper.GetPrimaryKeyType(typeof(Manager)).ShouldBe(typeof(int)); 18 | EntityHelper.GetPrimaryKeyType(typeof(TestEntityWithGuidPk)).ShouldBe(typeof(Guid)); 19 | } 20 | 21 | private class TestEntityWithGuidPk : Entity 22 | { 23 | 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Stove/Extensions/ExceptionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.ExceptionServices; 3 | 4 | namespace Stove.Extensions 5 | { 6 | /// 7 | /// Extension methods for class. 8 | /// 9 | public static class ExceptionExtensions 10 | { 11 | /// 12 | /// Uses method to re-throws exception 13 | /// while preserving stack trace. 14 | /// 15 | /// Exception to be re-thrown 16 | public static void ReThrow(this Exception exception) 17 | { 18 | ExceptionDispatchInfo.Capture(exception).Throw(); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /test/Stove.EntityFrameworkCore.Tests/Domain/Post.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | using Stove.Domain.Entities.Auditing; 5 | 6 | namespace Stove.EntityFrameworkCore.Tests.Domain 7 | { 8 | public class Post : AuditedEntity 9 | { 10 | [Required] 11 | public virtual Blog Blog { get; set; } 12 | 13 | public virtual string Title { get; set; } 14 | 15 | public virtual string Body { get; set; } 16 | 17 | public Post() 18 | { 19 | 20 | } 21 | 22 | public Post(Blog blog, string title, string body) 23 | { 24 | Blog = blog; 25 | Title = title; 26 | Body = body; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Stove.RabbitMQ/RabbitMQ/StoveRabbitMQConfigurationExtensions.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | 3 | using Stove.Configuration; 4 | 5 | namespace Stove.RabbitMQ 6 | { 7 | public static class StoveRabbitMQConfigurationExtensions 8 | { 9 | /// 10 | /// Gets RabbitMQ Configuration from Ioc Container. 11 | /// 12 | /// The configurations. 13 | /// 14 | [NotNull] 15 | public static IStoveRabbitMQConfiguration StoveRabbitMQ([NotNull] this IModuleConfigurations configurations) 16 | { 17 | return configurations.StoveConfiguration.Get(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/Stove.Demo.WebApi/Controllers/ProductController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | 3 | using Stove.Demo.WebApi.AppServices; 4 | using Stove.Demo.WebApi.Dtos; 5 | 6 | namespace Stove.Demo.WebApi.Controllers 7 | { 8 | [RoutePrefix("product")] 9 | public class ProductController : ApiController 10 | { 11 | private readonly IProductAppService _productAppService; 12 | 13 | public ProductController(IProductAppService productAppService) 14 | { 15 | _productAppService = productAppService; 16 | } 17 | 18 | [Route("Add")] 19 | public AddProductOutput AddProduct(AddProductInput input) 20 | { 21 | return _productAppService.AddProduct(input); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Stove.Tests/Threading/AsyncHelper_Tests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | using Shouldly; 4 | 5 | using Stove.Threading; 6 | 7 | using Xunit; 8 | 9 | namespace Stove.Tests.Threading 10 | { 11 | public class AsyncHelper_Tests 12 | { 13 | [Fact] 14 | public void Test1() 15 | { 16 | AsyncHelper.RunSync(AsyncMethod1); 17 | AsyncHelper.RunSync(() => AsyncMethod2(21)).ShouldBe(42); 18 | } 19 | 20 | private async Task AsyncMethod1() 21 | { 22 | await Task.Delay(10); 23 | } 24 | 25 | private async Task AsyncMethod2(int p) 26 | { 27 | await Task.Delay(10); 28 | return p * 2; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Stove/Runtime/Session/NullStoveSession.cs: -------------------------------------------------------------------------------- 1 | using Stove.Runtime.Remoting; 2 | 3 | namespace Stove.Runtime.Session 4 | { 5 | /// 6 | /// Implements null object pattern for . 7 | /// 8 | public class NullStoveSession : StoveSessionBase 9 | { 10 | private NullStoveSession() : base(new DataContextAmbientScopeProvider(new AsyncLocalAmbientDataContext())) 11 | { 12 | } 13 | 14 | /// 15 | /// Singleton instance. 16 | /// 17 | public static NullStoveSession Instance { get; } = new NullStoveSession(); 18 | 19 | /// 20 | public override long? UserId => null; 21 | 22 | public override long? ImpersonatorUserId => null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Stove.NHibernate/NHibernate/EntityMappings/EntityMap{TEntity}.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | 3 | namespace Stove.NHibernate.EntityMappings 4 | { 5 | /// 6 | /// A shortcut of for most used primary key type (). 7 | /// 8 | /// Entity map 9 | public abstract class EntityMap : EntityMap where TEntity : IEntity 10 | { 11 | /// 12 | /// Constructor. 13 | /// 14 | /// Table name 15 | protected EntityMap(string tableName) 16 | : base(tableName) 17 | { 18 | 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Stove/Runtime/Caching/TypedCacheExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Stove.Runtime.Caching 5 | { 6 | /// 7 | /// Extension methods for . 8 | /// 9 | public static class TypedCacheExtensions 10 | { 11 | public static TValue Get(this ITypedCache cache, TKey key, Func factory) 12 | { 13 | return cache.Get(key, k => factory()); 14 | } 15 | 16 | public static Task GetAsync(this ITypedCache cache, TKey key, Func> factory) 17 | { 18 | return cache.GetAsync(key, k => factory()); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/ConnectionStringHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | 3 | namespace Stove.Demo.ConsoleApp 4 | { 5 | public static class ConnectionStringHelper 6 | { 7 | /// 8 | /// Gets connection string from given connection string or name. 9 | /// 10 | public static string GetConnectionString(string nameOrConnectionString) 11 | { 12 | ConnectionStringSettings connStrSection = ConfigurationManager.ConnectionStrings[nameOrConnectionString]; 13 | if (connStrSection != null) 14 | { 15 | return connStrSection.ConnectionString; 16 | } 17 | 18 | return nameOrConnectionString; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/Stove.Hangfire.Tests/HangfireApplicationTestBase.cs: -------------------------------------------------------------------------------- 1 | using Hangfire.MemoryStorage; 2 | 3 | using Stove.TestBase; 4 | 5 | namespace Stove.Hangfire.Tests 6 | { 7 | public class HangfireApplicationTestBase : ApplicationTestBase 8 | { 9 | public HangfireApplicationTestBase() 10 | { 11 | Building(builder => 12 | { 13 | builder 14 | .UseStoveBackgroundJobs() 15 | .UseStoveHangfire(configuration => 16 | { 17 | configuration.GlobalConfiguration.UseMemoryStorage(); 18 | return configuration; 19 | }); 20 | }); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework/EntityFramework/Uow/ActiveTransactionInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.Entity; 3 | 4 | namespace Stove.EntityFramework.Uow 5 | { 6 | public class ActiveTransactionInfo 7 | { 8 | public DbContextTransaction DbContextTransaction { get; } 9 | 10 | public DbContext StarterDbContext { get; } 11 | 12 | public List AttendedDbContexts { get; } 13 | 14 | public ActiveTransactionInfo(DbContextTransaction dbContextTransaction, DbContext starterDbContext) 15 | { 16 | DbContextTransaction = dbContextTransaction; 17 | StarterDbContext = starterDbContext; 18 | 19 | AttendedDbContexts = new List(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/Configuration/StoveAspNetCoreConfigurationExtensions.cs: -------------------------------------------------------------------------------- 1 | using Stove.Configuration; 2 | 3 | namespace Stove.EntityFrameworkCore.Configuration 4 | { 5 | /// 6 | /// Defines extension methods to to allow to configure Stove EntityFramework Core 7 | /// module. 8 | /// 9 | public static class StoveEfCoreConfigurationExtensions 10 | { 11 | /// 12 | /// Used to configure Stove EntityFramework Core module. 13 | /// 14 | public static IStoveEfCoreConfiguration StoveEfCore(this IModuleConfigurations configurations) 15 | { 16 | return configurations.StoveConfiguration.Get(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Stove/MQ/IMessageBus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Stove.MQ 5 | { 6 | public interface IMessageBus 7 | { 8 | Task Publish(TMessage message) where TMessage : class; 9 | 10 | Task Publish(object message) where TMessage : class; 11 | 12 | Task Publish(object message); 13 | 14 | Task Publish(object message, Type messageType); 15 | 16 | Task CallRequest(TRequest request, TimeSpan timeout, string queueName) where TRequest : class where TResponse : class; 17 | 18 | Task CallRequest(TRequest request, TimeSpan timeout, Uri queueUri) where TRequest : class where TResponse : class; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/Stove.Redis.Tests/RedisTestBase.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | using NSubstitute; 4 | 5 | using StackExchange.Redis; 6 | 7 | using Stove.Reflection.Extensions; 8 | using Stove.TestBase; 9 | 10 | namespace Stove.Redis.Tests 11 | { 12 | public abstract class RedisTestBase : ApplicationTestBase 13 | { 14 | protected RedisTestBase() 15 | { 16 | Building(builder => 17 | { 18 | builder.UseStoveRedisCaching(configuration => 19 | { 20 | configuration.ConfigurationOptions = new ConfigurationOptions(); 21 | return configuration; 22 | }) 23 | .RegisterServices(r => r.RegisterAssemblyByConvention(typeof(RedisTestBase).GetAssembly())); 24 | }); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Stove.Dapper/Dapper/DapperAutoRepositoryTypeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JetBrains.Annotations; 4 | 5 | using Stove.Domain.Repositories; 6 | 7 | namespace Stove.Dapper 8 | { 9 | public class DapperAutoRepositoryTypeAttribute : AutoRepositoryTypesAttribute 10 | { 11 | public DapperAutoRepositoryTypeAttribute( 12 | [NotNull] Type repositoryInterface, 13 | [NotNull] Type repositoryInterfaceWithPrimaryKey, 14 | [NotNull] Type repositoryImplementation, 15 | [NotNull] Type repositoryImplementationWithPrimaryKey) 16 | : base(repositoryInterface, repositoryInterfaceWithPrimaryKey, repositoryImplementation, repositoryImplementationWithPrimaryKey) 17 | { 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove.HangFire/Hangfire/Configurations/StoveHangFireConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | using Hangfire; 4 | 5 | using Stove.Configuration; 6 | 7 | namespace Stove.Hangfire.Configurations 8 | { 9 | public class StoveHangfireConfiguration : IStoveHangfireConfiguration, ISingletonDependency 10 | { 11 | public StoveHangfireConfiguration(IStoveStartupConfiguration configuration) 12 | { 13 | StoveConfiguration = configuration; 14 | } 15 | 16 | public BackgroundJobServer Server { get; set; } 17 | 18 | public IGlobalConfiguration GlobalConfiguration => global::Hangfire.GlobalConfiguration.Configuration; 19 | 20 | public IStoveStartupConfiguration StoveConfiguration { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Stove/Events/Bus/Factories/IEventHandlerFactory.cs: -------------------------------------------------------------------------------- 1 | using Stove.Events.Bus.Handlers; 2 | 3 | namespace Stove.Events.Bus.Factories 4 | { 5 | /// 6 | /// Defines an interface for factories those are responsible to create/get and release of event handlers. 7 | /// 8 | public interface IEventHandlerFactory 9 | { 10 | /// 11 | /// Gets an event handler. 12 | /// 13 | /// The event handler 14 | IEventHandler GetHandler(); 15 | 16 | /// 17 | /// Releases the handler. 18 | /// 19 | /// The handler. 20 | void ReleaseHandler(IEventHandler handler); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/Stove.Demo.WebApi/Controllers/HelpController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | 3 | namespace Stove.Demo.WebApi.Controllers 4 | { 5 | [RoutePrefix("")] 6 | public class HelpController : ApiController 7 | { 8 | /// 9 | /// 10 | /// 11 | [HttpGet] 12 | [Route("")] 13 | public IHttpActionResult Index() 14 | { 15 | return Redirect($"{Request.RequestUri.AbsoluteUri}help/index"); 16 | } 17 | 18 | /// 19 | /// 20 | /// 21 | [HttpGet] 22 | [Route("healthcheck")] 23 | public IHttpActionResult Ping() 24 | { 25 | return Ok(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Stove/Domain/Entities/Auditing/IAudited.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Domain.Entities.Auditing 2 | { 3 | /// 4 | /// This interface is implemented by entities which must be audited. 5 | /// Related properties automatically set when saving/updating objects. 6 | /// 7 | public interface IAudited : ICreationAudited, IModificationAudited 8 | { 9 | 10 | } 11 | 12 | /// 13 | /// Adds navigation properties to interface for user. 14 | /// 15 | /// Type of the user 16 | public interface IAudited : IAudited, ICreationAudited, IModificationAudited 17 | where TUser : IEntity 18 | { 19 | 20 | } 21 | } -------------------------------------------------------------------------------- /src/Stove.Dapper/Dapper/Filters/Query/NullDapperQueryFilterExecuter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | 4 | using DapperExtensions; 5 | 6 | using Stove.Domain.Entities; 7 | 8 | namespace Stove.Dapper.Filters.Query 9 | { 10 | public class NullDapperQueryFilterExecuter : IDapperQueryFilterExecuter 11 | { 12 | public static readonly NullDapperQueryFilterExecuter Instance = new NullDapperQueryFilterExecuter(); 13 | 14 | public IPredicate ExecuteFilter(Expression> predicate) where TEntity : class, IEntity 15 | { 16 | return null; 17 | } 18 | 19 | public PredicateGroup ExecuteFilter() where TEntity : class, IEntity 20 | { 21 | return null; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework/EntityFramework/Uow/UnitOfWorkExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Entity; 3 | 4 | using Stove.Domain.Uow; 5 | 6 | namespace Stove.EntityFramework.Uow 7 | { 8 | public static class UnitOfWorkExtensions 9 | { 10 | public static TDbContext GetDbContext(this IActiveUnitOfWork unitOfWork) 11 | where TDbContext : DbContext 12 | { 13 | if (unitOfWork == null) throw new ArgumentNullException(nameof(unitOfWork)); 14 | 15 | if (!(unitOfWork is EfUnitOfWork)) throw new ArgumentException("unitOfWork is not type of " + typeof(EfUnitOfWork).FullName, nameof(unitOfWork)); 16 | 17 | return ((EfUnitOfWork)unitOfWork).GetOrCreateDbContext(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove.HangFire/Hangfire/GlobalConfigurationExtensions.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | 3 | using Hangfire; 4 | using Hangfire.Annotations; 5 | 6 | namespace Stove.Hangfire 7 | { 8 | public static class GlobalConfigurationExtensions 9 | { 10 | public static IGlobalConfiguration UseAutofacActivator( 11 | [NotNull] this IGlobalConfiguration configuration, 12 | [NotNull] ILifetimeScope lifetimeScope, bool useTaggedLifetimeScope = true) 13 | { 14 | Check.NotNull(configuration, nameof(configuration)); 15 | Check.NotNull(lifetimeScope, nameof(lifetimeScope)); 16 | 17 | return configuration.UseActivator(new AutofacJobActivator(lifetimeScope, useTaggedLifetimeScope)); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Stove/Linq/NullAsyncQueryableExecuter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | namespace Stove.Linq 6 | { 7 | public class NullAsyncQueryableExecuter : IAsyncQueryableExecuter 8 | { 9 | public static NullAsyncQueryableExecuter Instance { get; } = new NullAsyncQueryableExecuter(); 10 | 11 | public Task CountAsync(IQueryable queryable) 12 | { 13 | return Task.FromResult(queryable.Count()); 14 | } 15 | 16 | public Task> ToListAsync(IQueryable queryable) 17 | { 18 | return Task.FromResult(queryable.ToList()); 19 | } 20 | 21 | public Task FirstOrDefaultAsync(IQueryable queryable) 22 | { 23 | return Task.FromResult(queryable.FirstOrDefault()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Stove/Utils/ExpressionUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | 4 | namespace Stove.Utils 5 | { 6 | public static class ExpressionUtils 7 | { 8 | public static Expression> MakePredicate( 9 | string name, 10 | object value, 11 | Type typeOfValue = null) 12 | { 13 | ParameterExpression param = Expression.Parameter(typeof(T), typeof(T).Name); 14 | MemberExpression memberExp = Expression.Property(param, name); 15 | BinaryExpression body = Expression.Equal(memberExp, typeOfValue == null ? Expression.Constant(value) : Expression.Constant(value, typeOfValue)); 16 | return Expression.Lambda>(body, param); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/Stove.Demo.WebApi/DomainServices/ProductDomainService.cs: -------------------------------------------------------------------------------- 1 | using Stove.Demo.WebApi.Entities; 2 | using Stove.Domain.Repositories; 3 | using Stove.Domain.Services; 4 | 5 | namespace Stove.Demo.WebApi.DomainServices 6 | { 7 | public class ProductDomainService : DomainService 8 | { 9 | private readonly IRepository _productRepository; 10 | 11 | public ProductDomainService(IRepository productRepository) 12 | { 13 | _productRepository = productRepository; 14 | } 15 | 16 | public Product Add(string productName) 17 | { 18 | var product = new Product(productName); 19 | 20 | _productRepository.InsertAndGetId(product); 21 | 22 | return product; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/Stove.Tests/DisposeAction_Tests.cs: -------------------------------------------------------------------------------- 1 | using Chill; 2 | 3 | using Shouldly; 4 | 5 | using Xunit; 6 | 7 | namespace Stove.Tests 8 | { 9 | public class DisposeAction_Test : GivenWhenThen 10 | { 11 | public DisposeAction_Test() 12 | { 13 | Given(() => 14 | { 15 | SetThe().To(new DisposeAction(() => _actionIsCalled = true)); 16 | }); 17 | 18 | When(() => 19 | { 20 | The().Dispose(); 21 | }); 22 | } 23 | 24 | private bool _actionIsCalled; 25 | 26 | [Fact] 27 | public void Should_Call_Action_When_Disposed() 28 | { 29 | _actionIsCalled.ShouldBe(true); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/Stove.Tests/Threading/LockExtensions_Tests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using Shouldly; 4 | 5 | using Stove.Threading.Extensions; 6 | 7 | using Xunit; 8 | 9 | namespace Stove.Tests.Threading 10 | { 11 | public class LockExtensions_Tests 12 | { 13 | private readonly List _list; 14 | 15 | public LockExtensions_Tests() 16 | { 17 | _list = new List { 1 }; 18 | } 19 | 20 | [Fact] 21 | public void Test_Locking() 22 | { 23 | //Just sample usages: 24 | _list.Locking(() => { }); 25 | _list.Locking(list => { }); 26 | _list.Locking(() => 42).ShouldBe(42); 27 | _list.Locking(list => 42).ShouldBe(42); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/Stove.Demo.WebApiCore/Stove.Demo.WebApiCore.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/Domain/Entities/ProductDetail.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | using JetBrains.Annotations; 5 | 6 | using Stove.Domain.Entities; 7 | 8 | namespace Stove.Tests.SampleApplication.Domain.Entities 9 | { 10 | [Table("ProductDetail")] 11 | public class ProductDetail : Entity 12 | { 13 | private ProductDetail() 14 | { 15 | } 16 | 17 | [Required] 18 | [NotNull] 19 | public virtual string Description { get; protected set; } 20 | 21 | [Required] 22 | [NotNull] 23 | public virtual Product Product { get; protected set; } 24 | public int ProductId { get; [UsedImplicitly] private set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/Stove.Demo.WebApi/DbContexts/StoveDemoDbContext.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | using Stove.Demo.WebApi.Entities; 5 | using Stove.EntityFramework; 6 | 7 | namespace Stove.Demo.WebApi.DbContexts 8 | { 9 | public class StoveDemoDbContext : StoveDbContext 10 | { 11 | public StoveDemoDbContext() : base("Default") 12 | { 13 | } 14 | 15 | public StoveDemoDbContext(string nameOrConnectionString) : base(nameOrConnectionString) 16 | { 17 | } 18 | 19 | protected StoveDemoDbContext(DbConnection existingConnection, bool contextOwnsConnection) : base(existingConnection, contextOwnsConnection) 20 | { 21 | } 22 | 23 | public virtual IDbSet Products { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Stove.Dapper/Dapper/Filters/Action/NullDapperActionFilterExecuter.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | 3 | namespace Stove.Dapper.Filters.Action 4 | { 5 | public class NullDapperActionFilterExecuter : IDapperActionFilterExecuter 6 | { 7 | public static readonly NullDapperActionFilterExecuter Instance = new NullDapperActionFilterExecuter(); 8 | 9 | public void ExecuteCreationAuditFilter(TEntity entity) where TEntity : class, IEntity 10 | { 11 | } 12 | 13 | public void ExecuteModificationAuditFilter(TEntity entity) where TEntity : class, IEntity 14 | { 15 | } 16 | 17 | public void ExecuteDeletionAuditFilter(TEntity entity) where TEntity : class, IEntity 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/Configuration/StoveDbContextConfigurerAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Microsoft.EntityFrameworkCore; 4 | 5 | namespace Stove.EntityFrameworkCore.Configuration 6 | { 7 | public class StoveDbContextConfigurerAction : IStoveDbContextConfigurer 8 | where TDbContext : DbContext 9 | { 10 | public Action> Action { get; set; } 11 | 12 | public StoveDbContextConfigurerAction(Action> action) 13 | { 14 | Action = action; 15 | } 16 | 17 | public void Configure(StoveDbContextConfiguration configuration) 18 | { 19 | Action(configuration); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Stove/ObjectMapping/NullObjectMapper.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | namespace Stove.ObjectMapping 4 | { 5 | public sealed class NullObjectMapper : IObjectMapper, ISingletonDependency 6 | { 7 | /// 8 | /// Singleton instance. 9 | /// 10 | public static NullObjectMapper Instance { get; } = new NullObjectMapper(); 11 | 12 | public TDestination Map(object source) 13 | { 14 | throw new StoveException("Stove.ObjectMapping.IObjectMapper should be implemented in order to map objects."); 15 | } 16 | 17 | public TDestination Map(TSource source, TDestination destination) 18 | { 19 | throw new StoveException("Stove.ObjectMapping.IObjectMapper should be implemented in order to map objects."); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Stove/Runtime/Caching/Memory/StoveMemoryCacheManager.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Extras.IocManager; 2 | 3 | using Stove.Runtime.Caching.Configuration; 4 | 5 | namespace Stove.Runtime.Caching.Memory 6 | { 7 | /// 8 | /// Implements to work with MemoryCache />. 9 | /// 10 | public class StoveMemoryCacheManager : CacheManagerBase 11 | { 12 | /// 13 | /// Constructor. 14 | /// 15 | public StoveMemoryCacheManager(IScopeResolver scopeResolver, ICachingConfiguration configuration) 16 | : base(scopeResolver.BeginScope(), configuration) 17 | { 18 | } 19 | 20 | protected override ICache CreateCacheImplementation(string name) 21 | { 22 | return ScopeResolver.Resolve(new { name }); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Stove/Threading/IRunnable.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Threading 2 | { 3 | /// 4 | /// Interface to start/stop self threaded services. 5 | /// 6 | public interface IRunnable 7 | { 8 | /// 9 | /// Starts the service. 10 | /// 11 | void Start(); 12 | 13 | /// 14 | /// Sends stop command to the service. 15 | /// Service may return immediately and stop asynchronously. 16 | /// A client should then call method to ensure it's stopped. 17 | /// 18 | void Stop(); 19 | 20 | /// 21 | /// Waits the service to stop. 22 | /// 23 | void WaitToStop(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/DbContexes/AnimalDbContext.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | using Stove.Demo.ConsoleApp.Entities; 5 | using Stove.EntityFramework; 6 | 7 | namespace Stove.Demo.ConsoleApp.DbContexes 8 | { 9 | public class AnimalStoveDbContext : StoveDbContext 10 | { 11 | public AnimalStoveDbContext() : base("Default") 12 | { 13 | } 14 | 15 | public AnimalStoveDbContext(string nameOrConnectionString) : base(nameOrConnectionString) 16 | { 17 | } 18 | 19 | public AnimalStoveDbContext(DbConnection existingConnection, bool contextOwnsConnection) : base(existingConnection, contextOwnsConnection) 20 | { 21 | } 22 | 23 | public virtual IDbSet Animals { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Stove.NHibernate/NHibernate/Uow/UnitOfWorkExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using NHibernate; 4 | 5 | using Stove.Domain.Uow; 6 | using Stove.NHibernate.Enrichments; 7 | 8 | namespace Stove.NHibernate.Uow 9 | { 10 | internal static class UnitOfWorkExtensions 11 | { 12 | public static ISession GetSession(this IActiveUnitOfWork unitOfWork) where TSessionContext : StoveSessionContext 13 | { 14 | if (unitOfWork == null) throw new ArgumentNullException(nameof(unitOfWork)); 15 | 16 | if (!(unitOfWork is NhUnitOfWork)) throw new ArgumentException("unitOfWork is not type of " + typeof(NhUnitOfWork).FullName, nameof(unitOfWork)); 17 | 18 | return ((NhUnitOfWork)unitOfWork).GetOrCreateSession(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Stove.HangFire/Hangfire/Configurations/StoveHangfireConfigurationExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JetBrains.Annotations; 4 | 5 | using Stove.Configuration; 6 | 7 | namespace Stove.Hangfire.Configurations 8 | { 9 | public static class StoveHangfireConfigurationExtensions 10 | { 11 | [NotNull] 12 | public static IStoveHangfireConfiguration StoveHangfire([NotNull] this IModuleConfigurations configurations) 13 | { 14 | return configurations.StoveConfiguration.Get(); 15 | } 16 | 17 | public static void Configure([NotNull] this IStoveHangfireConfiguration configuration, [NotNull] Action configureAction) 18 | { 19 | configureAction(configuration); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/Stove.Demo.ConsoleApp/DbContexes/PriceDbContext.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | using Stove.Demo.ConsoleApp.Entities; 5 | using Stove.EntityFramework; 6 | 7 | namespace Stove.Demo.ConsoleApp.DbContexes 8 | { 9 | public class PriceDbContext : StoveDbContext 10 | { 11 | public PriceDbContext() : base("Default") 12 | { 13 | } 14 | 15 | public PriceDbContext(DbConnection existingConnection, bool contextOwnsConnection) : base(existingConnection, contextOwnsConnection) 16 | { 17 | } 18 | 19 | protected PriceDbContext(string nameOrConnectionString) : base(nameOrConnectionString) 20 | { 21 | } 22 | 23 | public virtual IDbSet StorefrontProductPrice { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Stove.EntityFramework/EntityFramework/StoveEntityFrameworkBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | using Stove.Bootstrapping; 5 | 6 | namespace Stove.EntityFramework 7 | { 8 | [DependsOn( 9 | typeof(StoveKernelBootstrapper) 10 | )] 11 | public class StoveEntityFrameworkBootstrapper : StoveBootstrapper 12 | { 13 | private readonly IDbContextTypeMatcher _dbContextTypeMatcher; 14 | 15 | public StoveEntityFrameworkBootstrapper(IDbContextTypeMatcher dbContextTypeMatcher) 16 | { 17 | _dbContextTypeMatcher = dbContextTypeMatcher; 18 | } 19 | 20 | public override void Start() 21 | { 22 | Type[] dbContextTypes = Resolver.GetRegisteredServices().Where(x => typeof(StoveDbContext).IsAssignableFrom(x)).ToArray(); 23 | _dbContextTypeMatcher.Populate(dbContextTypes); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Stove/Domain/Uow/UnitOfWorkFailedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Stove.Domain.Uow 4 | { 5 | /// 6 | /// Used as event arguments on event. 7 | /// 8 | public class UnitOfWorkFailedEventArgs : EventArgs 9 | { 10 | /// 11 | /// Exception that caused failure. 12 | /// 13 | public Exception Exception { get; private set; } 14 | 15 | /// 16 | /// Creates a new object. 17 | /// 18 | /// Exception that caused failure 19 | public UnitOfWorkFailedEventArgs(Exception exception) 20 | { 21 | Exception = exception; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Stove/Threading/RunnableBase.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Threading 2 | { 3 | /// 4 | /// Base implementation of . 5 | /// 6 | public abstract class RunnableBase : IRunnable 7 | { 8 | private volatile bool _isRunning; 9 | 10 | /// 11 | /// A boolean value to control the running. 12 | /// 13 | public bool IsRunning 14 | { 15 | get { return _isRunning; } 16 | } 17 | 18 | public virtual void Start() 19 | { 20 | _isRunning = true; 21 | } 22 | 23 | public virtual void Stop() 24 | { 25 | _isRunning = false; 26 | } 27 | 28 | public virtual void WaitToStop() 29 | { 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/Configuration/StoveDbContextConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | 3 | using Microsoft.EntityFrameworkCore; 4 | 5 | namespace Stove.EntityFrameworkCore.Configuration 6 | { 7 | public class StoveDbContextConfiguration where TDbContext : DbContext 8 | { 9 | public StoveDbContextConfiguration(string connectionString, DbConnection existingConnection) 10 | { 11 | ConnectionString = connectionString; 12 | ExistingConnection = existingConnection; 13 | DbContextOptions = new DbContextOptionsBuilder(); 14 | } 15 | 16 | public string ConnectionString { get; internal set; } 17 | 18 | public DbConnection ExistingConnection { get; internal set; } 19 | 20 | public DbContextOptionsBuilder DbContextOptions { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Stove/BackgroundJobs/BackgroundJobPriority.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.BackgroundJobs 2 | { 3 | /// 4 | /// Priority of a background job. 5 | /// 6 | public enum BackgroundJobPriority : byte 7 | { 8 | /// 9 | /// Low. 10 | /// 11 | Low = 5, 12 | 13 | /// 14 | /// Below normal. 15 | /// 16 | BelowNormal = 10, 17 | 18 | /// 19 | /// Normal (default). 20 | /// 21 | Normal = 15, 22 | 23 | /// 24 | /// Above normal. 25 | /// 26 | AboveNormal = 20, 27 | 28 | /// 29 | /// High. 30 | /// 31 | High = 25 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Stove/Domain/Entities/IEntity{TPrimaryKey}.cs: -------------------------------------------------------------------------------- 1 | namespace Stove.Domain.Entities 2 | { 3 | /// 4 | /// Defines interface for base entity type. All entities in the system must implement this interface. 5 | /// 6 | /// Type of the primary key of the entity 7 | public interface IEntity 8 | { 9 | /// 10 | /// Unique identifier for this entity. 11 | /// 12 | TPrimaryKey Id { get; set; } 13 | 14 | /// 15 | /// Checks if this entity is transient (not persisted to database and it has not an ). 16 | /// 17 | /// True, if this entity is transient 18 | bool IsTransient(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/Stove.Couchbase.Tests/Entities/Product.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using Couchbase.Linq.Filters; 4 | 5 | using Newtonsoft.Json; 6 | 7 | using Stove.Domain.Entities; 8 | 9 | namespace Stove.Couchbase.Tests.Entities 10 | { 11 | [DocumentTypeFilter("product")] 12 | public class Product : Entity 13 | { 14 | protected Product() 15 | { 16 | } 17 | 18 | public Product(string name) : this() 19 | { 20 | Name = name; 21 | } 22 | 23 | [Key] 24 | [JsonProperty("id")] 25 | public override string Id { get; set; } 26 | 27 | [JsonProperty("name")] 28 | public virtual string Name { get; set; } 29 | 30 | [JsonProperty("type")] 31 | public virtual string Type => "product"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/Stove.Dapper.Tests/CustomRepositories/MailRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Dapper; 4 | 5 | using Stove.Dapper.Repositories; 6 | using Stove.Dapper.Tests.DbContexes; 7 | using Stove.Dapper.Tests.Entities; 8 | using Stove.Orm; 9 | using Stove.Data; 10 | 11 | namespace Stove.Dapper.Tests.CustomRepositories 12 | { 13 | public class MailRepository : DapperEfRepositoryBase, IMailRepository 14 | { 15 | public MailRepository(IActiveTransactionProvider activeTransactionProvider) : base(activeTransactionProvider) 16 | { 17 | } 18 | 19 | public Mail GetMailById(Guid id) 20 | { 21 | return ActiveTransaction.Connection.QueryFirstOrDefault("select * from Mails where Id = @id limit 1", new { id }, ActiveTransaction); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Stove.RavenDB/RavenDB/StoveRavenDBBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Raven.Client.Documents; 2 | 3 | using Stove.Bootstrapping; 4 | using Stove.RavenDB.Configuration; 5 | 6 | namespace Stove.RavenDB 7 | { 8 | [DependsOn( 9 | typeof(StoveKernelBootstrapper) 10 | )] 11 | public class StoveRavenDBBootstrapper : StoveBootstrapper 12 | { 13 | public override void PreStart() 14 | { 15 | StoveConfiguration.GetConfigurerIfExists()(StoveConfiguration.Modules.StoveRavenDB()); 16 | } 17 | 18 | public override void Start() 19 | { 20 | Resolver.Resolve().Initialize(); 21 | } 22 | 23 | public override void Shutdown() 24 | { 25 | Resolver.Resolve().Dispose(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/Domain/Entities/ProductBrand.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | using JetBrains.Annotations; 5 | 6 | using Stove.Domain.Entities; 7 | 8 | namespace Stove.Tests.SampleApplication.Domain.Entities 9 | { 10 | [Table("ProductBrand")] 11 | public class ProductBrand : Entity 12 | { 13 | private ProductBrand() 14 | { 15 | } 16 | 17 | [NotNull] 18 | [Required] 19 | public virtual Product Product { get; protected set; } 20 | public int ProductId { get; [UsedImplicitly] private set; } 21 | 22 | [NotNull] 23 | [Required] 24 | public virtual Brand Brand { get; protected set; } 25 | public int BrandId { get; [UsedImplicitly] private set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/StoveEfCoreServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.Extensions.DependencyInjection; 5 | 6 | using Stove.EntityFrameworkCore.Configuration; 7 | 8 | namespace Stove.EntityFrameworkCore 9 | { 10 | public static class StoveEfCoreServiceCollectionExtensions 11 | { 12 | public static void AddStoveDbContext( 13 | this IServiceCollection services, 14 | Action> action) 15 | where TDbContext : DbContext 16 | { 17 | services.AddSingleton( 18 | typeof(IStoveDbContextConfigurer), 19 | new StoveDbContextConfigurerAction(action) 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/Uow/ActiveTransactionInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Storage; 5 | 6 | namespace Stove.EntityFrameworkCore.Uow 7 | { 8 | public class ActiveTransactionInfo 9 | { 10 | public IDbContextTransaction DbContextTransaction { get; } 11 | 12 | public DbContext StarterDbContext { get; } 13 | 14 | public List AttendedDbContexts { get; } 15 | 16 | public ActiveTransactionInfo(IDbContextTransaction dbContextTransaction, DbContext starterDbContext) 17 | { 18 | DbContextTransaction = dbContextTransaction; 19 | StarterDbContext = starterDbContext; 20 | 21 | AttendedDbContexts = new List(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/Domain/Entities/ProductGender.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | using JetBrains.Annotations; 5 | 6 | using Stove.Domain.Entities; 7 | 8 | namespace Stove.Tests.SampleApplication.Domain.Entities 9 | { 10 | [Table("ProductGender")] 11 | public class ProductGender : Entity 12 | { 13 | private ProductGender() 14 | { 15 | } 16 | 17 | [Required] 18 | [NotNull] 19 | public virtual Gender Gender { get; protected set; } 20 | public int GenderId { get; [UsedImplicitly] private set; } 21 | 22 | [Required] 23 | [NotNull] 24 | public virtual Product Product { get; protected set; } 25 | public int ProductId { get; [UsedImplicitly] private set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/Stove.Tests/Events/Bus/TransientDisposableEventHandlerTest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using Stove.Events; 4 | 5 | using Xunit; 6 | 7 | namespace Stove.Tests.Events.Bus 8 | { 9 | public class TransientDisposableEventHandlerTest : EventBusTestBase 10 | { 11 | [Fact] 12 | public void Should_Call_Handler_AndDispose() 13 | { 14 | EventBus.Register(); 15 | 16 | EventBus.Publish(new MySimpleEvent(1), new Headers()); 17 | EventBus.Publish(new MySimpleEvent(2), new Headers()); 18 | EventBus.Publish(new MySimpleEvent(3), new Headers()); 19 | 20 | Assert.Equal(MySimpleTransientEventHandler.HandleCount, 3); 21 | Assert.Equal(MySimpleTransientEventHandler.DisposeCount, 3); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Stove.Tests/Collections/TypeList_Tests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Stove.Collections; 4 | 5 | using Xunit; 6 | 7 | namespace Stove.Tests.Collections 8 | { 9 | public class TypeList_Test 10 | { 11 | [Fact] 12 | public void Should_Only_Add_True_Types() 13 | { 14 | var list = new TypeList(); 15 | list.Add(); 16 | list.Add(typeof(MyClass2)); 17 | Assert.Throws(() => list.Add(typeof(MyClass3))); 18 | } 19 | 20 | public interface IMyInterface 21 | { 22 | } 23 | 24 | public class MyClass1 : IMyInterface 25 | { 26 | } 27 | 28 | public class MyClass2 : IMyInterface 29 | { 30 | } 31 | 32 | public class MyClass3 33 | { 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Stove.NHibernate/NHibernate/Repositories/NhRepositoryBase{TEntity,TPrimaryKey}.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | using Stove.Domain.Repositories; 3 | using Stove.NHibernate.Enrichments; 4 | 5 | namespace Stove.NHibernate.Repositories 6 | { 7 | /// 8 | /// Base class for all repositories those uses NHibernate. 9 | /// 10 | /// Entity type 11 | /// 12 | public class NhRepositoryBase : NhRepositoryBase, IRepository 13 | where TSessionContext : StoveSessionContext 14 | where TEntity : class, IEntity 15 | 16 | { 17 | public NhRepositoryBase(ISessionProvider sessionProvider) : base(sessionProvider) 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Stove.RavenDB/RavenDB/Filters/Action/NullRavenActionFilterExecuter.cs: -------------------------------------------------------------------------------- 1 | using Stove.Domain.Entities; 2 | 3 | namespace Stove.RavenDB.Filters.Action 4 | { 5 | public class NullRavenActionFilterExecuter : IRavenActionFilterExecuter 6 | { 7 | public static readonly NullRavenActionFilterExecuter Instance = new NullRavenActionFilterExecuter(); 8 | 9 | public void ExecuteCreationAuditFilter(TEntity entity) where TEntity : class, IEntity 10 | { 11 | } 12 | 13 | public void ExecuteModificationAuditFilter(TEntity entity) where TEntity : class, IEntity 14 | { 15 | } 16 | 17 | public void ExecuteDeletionAuditFilter(TEntity entity) where TEntity : class, IEntity 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Stove/Threading/Extensions/TaskExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using System.Threading.Tasks; 3 | 4 | namespace Stove.Threading.Extensions 5 | { 6 | /// 7 | /// Represents extensions on Tasks. 8 | /// 9 | public static class TaskExtensions 10 | { 11 | /// 12 | /// ConfigureAwait(false) 13 | /// 14 | public static ConfiguredTaskAwaitable NotOnCapturedContext(this Task task) 15 | { 16 | return task.ConfigureAwait(false); 17 | } 18 | 19 | /// 20 | /// ConfigureAwait(false) 21 | /// 22 | public static ConfiguredTaskAwaitable NotOnCapturedContext(this Task task) 23 | { 24 | return task.ConfigureAwait(false); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/Stove.Demo.WebApiCore/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:2814/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "launchUrl": "api/values", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "Development" 17 | } 18 | }, 19 | "Stove.Demo.WebApiCore": { 20 | "commandName": "Project", 21 | "launchBrowser": true, 22 | "launchUrl": "api/values", 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | }, 26 | "applicationUrl": "http://localhost:2815/" 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/Stove.NHibernate.Tests/SessionFactory_Tests.cs: -------------------------------------------------------------------------------- 1 | using NHibernate; 2 | 3 | using Stove.NHibernate.Enrichments; 4 | using Stove.NHibernate.Tests.Sessions; 5 | 6 | using Xunit; 7 | 8 | namespace Stove.NHibernate.Tests 9 | { 10 | public class SessionFactory_Test : StoveNHibernateTestBase 11 | { 12 | private readonly ISessionFactoryProvider _sessionFactoryProvider; 13 | 14 | public SessionFactory_Test() 15 | { 16 | Building(builder => { }).Ok(); 17 | 18 | _sessionFactoryProvider = The(); 19 | } 20 | 21 | [Fact] 22 | public void Should_OpenSession_Work() 23 | { 24 | using (ISession session = _sessionFactoryProvider.GetSessionFactory().OpenSession()) 25 | { 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/Stove.Redis.Tests/StoveRedis_Test.cs: -------------------------------------------------------------------------------- 1 | using NSubstitute; 2 | 3 | using Stove.Runtime.Caching; 4 | 5 | using Xunit; 6 | 7 | namespace Stove.Redis.Tests 8 | { 9 | public class StoveRedis_Test : RedisTestBase 10 | { 11 | public StoveRedis_Test() 12 | { 13 | Building(builder => 14 | { 15 | var fakeCacheClientProvider = Substitute.For(); 16 | builder.RegisterServices(r => r.Register(ctx => fakeCacheClientProvider)); 17 | 18 | }).Ok(); 19 | } 20 | 21 | [Fact] 22 | public void should_work() 23 | { 24 | The().GetCache("RedisTest").Get("apple", s => new { Name = "apple" }); 25 | 26 | The().GetDatabase().Received(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Stove.EntityFrameworkCore/EntityFrameworkCore/Repositories/EfCoreRepositoryExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | 3 | using Stove.Domain.Entities; 4 | using Stove.Domain.Repositories; 5 | 6 | namespace Stove.EntityFrameworkCore.Repositories 7 | { 8 | public static class EfCoreRepositoryExtensions 9 | { 10 | public static DbContext GetDbContext(this IRepository repository) 11 | where TEntity : class, IEntity 12 | { 13 | return (repository as IRepositoryWithDbContext).GetDbContext(); 14 | } 15 | 16 | public static void DetachFromDbContext(this IRepository repository, TEntity entity) 17 | where TEntity : class, IEntity 18 | { 19 | repository.GetDbContext().Entry(entity).State = EntityState.Detached; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/Stove.Tests.SampleApplication/Domain/Entities/ProductCategory.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | using Stove.Domain.Entities; 5 | 6 | namespace Stove.Tests.SampleApplication.Domain.Entities 7 | { 8 | [Table("ProductCategory")] 9 | public class ProductCategory : Entity 10 | { 11 | protected ProductCategory() 12 | { 13 | } 14 | 15 | public ProductCategory(Category category, Product product) : this() 16 | { 17 | Category = category; 18 | Product = product; 19 | } 20 | 21 | [Required] 22 | public virtual Category Category { get; protected set; } 23 | 24 | public virtual int CategoryId { get; protected set; } 25 | 26 | [Required] 27 | public virtual Product Product { get; protected set; } 28 | 29 | public virtual int ProductId { get; protected set; } 30 | } 31 | } 32 | --------------------------------------------------------------------------------