├── .gitattributes
├── .github
├── FUNDING.yml
└── workflows
│ ├── aspnet-core-api-template.yml
│ └── dotnet.yml
├── .gitignore
├── DNTFrameworkCore.sln
├── LICENSE.md
├── README.md
├── common.props
├── docs
├── blog-crud-api.JPG
├── blog-crud-mvc.PNG
├── blog-crud-service.JPG
├── dnt-solution.jpg
├── index.md
├── logo.png
└── role-modal-edit.JPG
├── global.json
├── nupkg
├── nupkg.png
└── nupkg.sln
├── src
├── DNTFrameworkCore.Cqrs.EFCore
│ ├── Behaviors
│ │ └── TransactionBehavior.cs
│ ├── DNTFrameworkCore.Cqrs.EFCore.csproj
│ └── README.md
├── DNTFrameworkCore.Cqrs.Web
│ ├── DNTFrameworkCore.Cqrs.Web.csproj
│ └── README.md
├── DNTFrameworkCore.Cqrs
│ ├── Behaviors
│ │ ├── LoggingBehavior.cs
│ │ ├── PerformanceBehavior.cs
│ │ ├── RetryBehavior.cs
│ │ └── ValidationBehavior.cs
│ ├── Commands
│ │ ├── ICommand.cs
│ │ └── ICommandHandler.cs
│ ├── DNTFrameworkCore.Cqrs.csproj
│ ├── DependencyInjection.cs
│ ├── Queries
│ │ ├── IFilteredPagedQuery.cs
│ │ ├── IPagedQuery.cs
│ │ ├── IQuery.cs
│ │ └── IQueryHandler.cs
│ └── README.md
├── DNTFrameworkCore.EFCore.SqlServer
│ ├── DNTFrameworkCore.EFCore.SqlServer.csproj
│ ├── DependencyInjection.cs
│ ├── Numbering
│ │ ├── DbContextExtensions.cs
│ │ ├── NumberedEntityConfiguration.cs
│ │ └── PreInsertNumberedEntityHook.cs
│ ├── NumberingService.cs
│ ├── README.md
│ └── SqlHelper.cs
├── DNTFrameworkCore.EFCore
│ ├── Application
│ │ └── EntityService.cs
│ ├── Caching
│ │ └── SqlCacheConfiguration.cs
│ ├── Configuration
│ │ ├── EFConfigurationProvider.cs
│ │ ├── EFConfigurationSource.cs
│ │ ├── KeyValueConfiguration.cs
│ │ └── KeyValueService.cs
│ ├── Context
│ │ ├── Converters
│ │ │ └── Json
│ │ │ │ ├── JsonValueComparer.cs
│ │ │ │ ├── JsonValueConverter.cs
│ │ │ │ ├── ModelBuilderExtensions.cs
│ │ │ │ └── PropertyBuilderExtensions.cs
│ │ ├── DbContextCore.cs
│ │ ├── EFCoreShadow.cs
│ │ ├── EntityChangeContext.cs
│ │ ├── Extensions
│ │ │ ├── DbContextExtensions.cs
│ │ │ ├── EntityEntryExtensions.cs
│ │ │ ├── ModelBuilderExtensions.cs
│ │ │ ├── NavigationExtensions.cs
│ │ │ └── TrackableExtensions.cs
│ │ ├── Hooks
│ │ │ ├── HookEntityMetadata.cs
│ │ │ ├── IHook.cs
│ │ │ ├── IPostActionHook.cs
│ │ │ ├── IPreActionHook.cs
│ │ │ ├── PostActionHook.cs
│ │ │ ├── PostDeleteHook.cs
│ │ │ ├── PostInsertHook.cs
│ │ │ ├── PostUpdateHook.cs
│ │ │ ├── PreActionHook.cs
│ │ │ ├── PreDeleteHook.cs
│ │ │ ├── PreFetchHook.cs
│ │ │ ├── PreInsertHook.cs
│ │ │ └── PreUpdateHook.cs
│ │ ├── IDbContext.cs
│ │ ├── IUnitOfWork.cs
│ │ ├── PredefinedHooks.cs
│ │ └── ResilientTransaction.cs
│ ├── Cryptography
│ │ └── ProtectionKeyConfiguration.cs
│ ├── DNTFrameworkCore.EFCore.csproj
│ ├── DependencyInjection.cs
│ ├── Eventing
│ │ └── EventBusExtensions.cs
│ ├── HostExtensions.cs
│ ├── Linq
│ │ └── QueryableExtensions.cs
│ ├── Logging
│ │ ├── DbLoggerProvider.cs
│ │ └── LogConfiguration.cs
│ ├── Persistence
│ │ └── Repository.cs
│ ├── Querying
│ │ ├── NamedSorting.cs
│ │ └── QueryableExtensions.cs
│ ├── README.md
│ └── Transaction
│ │ └── TransactionInterceptor.cs
├── DNTFrameworkCore.FluentValidation
│ ├── DNTFrameworkCore.FluentValidation.csproj
│ ├── DependencyInjection.cs
│ ├── FluentModelValidator.cs
│ ├── FluentValidationModelValidator.cs
│ ├── README.md
│ └── ServiceProviderValidatorFactory.cs
├── DNTFrameworkCore.Licensing
│ ├── DNTFrameworkCore.Licensing.csproj
│ ├── ExpirationTime.cs
│ ├── FingerPrint.cs
│ ├── ILicensedProduct.cs
│ ├── License.cs
│ ├── LicenseExtensions.cs
│ ├── LicenseFeature.cs
│ ├── README.md
│ ├── RsaExtensions.cs
│ ├── SigningKey.cs
│ └── XmlExtensions.cs
├── DNTFrameworkCore.NHibernate
│ ├── Application
│ │ └── EntityService.cs
│ ├── DNTFrameworkCore.NHibernate.csproj
│ ├── Linq
│ │ └── QueryableExtensions.cs
│ └── Transaction
│ │ └── TransactionInterceptor.cs
├── DNTFrameworkCore.Web.EFCore
│ ├── Cryptography
│ │ ├── LoggingExtensions.cs
│ │ └── XmlRepository.cs
│ ├── DNTFrameworkCore.Web.EFCore.csproj
│ ├── README.md
│ └── Transaction
│ │ └── TransactionFilter.cs
├── DNTFrameworkCore.Web.Tenancy
│ ├── ApplicationBuilderExtensions.cs
│ ├── DNTFrameworkCore.Web.Tenancy.csproj
│ ├── DependencyInjection.cs
│ ├── HttpContextExtensions.cs
│ ├── Internal
│ │ ├── TenantContainerFactory.cs
│ │ ├── TenantContainerMiddleware.cs
│ │ ├── TenantPipelineMiddleware.cs
│ │ ├── TenantResolutionMiddleware.cs
│ │ └── TenantSession.cs
│ └── README.md
├── DNTFrameworkCore.Web
│ ├── API
│ │ └── EntityController.cs
│ ├── ApplicationBuilderExtensions.cs
│ ├── Authentication
│ │ ├── DistributedCacheTicketStore.cs
│ │ └── MemoryCacheTicketStore.cs
│ ├── Authorization
│ │ ├── AuthorizationExtensions.cs
│ │ ├── AuthorizationPolicyProvider.cs
│ │ ├── PermissionAuthorizationRequirement.cs
│ │ ├── PermissionAuthorizeAttribute.cs
│ │ └── PolicyNames.cs
│ ├── Caching
│ │ └── DistributedCacheExtensions.cs
│ ├── Configuration
│ │ ├── ConfigurationBuilderExtensions.cs
│ │ └── ConfigurationExtensions.cs
│ ├── Cryptography
│ │ ├── ProtectionService.cs
│ │ └── UserPasswordHashAlgorithm.cs
│ ├── DNTFrameworkCore.Web.csproj
│ ├── Dependency
│ │ ├── DuplicateServiceFinder.cs
│ │ ├── ServiceCollectionExtensions.cs
│ │ └── ServiceProviderExtensions.cs
│ ├── DependencyInjection.cs
│ ├── ExceptionHandling
│ │ ├── ExceptionHandlingExtensions.cs
│ │ ├── FailureProblemDetail.cs
│ │ └── HandleException.cs
│ ├── Extensions
│ │ ├── ControllerExtensions.cs
│ │ ├── HttpRequestExtensions.cs
│ │ ├── ModelStateExtensions.cs
│ │ └── ToastNotificationExtensions.cs
│ ├── Filters
│ │ ├── EncryptedFieldResultFilter.cs
│ │ ├── FormValueExistsAttribute.cs
│ │ ├── NoBrowserCacheAttribute.cs
│ │ ├── NoResponseCacheAttribute.cs
│ │ ├── ParameterBasedOnFormNameAndValueAttribute.cs
│ │ └── ParameterBasedOnFormNameAttribute.cs
│ ├── Hosting
│ │ ├── HostBuilderExtensions.cs
│ │ ├── QueuedHostedService.cs
│ │ └── TaskHostedService.cs
│ ├── Http
│ │ ├── ContentType.cs
│ │ ├── HttpContextExtensions.cs
│ │ ├── HttpRequestExtensions.cs
│ │ └── HttpRequestInfoService.cs
│ ├── IO
│ │ └── EnvironmentPath.cs
│ ├── Localization
│ │ ├── FaRequestCultureProvider.cs
│ │ └── LanguageAttribute.cs
│ ├── Logging
│ │ └── LoggerFactoryExtensions.cs
│ ├── Middlewares
│ │ ├── ContentSecurityPolicyMiddleware.cs
│ │ └── FrameworkMiddleware.cs
│ ├── ModelBinding
│ │ ├── EncryptedFieldModelBinder.cs
│ │ └── FilteredPagedRequestModelBinder.cs
│ ├── Mvc
│ │ ├── AjaxOnlyAttribute.cs
│ │ ├── EntityController.cs
│ │ ├── FormValueRequiredAttribute.cs
│ │ ├── HtmlHelperExtensions.cs
│ │ ├── HtmlHelpers
│ │ │ └── HtmlPrefixScopeExtensions.cs
│ │ ├── LookupItemExtensions.cs
│ │ ├── PRG
│ │ │ ├── ExportModelStateAttribute.cs
│ │ │ ├── ImportModelStateAttribute.cs
│ │ │ ├── ModelStateTransfer.cs
│ │ │ └── ValidateModelStateAttribute.cs
│ │ ├── PagedListModel.cs
│ │ ├── TagHelpers
│ │ │ ├── Ajax
│ │ │ │ ├── ModalFormTagHelper.cs
│ │ │ │ └── ModalLinkTagHelper.cs
│ │ │ ├── Authorization
│ │ │ │ └── AuthorizeTagHelper.cs
│ │ │ ├── IfAttributeTagHelper.cs
│ │ │ └── IfTagHelper.cs
│ │ ├── UploadFileService.cs
│ │ ├── UrlChecker.cs
│ │ ├── UrlHelperExtensions.cs
│ │ ├── ViewEngine
│ │ │ ├── EntityFormRazorPage.cs
│ │ │ └── WebViewPageBase.cs
│ │ ├── ViewRendererService.cs
│ │ └── WebMetadataService.cs
│ ├── Providers
│ │ └── SeperatedQueryStringValueProvider.cs
│ ├── README.md
│ ├── Results
│ │ ├── AjaxAwareRedirectResult.cs
│ │ ├── CsvFileResult.cs
│ │ ├── InternalServerErrorObjectResult.cs
│ │ ├── JavaScriptRedirectResult.cs
│ │ ├── JavaScriptResult.cs
│ │ ├── ToastNotificationDecoratorResult.cs
│ │ └── XmlResult.cs
│ ├── Runtime
│ │ └── UserSession.cs
│ └── Security
│ │ ├── AllowUploadSafeFilesAttribute.cs
│ │ ├── AntiXsrf.cs
│ │ ├── FileNameSanitizer.cs
│ │ ├── NoBrowserCacheHtmlGenerator.cs
│ │ └── UploadFileExtensionsAttribute.cs
└── DNTFrameworkCore
│ ├── Application
│ ├── ApplicationService.cs
│ ├── EntityService.cs
│ ├── Events
│ │ ├── CreatedBusinessEvent.cs
│ │ ├── CreatingBusinessEvent.cs
│ │ ├── DeletedBusinessEvent.cs
│ │ ├── DeletingBusinessEvent.cs
│ │ ├── EditedBusinessEvent.cs
│ │ ├── EditingBusinessEvent.cs
│ │ └── EventBusExtensions.cs
│ ├── IEntityService.cs
│ └── Models
│ │ ├── MasterModel.cs
│ │ ├── Model.cs
│ │ ├── ModifiedModel.cs
│ │ └── ReadModel.cs
│ ├── Authorization
│ ├── Permission.cs
│ ├── PermissionConstant.cs
│ └── PermissionDictionary.cs
│ ├── Caching
│ ├── Cache.cs
│ └── CacheService.cs
│ ├── Collections
│ ├── Extensions.cs
│ ├── ITypeList.cs
│ ├── TrackedCollection.cs
│ └── TypeList.cs
│ ├── Common
│ ├── Disposable.cs
│ ├── DisposableAction.cs
│ ├── Id.cs
│ ├── LockingConcurrentDictionary.cs
│ ├── LookupItem.cs
│ ├── NameValue.cs
│ ├── NamedTypeSelector.cs
│ ├── PropertyHelper.cs
│ └── SkipNormalizationAttribute.cs
│ ├── Configuration
│ ├── IKeyValueService.cs
│ └── KeyValue.cs
│ ├── Cryptography
│ ├── CryptographyExtensions.cs
│ ├── EncryptedFieldAttribute.cs
│ ├── IProtectionService.cs
│ ├── IUserPasswordHashAlgorithm.cs
│ ├── ProtectionKey.cs
│ ├── RandomNumber.cs
│ ├── SecurityService.cs
│ └── XxHashUnsafe.cs
│ ├── DNTFrameworkCore.csproj
│ ├── Data
│ └── IDbSetup.cs
│ ├── Dependency
│ ├── ClonedSingletonDescriptor.cs
│ ├── INamedDependency.cs
│ ├── IScopedDependency.cs
│ ├── ISingletonDependency.cs
│ ├── ITenantScopedDependency.cs
│ ├── ITransientDependency.cs
│ ├── LazyFactory.cs
│ ├── ServiceCollectionExtensions.cs
│ ├── ServiceDescriptorExtensions.cs
│ ├── ServiceProviderExtensions.cs
│ └── TenantScopedServiceDescriptor.cs
│ ├── DependencyInjection.cs
│ ├── Domain
│ ├── Entity.cs
│ ├── Enumeration.cs
│ ├── IAggregateRoot.cs
│ ├── ICreationTracking.cs
│ ├── IDeletedEntity.cs
│ ├── IDomainEvent.cs
│ ├── IDomainEventHandler.cs
│ ├── IHasRowIntegrity.cs
│ ├── IHasRowLevelSecurity.cs
│ ├── IHasRowVersion.cs
│ ├── IModificationTracking.cs
│ ├── INumberedEntity.cs
│ ├── IRepository.cs
│ ├── ITenantEntity.cs
│ ├── ITrackable.cs
│ ├── TrackableEntity.cs
│ └── ValueObject.cs
│ ├── EntityHistory
│ └── EntityHistory.cs
│ ├── Eventing
│ ├── EventBus.cs
│ ├── EventBusExtensions.cs
│ ├── Handlers
│ │ ├── BusinessEventHandler.cs
│ │ └── DomainEventHandler.cs
│ ├── IBusinessEvent.cs
│ ├── IBusinessEventHandler.cs
│ └── IIntegrationEvent.cs
│ ├── Exceptions
│ ├── BusinessRuleException.cs
│ ├── DbConcurrencyException.cs
│ ├── DbException.cs
│ ├── DomainException.cs
│ ├── ExceptionOptions.cs
│ ├── UserFriendlyException.cs
│ └── ValidationException.cs
│ ├── Extensibility
│ ├── ExtensionFields.cs
│ ├── ExtensionProperties.cs
│ ├── ExtensionPropertyDescriptor.cs
│ ├── ExtensionPropertyTypeDescriptionProvider.cs
│ └── UniqueIdExtensions.cs
│ ├── Extensions
│ ├── ComparableExtensions.cs
│ ├── DictionaryExtensions.cs
│ ├── EntityExtensions.cs
│ ├── EnumExtensions.cs
│ ├── ExpressionExtensions.cs
│ ├── IdentityExtensions.cs
│ ├── MemberInfoExtensions.cs
│ ├── MethodInfoExtensions.cs
│ ├── ObjectExtensions.cs
│ ├── PrincipalExtensions.cs
│ ├── StringExtensions.cs
│ └── TypeExtensions.cs
│ ├── Functional
│ ├── Maybe.cs
│ ├── MaybeExtensions.cs
│ ├── Result.cs
│ └── ResultExtensions.cs
│ ├── GuardToolkit
│ ├── Ensure.cs
│ └── Guard.cs
│ ├── IO
│ └── IEnvironmentPath.cs
│ ├── Identity
│ ├── IRole.cs
│ └── IUser.cs
│ ├── Linq
│ ├── PredicateBuilder.cs
│ ├── QueryableExtensions.cs
│ └── ReplaceExpressionVisitor.cs
│ ├── Localization
│ ├── FixedLocalizableString.cs
│ ├── ILocalizableString.cs
│ ├── ITranslationService.cs
│ ├── LocalizableString.cs
│ ├── LocalizationExtensions.cs
│ ├── LocalizationResourceAttribute.cs
│ └── NullStringLocalizerFactory.cs
│ ├── Logging
│ ├── BatchingLogger.cs
│ ├── BatchingLoggerOptions.cs
│ ├── BatchingLoggerProvider.cs
│ ├── DbLoggerOptions.cs
│ ├── FileLoggerOptions.cs
│ ├── FileLoggerProvider.cs
│ ├── Log.cs
│ └── LogItem.cs
│ ├── Mapping
│ ├── Factory.cs
│ ├── IMapper.cs
│ ├── MapperExtensions.cs
│ └── MappingExtensions.cs
│ ├── Metadata
│ ├── EntityFieldMetadata.cs
│ ├── EntityMetadata.cs
│ ├── EntityViewFieldMetadata.cs
│ ├── EntityViewMetadata.cs
│ ├── IMetadataService.cs
│ └── Metadata.cs
│ ├── Numbering
│ ├── NumberedEntity.cs
│ ├── NumberedEntityOption.cs
│ └── NumberingOptions.cs
│ ├── Persistence
│ └── IDbConnectionFactory.cs
│ ├── Querying
│ ├── FilterExpression.cs
│ ├── FilteringLogic.cs
│ ├── FilteringOperator.cs
│ ├── IFilteredPagedRequest.cs
│ ├── IPagedRequest.cs
│ ├── IPagedResult.cs
│ ├── QueryFieldAttribute.cs
│ ├── QueryableExtensions.cs
│ ├── QueryingConstants.cs
│ ├── QueryingOptions.cs
│ └── SortExpression.cs
│ ├── README.md
│ ├── Reflection
│ ├── FastReflection.cs
│ ├── FastReflectionExtensions.cs
│ ├── NestedPropertyExtractor.cs
│ ├── PropertyReflector.cs
│ ├── ReflectionHelper.cs
│ └── TypeHelper.cs
│ ├── Runtime
│ ├── IUserSession.cs
│ ├── UserClaimTypes.cs
│ └── UserSessionExtensions.cs
│ ├── Serialization
│ └── JsonFieldAttribute.cs
│ ├── Specifications
│ ├── AndNotSpecification.cs
│ ├── AndSpecification.cs
│ ├── AnySpecification.cs
│ ├── CompositeSpecification.cs
│ ├── NoneSpecification.cs
│ ├── NotSpecification.cs
│ ├── OrSpecification.cs
│ ├── QueryableExtensions.cs
│ └── Specification.cs
│ ├── Tasks
│ ├── IBeginRequestTask.cs
│ ├── IEndRequestTask.cs
│ ├── IEndTask.cs
│ ├── IExceptionTask.cs
│ ├── IStartupTask.cs
│ ├── ITask.cs
│ └── TaskEngine.cs
│ ├── Tenancy
│ ├── ITenantContainerFactory.cs
│ ├── ITenantResolutionStrategy.cs
│ ├── ITenantSession.cs
│ ├── ITenantStore.cs
│ ├── Options
│ │ ├── TenantOptions.cs
│ │ ├── TenantOptionsCache.cs
│ │ ├── TenantOptionsDictionary.cs
│ │ └── TenantOptionsFactory.cs
│ ├── TenancyConstants.cs
│ ├── TenancyExtensions.cs
│ ├── TenancyOptions.cs
│ ├── TenancySideAttribute.cs
│ ├── TenancySides.cs
│ ├── Tenant.cs
│ ├── TenantBuilder.cs
│ ├── TenantServiceCollectionExtensions.cs
│ └── TenantSessionExtensions.cs
│ ├── Threading
│ ├── AsyncHelper.cs
│ └── BackgroundTasks
│ │ └── BackgroundTaskQueue.cs
│ ├── Timing
│ ├── DateTimeKindAttribute.cs
│ ├── SystemClock.cs
│ └── SystemTime.cs
│ ├── Transaction
│ ├── TransactionOptions.cs
│ └── TransactionalAttribute.cs
│ └── Validation
│ ├── EnableValidationAttribute.cs
│ ├── IModelValidator.cs
│ ├── Interception
│ ├── DataAnnotationMethodParameterValidator.cs
│ ├── IMethodParameterValidator.cs
│ ├── MethodInvocationValidator.cs
│ ├── ModelValidationMethodParameterValidator.cs
│ ├── ValidatableObjectMethodParameterValidator.cs
│ └── ValidationInterceptor.cs
│ ├── ModelValidator.cs
│ ├── NullModelValidator.cs
│ ├── SkipValidationAttribute.cs
│ ├── ValidationFailure.cs
│ └── ValidationOptions.cs
├── templates
└── aspnet-core-api
│ ├── README.md
│ ├── content
│ ├── .template.config
│ │ └── template.json
│ ├── ProjectName.sln
│ ├── src
│ │ ├── ProjectName.API
│ │ │ ├── Application
│ │ │ │ └── DbSetup.cs
│ │ │ ├── Authentication
│ │ │ │ ├── AuthenticationService.cs
│ │ │ │ ├── SignInResult.cs
│ │ │ │ ├── Token.cs
│ │ │ │ ├── TokenOptions.cs
│ │ │ │ ├── TokenService.cs
│ │ │ │ └── TokenValidator.cs
│ │ │ ├── Authorization
│ │ │ │ └── PermissionNames.cs
│ │ │ ├── Controllers
│ │ │ │ ├── AuthController.cs
│ │ │ │ ├── RolesController.cs
│ │ │ │ └── UsersController.cs
│ │ │ ├── DependencyInjection.cs
│ │ │ ├── Hubs
│ │ │ │ └── NotificationHub.cs
│ │ │ ├── Localization
│ │ │ │ └── TranslationService.cs
│ │ │ ├── Logs
│ │ │ │ └── logs-20210316.txt
│ │ │ ├── Models
│ │ │ │ └── LoginModel.cs
│ │ │ ├── Program.cs
│ │ │ ├── ProjectName.API.csproj
│ │ │ ├── Properties
│ │ │ │ └── launchSettings.json
│ │ │ ├── Resources
│ │ │ │ ├── MessagesResource.cs
│ │ │ │ ├── MessagesResource.en-us.resx
│ │ │ │ ├── MessagesResource.fa-ir.resx
│ │ │ │ ├── SharedResource.cs
│ │ │ │ ├── SharedResource.en-us.resx
│ │ │ │ └── SharedResource.fa-ir.resx
│ │ │ ├── Startup.cs
│ │ │ ├── appsettings.Development.json
│ │ │ ├── appsettings.json
│ │ │ ├── dotnet_publish.bat
│ │ │ ├── dotnet_restore.bat
│ │ │ └── dotnet_run.bat
│ │ ├── ProjectName.Application
│ │ │ ├── Common
│ │ │ │ └── LookupService.cs
│ │ │ ├── Configuration
│ │ │ │ ├── ProjectOptions.cs
│ │ │ │ └── UserSeed.cs
│ │ │ ├── DependencyInjection.cs
│ │ │ ├── Identity
│ │ │ │ ├── Models
│ │ │ │ │ ├── IdentityMapProfile.cs
│ │ │ │ │ ├── PermissionModel.cs
│ │ │ │ │ ├── RoleModel.cs
│ │ │ │ │ ├── RoleReadModel.cs
│ │ │ │ │ ├── UserModel.cs
│ │ │ │ │ ├── UserReadModel.cs
│ │ │ │ │ └── UserRoleModel.cs
│ │ │ │ ├── RoleService.cs
│ │ │ │ ├── UserService.cs
│ │ │ │ └── Validators
│ │ │ │ │ ├── RoleValidator.cs
│ │ │ │ │ └── UserValidator.cs
│ │ │ ├── Localization
│ │ │ │ └── ITranslationService.cs
│ │ │ └── ProjectName.Application.csproj
│ │ ├── ProjectName.Domain
│ │ │ ├── Identity
│ │ │ │ ├── Claim.cs
│ │ │ │ ├── Permission.cs
│ │ │ │ ├── Role.cs
│ │ │ │ ├── RoleClaim.cs
│ │ │ │ ├── RoleNames.cs
│ │ │ │ ├── RolePermission.cs
│ │ │ │ ├── User.cs
│ │ │ │ ├── UserClaim.cs
│ │ │ │ ├── UserPermission.cs
│ │ │ │ ├── UserRole.cs
│ │ │ │ └── UserToken.cs
│ │ │ └── ProjectName.Domain.csproj
│ │ └── ProjectName.Infrastructure
│ │ │ ├── Context
│ │ │ ├── DesignTimeDbContextFactory.cs
│ │ │ └── ProjectNameDbContext.cs
│ │ │ ├── DependencyInjection.cs
│ │ │ ├── Mappings
│ │ │ └── Identity
│ │ │ │ ├── ClaimConfiguration.cs
│ │ │ │ ├── PermissionConfiguration.cs
│ │ │ │ ├── RoleConfiguration.cs
│ │ │ │ ├── UserConfiguration.cs
│ │ │ │ └── UserTokenConfiguration.cs
│ │ │ ├── Migrations
│ │ │ ├── 20210315204020_V2021_03_16_0010.Designer.cs
│ │ │ ├── 20210315204020_V2021_03_16_0010.cs
│ │ │ └── ProjectNameDbContextModelSnapshot.cs
│ │ │ ├── ProjectName.Infrastructure.csproj
│ │ │ ├── add_migrations.cmd
│ │ │ ├── remove_migrations.cmd
│ │ │ └── update_db.cmd
│ ├── test
│ │ ├── ProjectName.IntegrationTests
│ │ │ ├── Application
│ │ │ │ ├── RoleServiceTests.cs
│ │ │ │ └── UserServiceTests.cs
│ │ │ ├── DbContextExtensions.cs
│ │ │ ├── ProjectName.IntegrationTests.csproj
│ │ │ ├── Stubs
│ │ │ │ ├── StubEventBus.cs
│ │ │ │ └── StubUserSession.cs
│ │ │ └── TestingHelper.cs
│ │ └── ProjectName.UnitTests
│ │ │ ├── Application
│ │ │ ├── RoleValidatorTests.cs
│ │ │ └── UserValidatorTests.cs
│ │ │ ├── DbContextExtensions.cs
│ │ │ ├── ProjectName.UnitTests.csproj
│ │ │ └── TestingHelper.cs
│ └── update_dependencies.bat
│ └── nupkg.csproj
└── test
├── DNTFrameworkCore.EFCore.Tests
├── DNTFrameworkCore.EFCore.Tests.csproj
├── Numbering
│ ├── NumberingDbContext.cs
│ ├── NumberingPreInsertHookTests.cs
│ ├── NumberingTestEntity.cs
│ └── NumberingTests.cs
├── TestingHelper.cs
└── Transaction
│ └── TransactionInterceptorTests.cs
├── DNTFrameworkCore.FluentValidation.Tests
├── DNTFrameworkCore.FluentValidation.Tests.csproj
├── FluentValidationModelValidatorTests.cs
└── ServiceProviderValidatorFactory.cs
├── DNTFrameworkCore.Licensing.Tests
├── DNTFrameworkCore.Licensing.Tests.csproj
├── FingerPrintTests.cs
├── License.lic
├── License2.lic
├── LicenseTests.cs
├── LicensedProduct.cs
└── LicensingKeys.cs
├── DNTFrameworkCore.TestAPI
├── Application
│ ├── ApplicationRegistry.cs
│ ├── Blogging
│ │ ├── BlogService.cs
│ │ ├── Models
│ │ │ └── BlogModel.cs
│ │ └── Validators
│ │ │ └── BlogValidator.cs
│ ├── Common
│ │ ├── DbSetup.cs
│ │ └── LookupService.cs
│ ├── Configuration
│ │ ├── ProjectOptions.cs
│ │ └── UserSeedOptions.cs
│ ├── Identity
│ │ ├── Models
│ │ │ ├── IdentityMapProfile.cs
│ │ │ ├── PermissionModel.cs
│ │ │ ├── RoleModel.cs
│ │ │ ├── RoleReadModel.cs
│ │ │ ├── UserModel.cs
│ │ │ ├── UserReadModel.cs
│ │ │ └── UserRoleModel.cs
│ │ ├── RoleService.cs
│ │ ├── UserService.cs
│ │ └── Validators
│ │ │ ├── RoleValidator.cs
│ │ │ └── UserValidator.cs
│ └── Tasks
│ │ ├── Models
│ │ ├── TaskFilteredPagedQueryModel.cs
│ │ ├── TaskModel.cs
│ │ └── TaskReadModel.cs
│ │ ├── TaskService.cs
│ │ └── Validators
│ │ └── TaskValidator.cs
├── Authentication
│ ├── AuthenticationService.cs
│ ├── SignInResult.cs
│ ├── Token.cs
│ ├── TokenOptions.cs
│ ├── TokenService.cs
│ └── TokenValidator.cs
├── Authorization
│ ├── PermissionNames.cs
│ └── Permissions.cs
├── Controllers
│ ├── AuthController.cs
│ ├── BlogsController.cs
│ ├── RolesController.cs
│ ├── TasksController.cs
│ └── UsersController.cs
├── DNTFrameworkCore.TestAPI.csproj
├── DependencyInjection.cs
├── Domain
│ ├── Blogging
│ │ └── Blog.cs
│ ├── Identity
│ │ ├── Claim.cs
│ │ ├── Permission.cs
│ │ ├── Role.cs
│ │ ├── RoleClaim.cs
│ │ ├── RoleNames.cs
│ │ ├── RolePermission.cs
│ │ ├── User.cs
│ │ ├── UserClaim.cs
│ │ ├── UserPermission.cs
│ │ ├── UserRole.cs
│ │ └── UserToken.cs
│ └── Tasks
│ │ ├── Task.cs
│ │ └── TaskState.cs
├── Hubs
│ ├── NotificationHub.cs
│ └── NotificationHubMethods.cs
├── Infrastructure
│ ├── Context
│ │ ├── DesignTimeDbContextFactory.cs
│ │ └── ProjectDbContext.cs
│ ├── InfrastructureRegistry.cs
│ ├── Mappings
│ │ ├── Blogging
│ │ │ └── BlogConfiguration.cs
│ │ ├── Identity
│ │ │ ├── ClaimConfiguration.cs
│ │ │ ├── PermissionConfiguration.cs
│ │ │ ├── RoleConfiguration.cs
│ │ │ ├── UserConfiguration.cs
│ │ │ └── UserTokenConfiguration.cs
│ │ └── Tasks
│ │ │ └── TaskConfiguration.cs
│ └── Migrations
│ │ ├── 20190704125651_V2019_07_04_1726.Designer.cs
│ │ ├── 20190704125651_V2019_07_04_1726.cs
│ │ ├── 20190913184645_V2019_09_13_2316.Designer.cs
│ │ ├── 20190913184645_V2019_09_13_2316.cs
│ │ ├── 20190915203617_V2019_09_16_0105.Designer.cs
│ │ ├── 20190915203617_V2019_09_16_0105.cs
│ │ ├── 20191126125912_V2019_11_26_1628.Designer.cs
│ │ ├── 20191126125912_V2019_11_26_1628.cs
│ │ ├── 20191128091917_V2019_11_28_1248.Designer.cs
│ │ ├── 20191128091917_V2019_11_28_1248.cs
│ │ ├── 20191128094456_V2019_11_28_1314.Designer.cs
│ │ ├── 20191128094456_V2019_11_28_1314.cs
│ │ ├── 20191227124331_V2019_12_27_1612.Designer.cs
│ │ ├── 20191227124331_V2019_12_27_1612.cs
│ │ ├── 20200119185013_V2020_01_19_2219.Designer.cs
│ │ ├── 20200119185013_V2020_01_19_2219.cs
│ │ ├── 20200119191252_V2020_01_19_2242.Designer.cs
│ │ ├── 20200119191252_V2020_01_19_2242.cs
│ │ ├── 20200304140231_V2020_03_04_1731.Designer.cs
│ │ ├── 20200304140231_V2020_03_04_1731.cs
│ │ ├── 20200618230958_V2020_06_19_0339.Designer.cs
│ │ ├── 20200618230958_V2020_06_19_0339.cs
│ │ ├── 20200619145542_V2020_06_19_1925.Designer.cs
│ │ ├── 20200619145542_V2020_06_19_1925.cs
│ │ ├── 20200619201401_V2020_06_20_0043.Designer.cs
│ │ ├── 20200619201401_V2020_06_20_0043.cs
│ │ ├── 20200904102953_V2020_09_04_1459.Designer.cs
│ │ ├── 20200904102953_V2020_09_04_1459.cs
│ │ ├── 20200904141744_V2020_09_04_1847.Designer.cs
│ │ ├── 20200904141744_V2020_09_04_1847.cs
│ │ ├── 20201029111725_V2020_10_29_1446.Designer.cs
│ │ ├── 20201029111725_V2020_10_29_1446.cs
│ │ └── ProjectDbContextModelSnapshot.cs
├── Models
│ ├── ErrorViewModel.cs
│ └── LoginModel.cs
├── Program.cs
├── Properties
│ └── launchSettings.json
├── Resources
│ ├── ILabelLocalizer.cs
│ ├── IMessageLocalizer.cs
│ ├── ISharedLocalizer.cs
│ ├── LabelsResource.resx
│ ├── LocalizationRegistry.cs
│ ├── MessagesResource.resx
│ ├── PermissionsResource.resx
│ └── SharedResource.resx
├── Startup.cs
├── add_migrations.cmd
├── appsettings.Development.json
├── appsettings.json
├── dotnet_run.bat
├── remove_migrations.cmd
└── update_db.cmd
├── DNTFrameworkCore.TestCqrsAPI
├── Application
│ ├── Catalog
│ │ ├── Handlers
│ │ │ ├── PriceTypeCommandHandlers.cs
│ │ │ └── ProductCommandHandlers.cs
│ │ └── Policies
│ │ │ └── PriceTypePolicy.cs
│ ├── DependencyInjection.cs
│ └── Sales
│ │ └── Handlers
│ │ └── SaleMethodCommandHandlers.cs
├── Authorization
│ └── Permissions.cs
├── Controllers
│ ├── PriceTypesController.cs
│ └── ProductsController.cs
├── DNTFrameworkCore.TestCqrsAPI.csproj
├── Domain
│ ├── Catalog
│ │ ├── Commands
│ │ │ ├── CreatePriceTypeCommand.cs
│ │ │ ├── CreateProductCommand.cs
│ │ │ ├── RemovePriceTypeCommand.cs
│ │ │ ├── RemoveProductCommand.cs
│ │ │ └── UpdateProductTitleCommand.cs
│ │ ├── Events
│ │ │ ├── PriceTypeCreatedDomainEvent.cs
│ │ │ └── ProductCreatedDomainEvent.cs
│ │ ├── Policies
│ │ │ ├── IPriceTypePolicy.cs
│ │ │ └── IProductPolicy.cs
│ │ ├── PriceType.cs
│ │ ├── Product.cs
│ │ ├── ProductPrice.cs
│ │ └── Repositories
│ │ │ ├── IPriceTypeRepository.cs
│ │ │ └── IProductRepository.cs
│ ├── Identity
│ │ ├── Claim.cs
│ │ ├── Permission.cs
│ │ ├── Role.cs
│ │ ├── RoleClaim.cs
│ │ ├── RolePermission.cs
│ │ ├── User.cs
│ │ ├── UserClaim.cs
│ │ ├── UserPermission.cs
│ │ ├── UserRole.cs
│ │ └── UserToken.cs
│ ├── Orders
│ │ ├── Address.cs
│ │ ├── Order.cs
│ │ ├── OrderHistory.cs
│ │ ├── OrderLine.cs
│ │ ├── OrderNote.cs
│ │ └── OrderStatus.cs
│ ├── Parties
│ │ └── Customer.cs
│ ├── Sales
│ │ ├── Action.cs
│ │ ├── ActionType.cs
│ │ ├── ActivityType.cs
│ │ ├── Commands
│ │ │ └── NewSaleMethod.cs
│ │ ├── Events
│ │ │ └── SaleMethodAddedDomainEvent.cs
│ │ ├── Repositories
│ │ │ └── ISaleMethodRepository.cs
│ │ ├── Rules
│ │ │ └── ISaleMethodRules.cs
│ │ ├── SaleMethod.cs
│ │ ├── SaleMethodPriceType.cs
│ │ ├── SaleMethodProduct.cs
│ │ ├── SaleMethodUser.cs
│ │ ├── SaleNature.cs
│ │ ├── State.cs
│ │ ├── StateType.cs
│ │ └── Transition.cs
│ ├── SeedWork
│ │ └── Identity.cs
│ └── SharedKernel
│ │ ├── Price.cs
│ │ └── Title.cs
├── Infrastructure
│ ├── Context
│ │ ├── DesignTimeDbContextFactory.cs
│ │ └── ProjectDbContext.cs
│ ├── DependencyInjection.cs
│ ├── Mappings
│ │ └── Identity
│ │ │ ├── ClaimConfiguration.cs
│ │ │ ├── PermissionConfiguration.cs
│ │ │ ├── RoleClaimConfiguration.cs
│ │ │ ├── RoleConfiguration.cs
│ │ │ ├── UserConfiguration.cs
│ │ │ └── UserTokenConfiguration.cs
│ └── Repositories
│ │ └── Catalog
│ │ ├── PriceTypeRepository.cs
│ │ └── ProductRepository.cs
├── Program.cs
├── Properties
│ └── launchSettings.json
├── Startup.cs
├── appsettings.Development.json
└── appsettings.json
├── DNTFrameworkCore.TestWebApp
├── Application
│ ├── ApplicationRegistry.cs
│ ├── Blogging
│ │ ├── BlogService.cs
│ │ ├── Models
│ │ │ ├── BlogModel.cs
│ │ │ └── MappingProfile.cs
│ │ └── Validators
│ │ │ └── BlogValidator.cs
│ ├── Catalog
│ │ ├── Models
│ │ │ ├── MappingProfile.cs
│ │ │ └── ProductModel.cs
│ │ ├── ProductService.cs
│ │ └── Validators
│ │ │ └── ProductValidator.cs
│ ├── Common
│ │ ├── DbSetup.cs
│ │ └── LookupService.cs
│ ├── Configuration
│ │ ├── ProjectOptions.cs
│ │ └── UserSeedOptions.cs
│ └── Identity
│ │ ├── Models
│ │ ├── MappingProfile.cs
│ │ ├── RoleFilteredPagedRequest.cs
│ │ ├── RoleModel.cs
│ │ ├── RoleReadModel.cs
│ │ ├── UserFilteredPagedQueryModel.cs
│ │ ├── UserModel.cs
│ │ └── UserReadModel.cs
│ │ ├── RoleService.cs
│ │ ├── UserService.cs
│ │ └── Validators
│ │ ├── RoleValidator.cs
│ │ └── UserValidator.cs
├── Authentication
│ ├── AuthenticationService.cs
│ ├── CookieOptions.cs
│ ├── CookieValidator.cs
│ └── SignInResult.cs
├── Authorization
│ ├── PermissionNames.cs
│ └── Permissions.cs
├── Controllers
│ ├── AccountController.cs
│ ├── BlogsController.cs
│ ├── HomeController.cs
│ ├── ProductsController.cs
│ ├── RolesController.cs
│ ├── SharedController.cs
│ └── UsersController.cs
├── DNTFrameworkCore.TestWebApp.csproj
├── Domain
│ ├── Blogging
│ │ └── Blog.cs
│ ├── Catalog
│ │ ├── PriceType.cs
│ │ ├── Product.cs
│ │ └── ProductPrice.cs
│ ├── Identity
│ │ ├── Claim.cs
│ │ ├── Permission.cs
│ │ ├── Role.cs
│ │ ├── RoleClaim.cs
│ │ ├── RoleNames.cs
│ │ ├── RolePermission.cs
│ │ ├── User.cs
│ │ ├── UserClaim.cs
│ │ ├── UserPermission.cs
│ │ └── UserRole.cs
│ └── Tasks
│ │ ├── Task.cs
│ │ └── TaskState.cs
├── Helpers
│ └── ModalDeleteLinkTagHelper.cs
├── Hubs
│ ├── NotificationHub.cs
│ └── NotificationHubMethods.cs
├── Infrastructure
│ ├── Context
│ │ ├── DesignTimeDbContextFactory.cs
│ │ └── ProjectDbContext.cs
│ ├── InfrastructureRegistry.cs
│ ├── Mappings
│ │ ├── Blogging
│ │ │ └── BlogConfiguration.cs
│ │ ├── Catalog
│ │ │ └── ProductConfiguration.cs
│ │ └── Identity
│ │ │ ├── ClaimConfiguration.cs
│ │ │ ├── PermissionConfiguration.cs
│ │ │ ├── RoleConfiguration.cs
│ │ │ └── UserConfiguration.cs
│ └── Migrations
│ │ ├── 20210318193433_V2021_03_18_2304.Designer.cs
│ │ ├── 20210318193433_V2021_03_18_2304.cs
│ │ └── ProjectDbContextModelSnapshot.cs
├── Models
│ ├── DeleteConfirmationModel.cs
│ ├── ErrorViewModel.cs
│ ├── LoginModel.cs
│ ├── Roles
│ │ ├── RoleIndexViewModel.cs
│ │ ├── RoleMapProfile.cs
│ │ └── RoleModalViewModel.cs
│ └── Users
│ │ ├── UserIndexViewModel.cs
│ │ └── UserModalViewModel.cs
├── Program.cs
├── Properties
│ └── launchSettings.json
├── Registry.cs
├── Resources
│ ├── ILabelLocalizer.cs
│ ├── IMessageLocalizer.cs
│ ├── ISharedLocalizer.cs
│ ├── LabelsResource.resx
│ ├── LocalizationRegistry.cs
│ ├── MessagesResource.resx
│ └── SharedResource.resx
├── Startup.cs
├── Views
│ ├── Account
│ │ └── Login.cshtml
│ ├── Blogs
│ │ ├── Index.cshtml
│ │ ├── _BlogPartial.cshtml
│ │ └── _List.cshtml
│ ├── Home
│ │ ├── Index.cshtml
│ │ └── Privacy.cshtml
│ ├── Products
│ │ ├── Index.cshtml
│ │ ├── _List.cshtml
│ │ └── _ProductPartial.cshtml
│ ├── Roles
│ │ ├── Index.cshtml
│ │ ├── _List.cshtml
│ │ ├── _Permission.cshtml
│ │ └── _RolePartial.cshtml
│ ├── Shared
│ │ ├── Error.cshtml
│ │ ├── _CookieConsentPartial.cshtml
│ │ ├── _DeleteConfirmation.cshtml
│ │ ├── _EntityFormLayout.cshtml
│ │ ├── _EntityListLayout.cshtml
│ │ ├── _Layout.cshtml
│ │ └── _ValidationScriptsPartial.cshtml
│ ├── Users
│ │ ├── Index.cshtml
│ │ ├── _List.cshtml
│ │ └── _UserPartial.cshtml
│ ├── _ViewImports.cshtml
│ └── _ViewStart.cshtml
├── add_migrations.cmd
├── appsettings.Development.json
├── appsettings.json
├── libman.json
├── remove_migrations.cmd
├── web.config
└── wwwroot
│ ├── css
│ └── site.css
│ ├── favicon.ico
│ ├── js
│ ├── jquery.bootstrap-toast.js
│ └── site.js
│ └── lib
│ └── jquery-ajax-unobtrusive
│ └── dist
│ ├── jquery.unobtrusive-ajax.js
│ └── jquery.unobtrusive-ajax.min.js
├── DNTFrameworkCore.Tests
├── DNTFrameworkCore.Tests.csproj
├── Eventing
│ └── EventBusTests.cs
├── Extensibility
│ ├── ExtensionFieldTests.cs
│ ├── ExtensionPropertyTests.cs
│ └── ExtensionPropertyTypeDescriptionProviderTests.cs
├── Querying
│ ├── FilterExpressionTests.cs
│ ├── PagedRequestTests.cs
│ └── SortExpressionTests.cs
├── TestSetup.cs
├── TestingHelper.cs
└── Validation
│ ├── MethodInvocationValidatorTests.cs
│ └── ValidationInterceptorTests.cs
├── DNTFrameworkCore.Web.EFCore.Tests
└── DNTFrameworkCore.Web.EFCore.Tests.csproj
├── DNTFrameworkCore.Web.Tenancy.Tests
└── DNTFrameworkCore.Web.Tenancy.Tests.csproj
└── DNTFrameworkCore.Web.Tests
└── DNTFrameworkCore.Web.Tests.csproj
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: ['https://coffeebede.ir/rabbal']
13 |
--------------------------------------------------------------------------------
/.github/workflows/aspnet-core-api-template.yml:
--------------------------------------------------------------------------------
1 | name: build aspnet-core-api template
2 |
3 | on:
4 | workflow_dispatch:
5 | push:
6 | tags:
7 | - v*
8 | jobs:
9 | build:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - uses: actions/checkout@v2
13 | - name: Setup .NET
14 | uses: actions/setup-dotnet@v1
15 | with:
16 | dotnet-version: 6.0.100
17 | - name: Restore dependencies
18 | run: dotnet restore templates/aspnet-core-api/content/ProjectName.sln
19 | - name: Build
20 | run: dotnet build templates/aspnet-core-api/content/ProjectName.sln --configuration Release
21 | - name: Pack
22 | run: dotnet pack templates/aspnet-core-api/nupkg.csproj -o templates/aspnet-core-api
23 | - name: Push Packages
24 | run: dotnet nuget push templates/aspnet-core-api/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
25 |
26 |
--------------------------------------------------------------------------------
/.github/workflows/dotnet.yml:
--------------------------------------------------------------------------------
1 | name: build
2 |
3 | on:
4 | workflow_dispatch:
5 | push:
6 | tags:
7 | - v*
8 | jobs:
9 | build:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - uses: actions/checkout@v2
13 | - name: Setup .NET
14 | uses: actions/setup-dotnet@v1
15 | with:
16 | dotnet-version: 6.0.x
17 | - name: Restore dependencies
18 | run: dotnet restore nupkg/nupkg.sln
19 | - name: Build
20 | run: dotnet build nupkg/nupkg.sln --no-restore --configuration Release
21 | #- name: Test
22 | # run: dotnet test --no-build --verbosity normal
23 | - name: Pack
24 | run: dotnet pack nupkg/nupkg.sln -o temp_nupkg --configuration Release
25 | - name: Push Packages
26 | run: dotnet nuget push ./temp_nupkg/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
27 |
--------------------------------------------------------------------------------
/docs/blog-crud-api.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/docs/blog-crud-api.JPG
--------------------------------------------------------------------------------
/docs/blog-crud-mvc.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/docs/blog-crud-mvc.PNG
--------------------------------------------------------------------------------
/docs/blog-crud-service.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/docs/blog-crud-service.JPG
--------------------------------------------------------------------------------
/docs/dnt-solution.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/docs/dnt-solution.jpg
--------------------------------------------------------------------------------
/docs/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/docs/logo.png
--------------------------------------------------------------------------------
/docs/role-modal-edit.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/docs/role-modal-edit.JPG
--------------------------------------------------------------------------------
/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "version": "6.0.100"
4 | }
5 | }
--------------------------------------------------------------------------------
/nupkg/nupkg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/nupkg/nupkg.png
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Cqrs.EFCore/DNTFrameworkCore.Cqrs.EFCore.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | latest
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Cqrs.EFCore/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/src/DNTFrameworkCore.Cqrs.EFCore/README.md
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Cqrs.Web/DNTFrameworkCore.Cqrs.Web.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DNTFrameworkCore.Cqrs.Web
5 | This Library Contains Infrastructures that Related to ASP.NET Core and CQRS
6 | .NET;ASP.NET Core;CQRS
7 | DNTFrameworkCore.Cqrs.Web
8 | DNTFrameworkCore.Cqrs.Web
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Cqrs.Web/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/src/DNTFrameworkCore.Cqrs.Web/README.md
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Cqrs/Behaviors/RetryBehavior.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using DNTFrameworkCore.Cqrs.Commands;
4 | using DNTFrameworkCore.Functional;
5 | using MediatR;
6 |
7 | namespace DNTFrameworkCore.Cqrs.Behaviors
8 | {
9 | public class RetryBehavior : IPipelineBehavior
10 | where TRequest : ICommand
11 | where TResponse : Result
12 | {
13 | public Task Handle(TRequest request, CancellationToken cancellationToken,
14 | RequestHandlerDelegate next)
15 | {
16 | throw new System.NotImplementedException();
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Cqrs/Commands/ICommand.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Functional;
2 | using MediatR;
3 |
4 | namespace DNTFrameworkCore.Cqrs.Commands
5 | {
6 | public interface ICommand : ICommand
7 | {
8 | }
9 |
10 | public interface ICommand : IRequest where TResult : Result
11 | {
12 | }
13 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Cqrs/Commands/ICommandHandler.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 | using DNTFrameworkCore.Functional;
3 |
4 | namespace DNTFrameworkCore.Cqrs.Commands
5 | {
6 | public interface ICommandHandler : ICommandHandler where TCommand : ICommand
7 | {
8 | }
9 |
10 | public interface ICommandHandler : IRequestHandler
11 | where TCommand : ICommand where TResult : Result
12 | {
13 | }
14 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Cqrs/DNTFrameworkCore.Cqrs.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | latest
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Cqrs/Queries/IFilteredPagedQuery.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Querying;
2 |
3 | namespace DNTFrameworkCore.Cqrs.Queries
4 | {
5 | public interface IFilteredPagedQuery : IQuery>, IFilteredPagedRequest
6 | {
7 | }
8 |
9 | public abstract class FilteredPagedQuery : FilteredPagedRequest, IFilteredPagedQuery
10 | {
11 | }
12 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Cqrs/Queries/IPagedQuery.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Querying;
2 |
3 | namespace DNTFrameworkCore.Cqrs.Queries
4 | {
5 | public interface IPagedQuery : IQuery>, IPagedRequest
6 | {
7 | }
8 |
9 | public abstract class PagedQuery : PagedRequest, IPagedQuery
10 | {
11 | }
12 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Cqrs/Queries/IQuery.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 |
3 | namespace DNTFrameworkCore.Cqrs.Queries
4 | {
5 | public interface IQuery : IRequest
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Cqrs/Queries/IQueryHandler.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 |
3 | namespace DNTFrameworkCore.Cqrs.Queries
4 | {
5 | public interface IQueryHandler : IRequestHandler
6 | where TQuery : IQuery
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Cqrs/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/src/DNTFrameworkCore.Cqrs/README.md
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore.SqlServer/DependencyInjection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.EFCore.Context.Hooks;
3 | using DNTFrameworkCore.EFCore.SqlServer.Numbering;
4 | using DNTFrameworkCore.Numbering;
5 | using Microsoft.Extensions.DependencyInjection;
6 |
7 | namespace DNTFrameworkCore.EFCore.SqlServer
8 | {
9 | public static class DependencyInjection
10 | {
11 | public static EFCoreBuilder WithNumberingHook(this EFCoreBuilder builder, Action options)
12 | {
13 | if (builder == null) throw new ArgumentNullException(nameof(builder));
14 | if (options == null) throw new ArgumentNullException(nameof(options));
15 |
16 | builder.Services.Configure(options);
17 | builder.Services.AddScoped();
18 |
19 | return builder;
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore.SqlServer/Numbering/DbContextExtensions.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.EFCore.Context;
2 |
3 | namespace DNTFrameworkCore.EFCore.SqlServer.Numbering
4 | {
5 | public static class DbContextExtensions
6 | {
7 | public static void AcquireDistributedLock(this IDbContext context, string resource)
8 | {
9 | context.ExecuteSqlRawCommand(@"EXEC sp_getapplock @Resource={0}, @LockOwner={1},
10 | @LockMode={2} , @LockTimeout={3};", resource, "Transaction", "Exclusive", 15000);
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore.SqlServer/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/src/DNTFrameworkCore.EFCore.SqlServer/README.md
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Context/Converters/Json/PropertyBuilderExtensions.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Microsoft.EntityFrameworkCore.Metadata.Builders;
3 |
4 | namespace DNTFrameworkCore.EFCore.Context.Converters.Json
5 | {
6 | public static class PropertyBuilderExtensions {
7 |
8 | ///
9 | /// Serializes field as JSON blob in database.
10 | ///
11 | public static PropertyBuilder HasJsonConversion(this PropertyBuilder propertyBuilder) where T : class {
12 |
13 | propertyBuilder
14 | .HasConversion(new JsonValueConverter())
15 | .Metadata.SetValueComparer(new JsonValueComparer());
16 |
17 | return propertyBuilder;
18 |
19 | }
20 |
21 | }
22 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Context/EntityChangeContext.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Microsoft.EntityFrameworkCore.ChangeTracking;
3 |
4 | namespace DNTFrameworkCore.EFCore.Context
5 | {
6 | public class EntityChangeContext
7 | {
8 | public IEnumerable EntityNames { get; }
9 | public IEnumerable EntityEntries { get; }
10 |
11 | public EntityChangeContext(IEnumerable names, IEnumerable entries)
12 | {
13 | EntityNames = names;
14 | EntityEntries = entries;
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Context/Extensions/EntityEntryExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using Microsoft.EntityFrameworkCore.ChangeTracking;
5 |
6 | namespace DNTFrameworkCore.EFCore.Context.Extensions
7 | {
8 | public static class EntityEntryExtensions
9 | {
10 | public static Dictionary ToDictionary(this EntityEntry entry,
11 | Func predicate)
12 | {
13 | return entry.Properties.Where(predicate)
14 | .ToDictionary(p => p.Metadata.Name, p => p.CurrentValue);
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Context/Hooks/HookEntityMetadata.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore.ChangeTracking;
2 |
3 | namespace DNTFrameworkCore.EFCore.Context.Hooks
4 | {
5 | public class HookEntityMetadata
6 | {
7 | public HookEntityMetadata(EntityEntry entry)
8 | {
9 | Entry = entry;
10 | }
11 |
12 | public EntityEntry Entry { get; }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Context/Hooks/IPostActionHook.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.EFCore.Context.Hooks
2 | {
3 | ///
4 | /// A hook that is executed after an action.
5 | ///
6 | public interface IPostActionHook : IHook
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Context/Hooks/IPreActionHook.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.EFCore.Context.Hooks
2 | {
3 | ///
4 | /// A hook that is executed before an action.
5 | ///
6 | public interface IPreActionHook : IHook
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Context/Hooks/PostDeleteHook.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 |
3 | namespace DNTFrameworkCore.EFCore.Context.Hooks
4 | {
5 | ///
6 | /// Implements a hook that will run after an entity gets deleted from the database.
7 | ///
8 | public abstract class PostDeleteHook : PostActionHook
9 | {
10 | ///
11 | /// Returns as the hookState to listen for.
12 | ///
13 | public override EntityState HookState => EntityState.Deleted;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Context/Hooks/PostInsertHook.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 |
3 | namespace DNTFrameworkCore.EFCore.Context.Hooks
4 | {
5 | ///
6 | /// Implements a hook that will run after an entity gets inserted into the database.
7 | ///
8 | public abstract class PostInsertHook : PostActionHook
9 | {
10 | ///
11 | /// Returns as the hookState to listen for.
12 | ///
13 | public override EntityState HookState => EntityState.Added;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Context/Hooks/PostUpdateHook.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 |
3 | namespace DNTFrameworkCore.EFCore.Context.Hooks
4 | {
5 | ///
6 | /// Implements a hook that will run after an entity gets updated in the database.
7 | ///
8 | public abstract class PostUpdateHook : PostActionHook
9 | {
10 | ///
11 | /// Returns as the hookState to listen for.
12 | ///
13 | public override EntityState HookState => EntityState.Modified;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Context/Hooks/PreDeleteHook.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 |
3 | namespace DNTFrameworkCore.EFCore.Context.Hooks
4 | {
5 | ///
6 | /// Implements a hook that will run before an entity gets deleted from the database.
7 | ///
8 | public abstract class PreDeleteHook : PreActionHook
9 | {
10 | ///
11 | /// Returns as the hookState to listen for.
12 | ///
13 | public override EntityState HookState => EntityState.Deleted;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Context/Hooks/PreFetchHook.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 |
3 | namespace DNTFrameworkCore.EFCore.Context.Hooks
4 | {
5 | public abstract class PreFetchHook : PreActionHook
6 | {
7 | public override EntityState HookState => EntityState.Unchanged;
8 | }
9 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Context/Hooks/PreInsertHook.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 |
3 | namespace DNTFrameworkCore.EFCore.Context.Hooks
4 | {
5 | ///
6 | /// Implements a hook that will run before an entity gets inserted into the database.
7 | ///
8 | public abstract class PreInsertHook : PreActionHook
9 | {
10 | ///
11 | /// Returns as the hookState to listen for.
12 | ///
13 | public override EntityState HookState => EntityState.Added;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Context/Hooks/PreUpdateHook.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 |
3 | namespace DNTFrameworkCore.EFCore.Context.Hooks
4 | {
5 | ///
6 | /// Implements a hook that will run before an entity gets updated in the database.
7 | ///
8 | public abstract class PreUpdateHook : PreActionHook
9 | {
10 | ///
11 | /// Returns as the hookstate to listen for.
12 | ///
13 | public override EntityState HookState => EntityState.Modified;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Context/IUnitOfWork.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Data;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 | using Microsoft.EntityFrameworkCore;
6 |
7 | namespace DNTFrameworkCore.EFCore.Context
8 | {
9 | public interface IUnitOfWork : IDisposable
10 | {
11 | DbSet Set() where TEntity : class;
12 | Task SaveChanges(CancellationToken cancellationToken = default);
13 |
14 | Task BeginTransaction(IsolationLevel isolationLevel = IsolationLevel.ReadCommitted, CancellationToken cancellationToken = default);
15 | Task CommitTransaction(CancellationToken cancellationToken = default);
16 | void RollbackTransaction();
17 | }
18 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Linq/QueryableExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Query.Internal;
4 |
5 | namespace DNTFrameworkCore.EFCore.Linq
6 | {
7 | public static class QueryableExtensions
8 | {
9 | public static IQueryable IncludePaths(this IQueryable source,
10 | params string[] paths) where TEntity : class
11 | {
12 | return !(source.Provider is EntityQueryProvider)
13 | ? source
14 | : source.Include(string.Join(".", paths));
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/Querying/NamedSorting.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 |
3 | namespace DNTFrameworkCore.EFCore.Querying
4 | {
5 | //TODO: Use in ToPagedListAsync method
6 | public abstract class NamedSorting
7 | {
8 | public string Name { get; set; }
9 |
10 | public IOrderedQueryable Apply(IQueryable queryable, bool descending)
11 | {
12 | return queryable is IOrderedQueryable ? ThenBy(queryable, descending) : By(queryable, descending);
13 | }
14 |
15 | protected abstract IOrderedQueryable By(IQueryable queryable, bool descending);
16 | protected abstract IOrderedQueryable ThenBy(IQueryable queryable, bool descending);
17 | }
18 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.EFCore/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/src/DNTFrameworkCore.EFCore/README.md
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.FluentValidation/DNTFrameworkCore.FluentValidation.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DNTFrameworkCore.FluentValidation
5 | This Library Contains Implementation of IModelValidator based on FluentValidation Library
6 | .NET;Validation;FluentValidation
7 | DNTFrameworkCore.FluentValidation
8 | DNTFrameworkCore.FluentValidation
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.FluentValidation/FluentModelValidator.cs:
--------------------------------------------------------------------------------
1 | using FluentValidation;
2 |
3 | namespace DNTFrameworkCore.FluentValidation
4 | {
5 | public abstract class FluentModelValidator : AbstractValidator
6 | {
7 | }
8 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.FluentValidation/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/src/DNTFrameworkCore.FluentValidation/README.md
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.FluentValidation/ServiceProviderValidatorFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Dependency;
3 | using FluentValidation;
4 |
5 | namespace DNTFrameworkCore.FluentValidation
6 | {
7 | ///
8 | /// Validator factory implementation that uses the asp.net service provider to construct validators.
9 | ///
10 | internal class ServiceProviderValidatorFactory : ValidatorFactoryBase, ITransientDependency
11 | {
12 | private readonly IServiceProvider _provider;
13 |
14 | public ServiceProviderValidatorFactory(IServiceProvider provider)
15 | {
16 | _provider = provider;
17 | }
18 |
19 | public override IValidator CreateInstance(Type validatorType)
20 | {
21 | return _provider.GetService(validatorType) as IValidator;
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Licensing/DNTFrameworkCore.Licensing.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DNTFrameworkCore.Licensing
5 | Lightweight Library for Build and Read Signed License based on SignedXml
6 | .NET;Licensing;License
7 | DNTFrameworkCore.Licensing
8 | DNTFrameworkCore.Licensing
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Licensing/ILicensedProduct.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Licensing
2 | {
3 | public interface ILicensedProduct
4 | {
5 | string ProductName { get; }
6 | string ProductVersion { get; }
7 | string UniqueId { get; }
8 | }
9 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Licensing/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/src/DNTFrameworkCore.Licensing/README.md
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.NHibernate/DNTFrameworkCore.NHibernate.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | latest
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web.EFCore/DNTFrameworkCore.Web.EFCore.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DNTFrameworkCore.Web.EFCore
5 | This Library Contains Infrastructures that Related to ASP.NET Core and EFCore
6 | .NET;ASP.NET Core;EFCore
7 | DNTFrameworkCore.Web.EFCore
8 | DNTFrameworkCore.Web.EFCore
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web.EFCore/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/src/DNTFrameworkCore.Web.EFCore/README.md
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web.Tenancy/HttpContextExtensions.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Tenancy;
2 | using Microsoft.AspNetCore.Http;
3 |
4 | namespace DNTFrameworkCore.Web.Tenancy
5 | {
6 | ///
7 | /// Extensions to HttpContext to make multi-tenancy easier to use
8 | ///
9 | public static class HttpContextExtensions
10 | {
11 | ///
12 | /// Returns the current tenant
13 | ///
14 | public static Tenant Tenant(this HttpContext context)
15 | {
16 | if (!context.Items.ContainsKey(TenancyConstants.HttpContextItemName))
17 | return null;
18 | return context.Items[TenancyConstants.HttpContextItemName] as Tenant;
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web.Tenancy/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/src/DNTFrameworkCore.Web.Tenancy/README.md
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Authorization/AuthorizationExtensions.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Runtime;
2 | using Microsoft.AspNetCore.Authorization;
3 |
4 | namespace DNTFrameworkCore.Web.Authorization
5 | {
6 | public static class AuthorizationExtensions
7 | {
8 | public static void AddHeadOfficeOnlyPolicy(this AuthorizationOptions options)
9 | {
10 | options.AddPolicy(PolicyNames.HeadOfficeOnly,
11 | policy => policy.RequireClaim(UserClaimTypes.IsHeadOffice, "true"));
12 | }
13 |
14 | public static void AddHeadTenantOnlyPolicy(this AuthorizationOptions options)
15 | {
16 | options.AddPolicy(PolicyNames.HeadTenantOnly,
17 | policy => policy.RequireClaim(UserClaimTypes.IsHeadTenant, "true"));
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Authorization/PermissionAuthorizeAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Authorization;
3 | using DNTFrameworkCore.Extensions;
4 | using Microsoft.AspNetCore.Authorization;
5 |
6 | namespace DNTFrameworkCore.Web.Authorization
7 | {
8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
9 | public class PermissionAuthorizeAttribute : AuthorizeAttribute
10 | {
11 | ///
12 | /// Creates a new instance of class.
13 | ///
14 | /// A list of permissions to authorize
15 | public PermissionAuthorizeAttribute(params string[] permissions)
16 | {
17 | Policy = $"{PermissionConstant.PolicyPrefix}{permissions.PackToString(PermissionConstant.PolicyNameSplitSymbol)}";
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Authorization/PolicyNames.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Web.Authorization
2 | {
3 | public static class PolicyNames
4 | {
5 | public const string HeadOfficeOnly = nameof(HeadOfficeOnly);
6 | public const string HeadTenantOnly = nameof(HeadTenantOnly);
7 | }
8 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Filters/NoResponseCacheAttribute.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Web.Filters
2 | {
3 | using System;
4 | using Microsoft.AspNetCore.Mvc;
5 |
6 | ///
7 | /// Represents an attribute that is used to mark an action method whose output will not be cached.
8 | ///
9 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
10 | public class NoResponseCacheAttribute : ResponseCacheAttribute
11 | {
12 | ///
13 | /// Initializes a new instance of the class.
14 | ///
15 | public NoResponseCacheAttribute()
16 | {
17 | NoStore = true;
18 | Location = ResponseCacheLocation.None;
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Hosting/TaskHostedService.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using DNTFrameworkCore.Tasks;
4 | using Microsoft.Extensions.Hosting;
5 |
6 | namespace DNTFrameworkCore.Web.Hosting
7 | {
8 | internal sealed class TaskHostedService : IHostedService
9 | {
10 | private readonly ITaskEngine _engine;
11 |
12 | public TaskHostedService(ITaskEngine engine)
13 | {
14 | _engine = engine;
15 | }
16 |
17 | public Task StartAsync(CancellationToken cancellationToken)
18 | {
19 | return _engine.RunOnStartup(cancellationToken);
20 | }
21 |
22 | public Task StopAsync(CancellationToken cancellationToken)
23 | {
24 | return _engine.RunOnEnd(cancellationToken);
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/IO/EnvironmentPath.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using DNTFrameworkCore.IO;
4 | using Microsoft.AspNetCore.Hosting;
5 |
6 | namespace DNTFrameworkCore.Web.IO
7 | {
8 | internal class EnvironmentPath : IEnvironmentPath
9 | {
10 | private readonly IWebHostEnvironment _hostingEnvironment;
11 |
12 | public EnvironmentPath(IWebHostEnvironment hostingEnvironment)
13 | {
14 | _hostingEnvironment = hostingEnvironment ?? throw new ArgumentNullException(nameof(hostingEnvironment));
15 | }
16 |
17 | public string MapPath(string path)
18 | {
19 | var filePath = Path.Combine(_hostingEnvironment.WebRootPath, path);
20 | return filePath;
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Localization/FaRequestCultureProvider.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Microsoft.AspNetCore.Http;
3 | using Microsoft.AspNetCore.Localization;
4 |
5 | namespace DNTFrameworkCore.Web.Localization
6 | {
7 | public class FaRequestCultureProvider : RequestCultureProvider
8 | {
9 | public override Task DetermineProviderCultureResult(HttpContext httpContext)
10 | {
11 | return Task.FromResult(new ProviderCultureResult("fa-IR"));
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Localization/LanguageAttribute.cs:
--------------------------------------------------------------------------------
1 | using System.Globalization;
2 | using Microsoft.AspNetCore.Mvc.Filters;
3 |
4 | namespace DNTFrameworkCore.Web.Localization
5 | {
6 | public class LanguageAttribute : ActionFilterAttribute
7 | {
8 | private readonly string _cultureName;
9 |
10 | public LanguageAttribute(string cultureName)
11 | {
12 | _cultureName = cultureName;
13 | }
14 |
15 | public override void OnActionExecuting(ActionExecutingContext context)
16 | {
17 | CultureInfo.CurrentCulture = new CultureInfo(_cultureName);
18 | CultureInfo.CurrentUICulture = new CultureInfo(_cultureName);
19 |
20 | base.OnActionExecuting(context);
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Mvc/AjaxOnlyAttribute.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Web.Extensions;
2 | using Microsoft.AspNetCore.Mvc.Abstractions;
3 | using Microsoft.AspNetCore.Mvc.ActionConstraints;
4 | using Microsoft.AspNetCore.Routing;
5 |
6 | namespace DNTFrameworkCore.Web.Mvc
7 | {
8 | ///
9 | /// Determines whether the HttpRequest's X-Requested-With header has XMLHttpRequest value.
10 | ///
11 | public class AjaxOnlyAttribute : ActionMethodSelectorAttribute
12 | {
13 | ///
14 | /// Determines whether the action selection is valid for the specified route context.
15 | ///
16 | public override bool IsValidForRequest(RouteContext routeContext, ActionDescriptor action)
17 | {
18 | return routeContext.HttpContext.Request.IsAjaxRequest();
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Mvc/HtmlHelperExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Text.Encodings.Web;
3 | using Microsoft.AspNetCore.Html;
4 |
5 | namespace DNTFrameworkCore.Web.Mvc
6 | {
7 | ///
8 | /// Html Helper Extensions
9 | ///
10 | public static class HtmlHelperExtensions
11 | {
12 | ///
13 | /// Convert IHtmlContent/TagBuilder to string
14 | ///
15 | public static string GetString(this IHtmlContent content)
16 | {
17 | using (var writer = new StringWriter())
18 | {
19 | content.WriteTo(writer, HtmlEncoder.Default);
20 | return writer.ToString();
21 | }
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Mvc/LookupItemExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using DNTFrameworkCore.Common;
4 | using Microsoft.AspNetCore.Mvc.Rendering;
5 |
6 | namespace DNTFrameworkCore.Web.Mvc
7 | {
8 | public static class LookupItemExtensions
9 | {
10 | public static IReadOnlyList ToSelectListItem(this IEnumerable> items)
11 | {
12 | return items.Select(i => new SelectListItem { Value = i.Value.ToString(), Text = i.Text}).ToList();
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Mvc/PRG/ImportModelStateAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.AspNetCore.Mvc;
3 | using Microsoft.AspNetCore.Mvc.Filters;
4 |
5 | namespace DNTFrameworkCore.Web.Mvc.PRG
6 | {
7 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
8 | public sealed class ImportModelStateAttribute : ModelStateTransfer
9 | {
10 | public override void OnActionExecuted(ActionExecutedContext filterContext)
11 | {
12 | if (!(filterContext.Controller is Controller controller) || filterContext.ModelState == null) return;
13 |
14 | if (filterContext.Result is ViewResult)
15 | {
16 | ImportModelState(filterContext);
17 | }
18 | else
19 | {
20 | RemoveModelState(filterContext);
21 | }
22 |
23 | base.OnActionExecuted(filterContext);
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Mvc/PagedListModel.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Querying;
2 |
3 | namespace DNTFrameworkCore.Web.Mvc
4 | {
5 | public class PagedListModel where TPagedRequest : IPagedRequest
6 | {
7 | public TPagedRequest Request { get; set; }
8 | public IPagedResult Result { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Mvc/TagHelpers/IfAttributeTagHelper.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Razor.TagHelpers;
2 |
3 | namespace DNTFrameworkCore.Web.Mvc.TagHelpers
4 | {
5 | [HtmlTargetElement(Attributes = IfAttributeName)]
6 | public class IfAttributeTagHelper : TagHelper
7 | {
8 | private const string IfAttributeName = "asp-if";
9 | public override int Order => -1000;
10 |
11 | [HtmlAttributeName(IfAttributeName)]
12 | public bool Include { get; set; } = true;
13 |
14 | public override void Process(TagHelperContext context, TagHelperOutput output)
15 | {
16 | if (!Include)
17 | {
18 | output.SuppressOutput();
19 | }
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Mvc/TagHelpers/IfTagHelper.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Razor.TagHelpers;
2 |
3 | namespace DNTFrameworkCore.Web.Mvc.TagHelpers
4 | {
5 | public class IfTagHelper : TagHelper
6 | {
7 | public override int Order => -1000;
8 |
9 | [HtmlAttributeName("asp-include-if")]
10 | public bool Include { get; set; } = true;
11 |
12 | [HtmlAttributeName("asp-exclude-if")]
13 | public bool Exclude { get; set; } = false;
14 |
15 | public override void Process(TagHelperContext context, TagHelperOutput output)
16 | {
17 | output.TagName = null;
18 | if (!Include || Exclude)
19 | {
20 | output.SuppressOutput();
21 | }
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Mvc/UrlChecker.cs:
--------------------------------------------------------------------------------
1 | using System.Text.RegularExpressions;
2 |
3 | namespace DNTFrameworkCore.Web.Mvc
4 | {
5 | public static class UrlChecker
6 | {
7 | private static readonly Regex UrlWithProtocolRegex = new Regex("^.{1,10}://.*$");
8 |
9 | public static bool IsRooted(string url)
10 | {
11 | return url.StartsWith("/") || UrlWithProtocolRegex.IsMatch(url);
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/src/DNTFrameworkCore.Web/README.md
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Results/InternalServerErrorObjectResult.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Http;
2 | using Microsoft.AspNetCore.Mvc;
3 |
4 | namespace DNTFrameworkCore.Web.Results
5 | {
6 | public class InternalServerErrorObjectResult : ObjectResult
7 | {
8 | public InternalServerErrorObjectResult(object error)
9 | : base(error)
10 | {
11 | StatusCode = StatusCodes.Status500InternalServerError;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Results/JavaScriptRedirectResult.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.GuardToolkit;
2 |
3 | namespace DNTFrameworkCore.Web.Results
4 | {
5 | public class JavaScriptRedirectResult : JavaScriptResult
6 | {
7 | private const string RedirectScriptFormat = "window.location = '{0}';";
8 |
9 | public JavaScriptRedirectResult(string redirectUrl)
10 | {
11 | Guard.ArgumentNotEmpty(redirectUrl, nameof(redirectUrl));
12 |
13 | Script = string.Format(RedirectScriptFormat, redirectUrl);
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Results/JavaScriptResult.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc;
2 |
3 | namespace DNTFrameworkCore.Web.Results
4 | {
5 | public class JavaScriptResult : ContentResult
6 | {
7 | public string Script { get => Content; set => Content = value; }
8 |
9 | public JavaScriptResult()
10 | {
11 | ContentType = "application/x-javascript";
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore.Web/Results/XmlResult.cs:
--------------------------------------------------------------------------------
1 | using System.Xml.Serialization;
2 | using DNTFrameworkCore.GuardToolkit;
3 | using Microsoft.AspNetCore.Mvc;
4 |
5 | namespace DNTFrameworkCore.Web.Results
6 | {
7 | public class XmlResult : ActionResult
8 | {
9 | private readonly object _data;
10 |
11 | public XmlResult(object data)
12 | {
13 | Guard.ArgumentNotNull(data, nameof(data));
14 |
15 | _data = data;
16 | }
17 |
18 | public override void ExecuteResult(ActionContext context)
19 | {
20 | Guard.ArgumentNotNull(context, nameof(context));
21 |
22 | var response = context.HttpContext.Response;
23 |
24 | var serializer = new XmlSerializer(_data.GetType());
25 |
26 | response.ContentType = "text/xml";
27 | serializer.Serialize(response.Body, _data);
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Application/Events/CreatedBusinessEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using DNTFrameworkCore.Eventing;
5 |
6 | namespace DNTFrameworkCore.Application
7 | {
8 | public class CreatedBusinessEvent : IBusinessEvent
9 | where TModel : MasterModel where TKey : IEquatable
10 | {
11 | public CreatedBusinessEvent(IEnumerable models)
12 | {
13 | Models = models.ToList();
14 | }
15 |
16 | public IReadOnlyList Models { get; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Application/Events/CreatingBusinessEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using DNTFrameworkCore.Eventing;
5 |
6 | namespace DNTFrameworkCore.Application
7 | {
8 | public class CreatingBusinessEvent : IBusinessEvent
9 | where TModel : MasterModel where TKey : IEquatable
10 | {
11 | public CreatingBusinessEvent(IEnumerable models)
12 | {
13 | Models = models.ToList();
14 | }
15 |
16 | public IReadOnlyList Models { get; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Application/Events/DeletedBusinessEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using DNTFrameworkCore.Eventing;
5 |
6 | namespace DNTFrameworkCore.Application
7 | {
8 | public class DeletedBusinessEvent : IBusinessEvent
9 | where TModel : MasterModel where TKey : IEquatable
10 | {
11 | public DeletedBusinessEvent(IEnumerable models)
12 | {
13 | Models = models.ToList();
14 | }
15 |
16 | public IReadOnlyList Models { get; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Application/Events/DeletingBusinessEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using DNTFrameworkCore.Eventing;
5 |
6 | namespace DNTFrameworkCore.Application
7 | {
8 | public class DeletingBusinessEvent : IBusinessEvent
9 | where TModel : MasterModel where TKey : IEquatable
10 | {
11 | public DeletingBusinessEvent(IEnumerable models)
12 | {
13 | Models = models.ToList();
14 | }
15 |
16 | public IReadOnlyList Models { get; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Application/Events/EditedBusinessEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using DNTFrameworkCore.Eventing;
5 |
6 | namespace DNTFrameworkCore.Application
7 | {
8 | public class EditedBusinessEvent : IBusinessEvent
9 | where TModel : MasterModel where TKey : IEquatable
10 | {
11 | public EditedBusinessEvent(IEnumerable> models)
12 | {
13 | Models = models.ToList();
14 | }
15 |
16 | public IReadOnlyList> Models { get; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Application/Events/EditingBusinessEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using DNTFrameworkCore.Eventing;
5 |
6 | namespace DNTFrameworkCore.Application
7 | {
8 | public class EditingBusinessEvent : IBusinessEvent
9 | where TModel : MasterModel where TKey : IEquatable
10 | {
11 | public EditingBusinessEvent(IEnumerable> models)
12 | {
13 | Models = models.ToList();
14 | }
15 |
16 | public IReadOnlyList> Models { get; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Application/Models/MasterModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace DNTFrameworkCore.Application
5 | {
6 | public abstract class MasterModel : MasterModel
7 | {
8 | }
9 |
10 | public abstract class MasterModel : ReadModel where TKey : IEquatable
11 | {
12 | public byte[] Version { get; set; }
13 | public virtual bool IsNew() => EqualityComparer.Default.Equals(Id, default);
14 | }
15 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Application/Models/ModifiedModel.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Application
2 | {
3 | public class ModifiedModel
4 | {
5 | public TValue NewValue { get; set; }
6 | public TValue OriginalValue { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Application/Models/ReadModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Application
4 | {
5 | public abstract class ReadModel : ReadModel
6 | {
7 | }
8 |
9 | public abstract class ReadModel where TKey : IEquatable
10 | {
11 | public TKey Id { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Authorization/PermissionConstant.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Authorization
2 | {
3 | public static class PermissionConstant
4 | {
5 | public const string PolicyPrefix = "Permission:";
6 | public const string PolicyNameSplitSymbol = ":";
7 | public const string PackingSymbol = ":";
8 | }
9 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Caching/Cache.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.Caching
5 | {
6 | public class Cache : Entity
7 | {
8 | public byte[] Value { get; set; }
9 | public DateTimeOffset ExpiresAtTime { get; set; }
10 | public long? SlidingExpirationInSeconds { get; set; }
11 | public DateTimeOffset? AbsoluteExpiration { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Common/Id.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Common
4 | {
5 | public class Id : Id
6 | {
7 | }
8 |
9 | public class Id where TValue : IEquatable
10 | {
11 | public TValue Value { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Common/LookupItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Common
4 | {
5 | ///
6 | /// Can be used to store Text/Value pairs.
7 | ///
8 | [Serializable]
9 | public class LookupItem : LookupItem
10 | {
11 | }
12 |
13 | ///
14 | /// Can be used to store Text/Value pairs.
15 | ///
16 | [Serializable]
17 | public class LookupItem
18 | {
19 | public string Text { get; set; }
20 | public TValue Value { get; set; }
21 | }
22 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Common/NameValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Common
4 | {
5 | ///
6 | /// Can be used to store Name/Value (or Key/Value) pairs.
7 | ///
8 | [Serializable]
9 | public class NameValue : NameValue
10 | {
11 | }
12 |
13 | ///
14 | /// Can be used to store Name/Value (or Key/Value) pairs.
15 | ///
16 | [Serializable]
17 | public class NameValue
18 | {
19 | ///
20 | /// Name.
21 | ///
22 | public string Name { get; set; }
23 |
24 | ///
25 | /// Value.
26 | ///
27 | public T Value { get; set; }
28 | }
29 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Common/SkipNormalizationAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Common
4 | {
5 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Parameter)]
6 | public class SkipNormalizationAttribute : Attribute
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Configuration/IKeyValueService.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using DNTFrameworkCore.Application;
3 | using DNTFrameworkCore.Functional;
4 |
5 | namespace DNTFrameworkCore.Configuration
6 | {
7 | public interface IKeyValueService : IApplicationService
8 | {
9 | Task SetValueAsync(string key, string value);
10 | Task> LoadValueAsync(string key);
11 | }
12 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Configuration/KeyValue.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace DNTFrameworkCore.Configuration
4 | {
5 | public class KeyValue : Entity, IHasRowVersion, IHasRowIntegrity, ICreationTracking, IModificationTracking
6 | {
7 | public virtual string Key { get; set; }
8 | public virtual string Value { get; set; }
9 | public byte[] Version { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Cryptography/EncryptedFieldAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Cryptography
4 | {
5 | [AttributeUsage(AttributeTargets.Property)]
6 | public sealed class EncryptedFieldAttribute : Attribute
7 | { }
8 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Cryptography/IProtectionService.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Dependency;
2 |
3 | namespace DNTFrameworkCore.Cryptography
4 | {
5 | ///
6 | /// More info: http://www.dotnettips.info/post/2519
7 | /// تولید توکنها، رمزنگاری کوئری استرینگها و یا کوکیهای کوتاه مدت
8 | ///
9 | public interface IProtectionService : ISingletonDependency
10 | {
11 | ///
12 | /// Decrypts the message
13 | ///
14 | string Decrypt(string inputText);
15 |
16 | ///
17 | /// Encrypts the message
18 | ///
19 | string Encrypt(string inputText);
20 | }
21 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Cryptography/ProtectionKey.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace DNTFrameworkCore.Cryptography
4 | {
5 | public class ProtectionKey : Entity
6 | {
7 | public string FriendlyName { get; set; }
8 | public string XmlValue { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Data/IDbSetup.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Dependency;
2 |
3 | namespace DNTFrameworkCore.Data
4 | {
5 | public interface IDbSetup : ITransientDependency
6 | {
7 | void Seed();
8 | }
9 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Dependency/ClonedSingletonDescriptor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Extensions.DependencyInjection;
3 |
4 | namespace DNTFrameworkCore.Dependency
5 | {
6 | public class ClonedSingletonDescriptor : ServiceDescriptor
7 | {
8 | public ClonedSingletonDescriptor(ServiceDescriptor parent, object implementationInstance)
9 | : base(parent.ServiceType, implementationInstance)
10 | {
11 | Parent = parent;
12 | }
13 |
14 | public ClonedSingletonDescriptor(ServiceDescriptor parent, Func implementationFactory)
15 | : base(parent.ServiceType, implementationFactory, ServiceLifetime.Singleton)
16 | {
17 | Parent = parent;
18 | }
19 |
20 | public ServiceDescriptor Parent { get; }
21 | }
22 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Dependency/INamedDependency.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Dependency
2 | {
3 | public interface INamedDependency
4 | {
5 | string Name { get; }
6 | }
7 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Dependency/IScopedDependency.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Dependency
2 | {
3 | public interface IScopedDependency
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Dependency/ISingletonDependency.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Dependency
2 | {
3 | public interface ISingletonDependency
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Dependency/ITenantScopedDependency.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Dependency
2 | {
3 | public interface ITenantScopedDependency
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Dependency/ITransientDependency.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Dependency
2 | {
3 | public interface ITransientDependency
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Dependency/LazyFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Extensions.DependencyInjection;
3 |
4 | namespace DNTFrameworkCore.Dependency
5 | {
6 | public sealed class LazyFactory : Lazy where T : class
7 | {
8 | public LazyFactory(IServiceProvider provider)
9 | : base(provider.GetRequiredService)
10 | {
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Domain/IAggregateRoot.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Domain
2 | {
3 | public interface IAggregateRoot : IEntity
4 | {
5 | }
6 |
7 | public interface IAggregateRootVersion
8 | {
9 | int Version { get; }
10 | void IncrementVersion();
11 | }
12 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Domain/ICreationTracking.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Domain
2 | {
3 | public interface ICreationTracking
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Domain/IDeletedEntity.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Domain
2 | {
3 | public interface IDeletedEntity
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Domain/IDomainEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Timing;
3 |
4 | namespace DNTFrameworkCore.Domain
5 | {
6 | public interface IDomainEvent
7 | {
8 | Guid Id { get; }
9 | DateTime DateTime { get; }
10 | }
11 |
12 | public abstract class DomainEvent : IDomainEvent
13 | {
14 | public Guid Id { get; } = Guid.NewGuid();
15 | public DateTime DateTime { get; } = SystemTime.Now();
16 | }
17 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Domain/IDomainEventHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using DNTFrameworkCore.Dependency;
4 |
5 | namespace DNTFrameworkCore.Domain
6 | {
7 | public interface IDomainEventHandler : ITransientDependency
8 | where T : IDomainEvent
9 | {
10 | Task Handle(T domainEvent, CancellationToken cancellationToken = default);
11 | }
12 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Domain/IHasRowIntegrity.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Domain
2 | {
3 | public interface IHasRowIntegrity
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Domain/IHasRowLevelSecurity.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Domain
2 | {
3 | public interface IHasRowLevelSecurity
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Domain/IHasRowVersion.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Domain
2 | {
3 | public interface IHasRowVersion
4 | {
5 | byte[] Version { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Domain/IModificationTracking.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Domain
2 | {
3 | public interface IModificationTracking
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Domain/INumberedEntity.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Domain
2 | {
3 | public interface INumberedEntity
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Domain/ITenantEntity.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Domain
2 | {
3 | public interface ITenantEntity
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Domain/ITrackable.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace DNTFrameworkCore.Domain
4 | {
5 | ///
6 | /// Interface implemented by entities that are change-tracked.
7 | ///
8 | public interface ITrackable
9 | {
10 | ///
11 | /// Change-tracking state of an entity.
12 | ///
13 | TrackingState TrackingState { get; set; }
14 |
15 | ///
16 | /// Properties on an entity that have been modified.
17 | ///
18 | ICollection ModifiedProperties { get; set; }
19 | }
20 |
21 | ///
22 | /// Change-tracking state of an entity.
23 | ///
24 | public enum TrackingState
25 | {
26 | Unchanged,
27 | Added,
28 | Modified,
29 | Deleted,
30 | }
31 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Domain/TrackableEntity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations.Schema;
4 |
5 | namespace DNTFrameworkCore.Domain
6 | {
7 | public abstract class TrackableEntity : TrackableEntity
8 | {
9 | }
10 |
11 | public abstract class TrackableEntity : Entity, ITrackable where TKey : IEquatable
12 | {
13 | [NotMapped] public TrackingState TrackingState { get; set; }
14 | [NotMapped] public ICollection ModifiedProperties { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/EntityHistory/EntityHistory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.EntityHistory
5 | {
6 | //Under development
7 | public class EntityHistory : IHasRowIntegrity, ICreationTracking
8 | {
9 | public string EntityName { get; set; }
10 | public string EntityId { get; set; }
11 | public string JsonOriginalValue { get; set; }
12 | public string JsonNewValue { get; set; }
13 |
14 | public DateTime CreatedDateTime { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Eventing/IBusinessEvent.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Eventing
2 | {
3 | public interface IBusinessEvent
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Eventing/IBusinessEventHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using DNTFrameworkCore.Dependency;
4 | using DNTFrameworkCore.Functional;
5 |
6 | namespace DNTFrameworkCore.Eventing
7 | {
8 | public interface IBusinessEventHandler : ITransientDependency
9 | where T : IBusinessEvent
10 | {
11 | Task Handle(T businessEvent, CancellationToken cancellationToken = default);
12 | }
13 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Eventing/IIntegrationEvent.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Eventing
2 | {
3 | //Under development
4 | public interface IIntegrationEvent
5 | {
6 | }
7 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Exceptions/BusinessRuleException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Exceptions
4 | {
5 | [Serializable]
6 | public class BusinessRuleException : Exception
7 | {
8 | public string Details { get; }
9 | public BusinessRuleException(string message) : base(message)
10 | {
11 | }
12 | public BusinessRuleException(string message, string details) : base(message)
13 | {
14 | Details = details;
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Exceptions/DbConcurrencyException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Exceptions
4 | {
5 | [Serializable]
6 | public class DbConcurrencyException : DbException
7 | {
8 | public DbConcurrencyException() : base(
9 | "The record has been modified since it was loaded. The operation was canceled!",
10 | null)
11 | {
12 | }
13 |
14 | public DbConcurrencyException(string message, Exception innerException)
15 | : base(message, innerException)
16 | {
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Exceptions/DbException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Exceptions
4 | {
5 | [Serializable]
6 | public class DbException : Exception
7 | {
8 | public DbException(string message, Exception innerException)
9 | : base(message, innerException)
10 | {
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Exceptions/DomainException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Exceptions
4 | {
5 | [Serializable]
6 | public class DomainException : Exception
7 | {
8 | public string Details { get; }
9 |
10 | public DomainException(string message) : base(message)
11 | {
12 | }
13 |
14 | public DomainException(string message, string details) : base(message)
15 | {
16 | Details = details;
17 | }
18 |
19 | public DomainException(string message, Exception innerException)
20 | : base(message, innerException)
21 | {
22 | }
23 |
24 | public DomainException(string message, string details, Exception innerException)
25 | : base(message, innerException)
26 | {
27 | Details = details;
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Exceptions/UserFriendlyException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Exceptions
4 | {
5 | [Serializable]
6 | public class UserFriendlyException : Exception
7 | {
8 | public UserFriendlyException(string message) : base(message)
9 | {
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Extensions/ComparableExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Extensions
4 | {
5 | public static class ComparableExtensions
6 | {
7 | ///
8 | /// Checks a value is between a minimum and maximum value.
9 | ///
10 | /// The value to be checked
11 | /// Minimum (inclusive) value
12 | /// Maximum (inclusive) value
13 | public static bool IsBetween(this T value, T minInclusiveValue, T maxInclusiveValue) where T : IComparable
14 | {
15 | return value.CompareTo(minInclusiveValue) >= 0 && value.CompareTo(maxInclusiveValue) <= 0;
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Extensions/EntityExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq.Expressions;
3 | using DNTFrameworkCore.Domain;
4 |
5 | namespace DNTFrameworkCore.Extensions
6 | {
7 | public static class EntityExtensions
8 | {
9 | public static Expression> IdEqualityExpression(TKey id)
10 | where TEntity : Entity
11 | where TKey : IEquatable
12 | {
13 | var instanceExpression = Expression.Parameter(typeof(TEntity));
14 |
15 | var bodyExpression = Expression.Equal(
16 | Expression.PropertyOrField(instanceExpression, nameof(Entity.Id)),
17 | Expression.Constant(id, typeof(TKey))
18 | );
19 |
20 | return Expression.Lambda>(bodyExpression, instanceExpression);
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Extensions/MemberInfoExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 | using System.Linq;
3 | using System.Reflection;
4 |
5 | namespace DNTFrameworkCore.Extensions
6 | {
7 | public static class MemberInfoExtensions
8 | {
9 | ///
10 | /// Returns DisplayFormatAttribute data.
11 | ///
12 | /// Property metadata info
13 | /// NullDisplayText
14 | public static string GetNullDisplayTextAttribute(this MemberInfo info)
15 | {
16 | var displayFormat = info.GetCustomAttributes(true).OfType().FirstOrDefault();
17 | return displayFormat == null ? string.Empty : displayFormat.NullDisplayText;
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/IO/IEnvironmentPath.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.IO
2 | {
3 | public interface IEnvironmentPath {
4 | string MapPath(string path);
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Identity/IRole.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Identity
2 | {
3 | public interface IRole
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Identity/IUser.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Identity
2 | {
3 | public interface IUser
4 | {
5 |
6 | }
7 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Linq/QueryableExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Linq.Expressions;
4 |
5 | namespace DNTFrameworkCore.Linq
6 | {
7 | public static class QueryableExtensions
8 | {
9 | public static IQueryable WhereIf(this IQueryable query, bool condition,
10 | Expression> predicate)
11 | {
12 | if (query == null) throw new ArgumentNullException(nameof(query));
13 | if (predicate == null) throw new ArgumentNullException(nameof(predicate));
14 |
15 | return condition
16 | ? query.Where(predicate)
17 | : query;
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Linq/ReplaceExpressionVisitor.cs:
--------------------------------------------------------------------------------
1 | using System.Linq.Expressions;
2 |
3 | namespace DNTFrameworkCore.Linq
4 | {
5 | public class ReplaceExpressionVisitor : ExpressionVisitor
6 | {
7 | private readonly Expression _newValue;
8 | private readonly Expression _oldValue;
9 |
10 | public ReplaceExpressionVisitor(Expression oldValue, Expression newValue)
11 | {
12 | _oldValue = oldValue;
13 | _newValue = newValue;
14 | }
15 |
16 | public override Expression Visit(Expression node)
17 | {
18 | return node == _oldValue ? _newValue : base.Visit(node);
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Localization/ILocalizableString.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Localization;
2 |
3 | namespace DNTFrameworkCore.Localization
4 | {
5 | ///
6 | /// Represents a string that can be localized when needed.
7 | ///
8 | public interface ILocalizableString
9 | {
10 | ///
11 | /// Localizes the string in current culture.
12 | ///
13 | /// StringLocalizer factory
14 | /// Localized string
15 | string Localize(IStringLocalizerFactory factory);
16 | }
17 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Localization/ITranslationService.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Localization
2 | {
3 | //Under development
4 | public interface ITranslationService
5 | {
6 | string this[string index] { get; }
7 |
8 | string Translate(string name, params object[] arguments);
9 | string Translate(string name);
10 | }
11 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Localization/LocalizationResourceAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Localization
4 | {
5 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
6 | public class LocalizationResourceAttribute : Attribute
7 | {
8 | ///
9 | /// gets or sets name of resource
10 | ///
11 | public string Name { get; set; }
12 |
13 | ///
14 | /// gets or sets location of resource
15 | ///
16 | public string Location { get; set; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Logging/DbLoggerOptions.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Logging
2 | {
3 | public class DbLoggerOptions : BatchingLoggerOptions
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Logging/LogItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Extensions.Logging;
3 |
4 | namespace DNTFrameworkCore.Logging
5 | {
6 | public struct LogItem
7 | {
8 | public string Message { get; set; }
9 | public LogLevel Level { get; set; }
10 | public DateTime CreationTime { get; set; }
11 | public string LoggerName { get; set; }
12 | public EventId EventId { get; set; }
13 | public string UserBrowserName { get; set; }
14 | public string UserIP { get; set; }
15 | public string UserId { get; set; }
16 | public string UserName { get; set; }
17 | public string UserDisplayName { get; set; }
18 | public string TenantId { get; set; }
19 | public string TenantName { get; set; }
20 | public string ImpersonatorUserId { get; set; }
21 | public string ImpersonatorTenantId { get; set; }
22 | }
23 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Mapping/Factory.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Mapping
2 | {
3 | using System;
4 | using System.Linq.Expressions;
5 |
6 | ///
7 | /// Creates instances of type .
8 | ///
9 | /// The type with a parameterless constructor.
10 | public static class Factory
11 | where T : new()
12 | {
13 | private static readonly Func FactoryFunc =
14 | Expression.Lambda>(Expression.New(typeof(T))).Compile();
15 |
16 | ///
17 | /// Creates an instance of type by calling it's parameterless constructor.
18 | ///
19 | /// An instance of type .
20 | public static T New() => FactoryFunc();
21 | }
22 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Mapping/IMapper.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Dependency;
2 |
3 | namespace DNTFrameworkCore.Mapping
4 | {
5 | ///
6 | /// Maps an object of type to .
7 | ///
8 | /// The type of the object to map from.
9 | /// The type of the object to map to.
10 | public interface IMapper : ITransientDependency
11 | {
12 | ///
13 | /// Maps the specified source object into the destination object.
14 | ///
15 | /// The source object to map from.
16 | /// The destination object to map to.
17 | void Map(TSource source, TDestination destination);
18 | }
19 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Metadata/EntityFieldMetadata.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Metadata
2 | {
3 | public class EntityFieldMetadata
4 | {
5 | public string Name { get; set; }
6 | public string DisplayName { get; set; }
7 | public bool Sorting { get; set; }
8 | public bool Filtering { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Metadata/EntityMetadata.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace DNTFrameworkCore.Metadata
5 | {
6 | public class EntityMetadata
7 | {
8 | public string Name { get; set; }
9 | public string DisplayName { get; set; }
10 | public IEnumerable Views { get; set; }
11 | public Type ServiceType { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Metadata/EntityViewFieldMetadata.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Metadata
4 | {
5 | public class EntityViewFieldMetadata
6 | {
7 | public string Name { get; set; }
8 | public string DisplayName { get; set; }
9 | public bool Sorting { get; set; }
10 | public bool Filtering { get; set; }
11 | public EntityViewFieldMetadata View { get; set; }
12 | }
13 |
14 | [AttributeUsage(AttributeTargets.Property)]
15 | public class EntityViewFieldAttribute : Attribute
16 | {
17 | public bool Sorting { get; set; }
18 | public bool Filtering { get; set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Metadata/EntityViewMetadata.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Metadata
2 | {
3 | public class EntityViewMetadata
4 | {
5 | public string Name { get; set; }
6 | public string DisplayName { get; set; }
7 | public EntityMetadata Entity { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Metadata/IMetadataService.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Metadata
2 | {
3 | public interface IMetadataService
4 | {
5 |
6 | }
7 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Metadata/Metadata.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 |
4 | namespace DNTFrameworkCore.Metadata
5 | {
6 | public sealed class Metadata
7 | {
8 | private static readonly Lazy _instance =
9 | new Lazy(() => new Metadata(), LazyThreadSafetyMode.ExecutionAndPublication);
10 |
11 | private Metadata()
12 | {
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Numbering/NumberedEntity.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace DNTFrameworkCore.Numbering
4 | {
5 | public class NumberedEntity : Entity
6 | {
7 | public string EntityName { get; set; }
8 | public long NextValue { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Numbering/NumberedEntityOption.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using DNTFrameworkCore.Common;
4 |
5 | namespace DNTFrameworkCore.Numbering
6 | {
7 | public class NumberedEntityOption
8 | {
9 | public string FieldName { get; set; }
10 | public IEnumerable Fields { get; set; } = new List();
11 | public int Start { get; set; } = 1;
12 | public int IncrementBy { get; set; } = 1;
13 | public string Prefix { get; set; }
14 |
15 | public Func, object> Normalize { get; set; }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Numbering/NumberingOptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace DNTFrameworkCore.Numbering
5 | {
6 | public class NumberingOptions
7 | {
8 | private readonly IDictionary> _mappings =
9 | new Dictionary>();
10 |
11 | public IEnumerable this[Type type]
12 | {
13 | get => _mappings[type];
14 | set => _mappings[type] = value;
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Persistence/IDbConnectionFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Data;
3 | using DNTFrameworkCore.Dependency;
4 |
5 | namespace DNTFrameworkCore.Persistence
6 | {
7 | public interface IDbConnectionFactory : IDisposable, IScopedDependency
8 | {
9 | IDbConnection Create();
10 | }
11 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Querying/FilteringLogic.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Querying
2 | {
3 | public static class FilteringLogic
4 | {
5 | public const string And = nameof(And);
6 | public const string Or = nameof(Or);
7 | public const string Not = nameof(Not);
8 | }
9 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Querying/IPagedResult.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace DNTFrameworkCore.Querying
4 | {
5 | public interface IPagedResult
6 | {
7 | IReadOnlyList ItemList { get; }
8 | long TotalCount { get; }
9 | }
10 |
11 | public class PagedResult : IPagedResult
12 | {
13 | public IReadOnlyList ItemList { get; set; } = new List();
14 | public long TotalCount { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Querying/QueryFieldAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Querying
4 | {
5 | [AttributeUsage(AttributeTargets.Property)]
6 | public class QueryFieldAttribute : Attribute
7 | {
8 | public string Name { get; set; }
9 | public bool Sorting { get; set; }
10 | public bool Filtering { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Querying/QueryingOptions.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Querying
2 | {
3 | public class QueryingOptions
4 | {
5 | public int PageSize { get; set; } = 10;
6 | public int MaxPageSize { get; set; } = 100;
7 | }
8 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/README.md:
--------------------------------------------------------------------------------
1 | # Markdown File
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Serialization/JsonFieldAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Serialization
4 | {
5 | ///
6 | /// Marks the property to be serialized into database as JSON.
7 | ///
8 | [AttributeUsage(AttributeTargets.Property)]
9 | public sealed class JsonFieldAttribute : Attribute {}
10 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Specifications/AnySpecification.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq.Expressions;
3 |
4 | namespace DNTFrameworkCore.Specifications
5 | {
6 | ///
7 | /// Represents the specification that can be satisfied by the given object
8 | /// in any circumstance.
9 | ///
10 | /// The type of the object to which the specification is applied.
11 | public sealed class AnySpecification : Specification
12 | {
13 | ///
14 | /// Gets the LINQ expression which represents the current specification.
15 | ///
16 | /// The LINQ expression.
17 | public override Expression> ToExpression()
18 | {
19 | return o => true;
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Specifications/CompositeSpecification.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Specifications
2 | {
3 | ///
4 | /// Represents the base class for composite specifications.
5 | ///
6 | /// The type of the object to which the specification is applied.
7 | public abstract class CompositeSpecification : Specification
8 | {
9 | ///
10 | /// Gets the first specification.
11 | ///
12 | public Specification Left { get; }
13 |
14 | ///
15 | /// Gets the second specification.
16 | ///
17 | public Specification Right { get; }
18 |
19 | protected CompositeSpecification(Specification left, Specification right)
20 | {
21 | Left = left;
22 | Right = right;
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Specifications/NoneSpecification.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq.Expressions;
3 |
4 | namespace DNTFrameworkCore.Specifications
5 | {
6 | ///
7 | /// Represents the specification that can be satisfied by the given object
8 | /// in no circumstance.
9 | ///
10 | /// The type of the object to which the specification is applied.
11 | public sealed class NoneSpecification : Specification
12 | {
13 | ///
14 | /// Gets the LINQ expression which represents the current specification.
15 | ///
16 | /// The LINQ expression.
17 | public override Expression> ToExpression()
18 | {
19 | return o => false;
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Specifications/QueryableExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 |
3 | namespace DNTFrameworkCore.Specifications
4 | {
5 | public static class QueryableExtensions
6 | {
7 | public static IQueryable Specify(this IQueryable query, Specification specification) where T : class
8 | {
9 | return query.Where(specification);
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Tasks/IBeginRequestTask.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 |
4 | namespace DNTFrameworkCore.Tasks
5 | {
6 | public interface IBeginRequestTask : ITask
7 | {
8 | Task Run(CancellationToken cancellationToken = default);
9 | }
10 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Tasks/IEndRequestTask.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 |
4 | namespace DNTFrameworkCore.Tasks
5 | {
6 | public interface IEndRequestTask : ITask
7 | {
8 | Task Run(CancellationToken cancellationToken = default);
9 | }
10 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Tasks/IEndTask.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 |
4 | namespace DNTFrameworkCore.Tasks
5 | {
6 | public interface IEndTask : ITask
7 | {
8 | Task Run(CancellationToken cancellationToken = default);
9 | }
10 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Tasks/IExceptionTask.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 |
5 | namespace DNTFrameworkCore.Tasks
6 | {
7 | public interface IExceptionTask : ITask
8 | {
9 | Task Run(Exception exception, CancellationToken cancellationToken = default);
10 | }
11 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Tasks/IStartupTask.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 |
4 | namespace DNTFrameworkCore.Tasks
5 | {
6 | public interface IStartupTask : ITask
7 | {
8 | Task Run(CancellationToken cancellationToken = default);
9 | }
10 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Tasks/ITask.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Tasks
2 | {
3 | public interface ITask
4 | {
5 | int Order { get; }
6 | }
7 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Tenancy/ITenantContainerFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Dependency;
3 |
4 | namespace DNTFrameworkCore.Tenancy
5 | {
6 | public interface ITenantContainerFactory : ISingletonDependency
7 | {
8 | IServiceProvider CreateContainer(string tenantId);
9 | }
10 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Tenancy/ITenantResolutionStrategy.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Tenancy
2 | {
3 | public interface ITenantResolutionStrategy
4 | {
5 | string TenantId();
6 | }
7 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Tenancy/ITenantStore.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace DNTFrameworkCore.Tenancy
4 | {
5 | public interface ITenantStore
6 | {
7 | Task FindTenantAsync(string tenantId);
8 | }
9 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Tenancy/TenancyConstants.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Tenancy
2 | {
3 | public static class TenancyConstants
4 | {
5 | public const string HttpContextItemName = "TENANT_ITEM";
6 | }
7 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Tenancy/TenancyExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Reflection;
3 |
4 | namespace DNTFrameworkCore.Tenancy
5 | {
6 | public static class TenancyExtensions
7 | {
8 | private static TenancySides FindTenancySides(this object instance)
9 | {
10 | var attribute= instance.GetType().GetTypeInfo()
11 | .GetCustomAttributes(typeof(TenancySideAttribute), true)
12 | .Cast()
13 | .FirstOrDefault();
14 |
15 | return attribute?.Side ?? TenancySides.None;
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Tenancy/TenancyOptions.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Tenancy
2 | {
3 | public sealed class TenancyOptions
4 | {
5 | public bool IsEnabled { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Tenancy/TenancySideAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Tenancy
4 | {
5 | ///
6 | /// Used to declare multi tenancy side of an object.
7 | ///
8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Method |
9 | AttributeTargets.Interface)]
10 | public sealed class TenancySideAttribute : Attribute
11 | {
12 | public TenancySides Side { get; }
13 |
14 | public TenancySideAttribute(TenancySides side)
15 | {
16 | Side = side;
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Tenancy/TenancySides.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Tenancy
4 | {
5 | ///
6 | /// Represents sides in a multi tenancy application.
7 | ///
8 | [Flags]
9 | public enum TenancySides
10 | {
11 | None = 0,
12 |
13 | ///
14 | /// Tenant side.
15 | ///
16 | Tenant = 1,
17 |
18 | ///
19 | /// Host (tenancy owner) side.
20 | ///
21 | HeadTenant = 1 << 1
22 | }
23 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Threading/AsyncHelper.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Threading.Tasks;
3 |
4 | namespace DNTFrameworkCore.Threading
5 | {
6 | public static class AsyncHelper
7 | {
8 | ///
9 | /// Checks if given method is an async method.
10 | ///
11 | /// A method to check
12 | public static bool IsAsync(this MethodInfo method)
13 | {
14 | return method.ReturnType == typeof(Task) ||
15 | (method.ReturnType.GetTypeInfo().IsGenericType &&
16 | method.ReturnType.GetGenericTypeDefinition() == typeof(Task<>));
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Timing/DateTimeKindAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Timing
4 | {
5 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Parameter)]
6 | public class DateTimeKindAttribute : Attribute
7 | {
8 | public DateTimeKind Kind { get; }
9 |
10 | public DateTimeKindAttribute(DateTimeKind kind)
11 | {
12 | Kind = kind;
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Timing/SystemClock.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Dependency;
3 |
4 | namespace DNTFrameworkCore.Timing
5 | {
6 | public interface ISystemClock : ISingletonDependency
7 | {
8 | ///
9 | /// Retrieves the current system time in UTC.
10 | ///
11 | DateTime Now { get; }
12 | DateTime Normalize(DateTime dateTime);
13 | }
14 |
15 | internal sealed class SystemClock : ISystemClock
16 | {
17 | //
18 | public DateTime Now => SystemTime.Now();
19 |
20 | public DateTime Normalize(DateTime dateTime)
21 | {
22 | return SystemTime.Normalize(dateTime);
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Timing/SystemTime.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Timing
4 | {
5 | public static class SystemTime
6 | {
7 | public static Func Now = () => DateTime.UtcNow;
8 |
9 | public static Func Normalize = dateTime =>
10 | DateTime.SpecifyKind(dateTime, DateTimeKind.Utc);
11 | }
12 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Transaction/TransactionOptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Data;
3 |
4 | namespace DNTFrameworkCore.Transaction
5 | {
6 | public sealed class TransactionOptions
7 | {
8 | public TimeSpan? Timeout { get; set; }
9 |
10 | public IsolationLevel? IsolationLevel { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Transaction/TransactionalAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Data;
3 |
4 | namespace DNTFrameworkCore.Transaction
5 | {
6 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Interface)]
7 | public sealed class TransactionalAttribute : Attribute
8 | {
9 | public IsolationLevel IsolationLevel { get; set; } = IsolationLevel.ReadCommitted;
10 | public TimeSpan? Timeout { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Validation/EnableValidationAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Validation
4 | {
5 | ///
6 | /// Can be added to a method to enable auto validation if validation is disabled for it's class.
7 | ///
8 | [AttributeUsage(AttributeTargets.Method)]
9 | public sealed class EnableValidationAttribute : Attribute
10 | {
11 | }
12 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Validation/Interception/IMethodParameterValidator.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using DNTFrameworkCore.Dependency;
3 |
4 | namespace DNTFrameworkCore.Validation.Interception
5 | {
6 | ///
7 | /// This interface is used to validate method parameters.
8 | ///
9 | public interface IMethodParameterValidator : ITransientDependency
10 | {
11 | IEnumerable Validate(object validatingObject);
12 | }
13 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Validation/NullModelValidator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace DNTFrameworkCore.Validation
6 | {
7 | public class NullModelValidator : IModelValidator
8 | {
9 | public bool CanValidateInstancesOfType(Type type)
10 | {
11 | return true;
12 | }
13 |
14 | public IEnumerable Validate(TModel model)
15 | {
16 | return Enumerable.Empty();
17 | }
18 |
19 | public IEnumerable Validate(object model)
20 | {
21 | return Enumerable.Empty();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Validation/SkipValidationAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.Validation
4 | {
5 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class )]
6 | public sealed class SkipValidationAttribute : Attribute
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Validation/ValidationFailure.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.GuardToolkit;
2 |
3 | namespace DNTFrameworkCore.Validation
4 | {
5 | public class ValidationFailure
6 | {
7 | public ValidationFailure(string memberName, string message)
8 | {
9 | MemberName = memberName ?? string.Empty;
10 | Message = Ensure.IsNotNullOrEmpty(message, nameof(message));
11 | }
12 |
13 | public string MemberName { get; }
14 | public string Message { get; }
15 |
16 | public override string ToString()
17 | {
18 | return $"[{MemberName}: {Message}]";
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/src/DNTFrameworkCore/Validation/ValidationOptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq.Expressions;
5 | using System.Threading;
6 |
7 | namespace DNTFrameworkCore.Validation
8 | {
9 | public class ValidationOptions
10 | {
11 | public ISet IgnoredTypes { get; } = new HashSet { typeof(Type), typeof(Stream), typeof(Expression), typeof(CancellationToken) };
12 | }
13 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rabbal/DNTFrameworkCore/d554f8849c3d05a37727cef3e6c704bc791b5371/templates/aspnet-core-api/README.md
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/.template.config/template.json:
--------------------------------------------------------------------------------
1 | {
2 | "author": "Salar Rabbal ",
3 | "classifications": [".NET Core", "ASP.NET Core", "Web API", "EFCore"],
4 | "name": "ASP.NET CORE WebAPI template",
5 | "identity": "DNTFrameworkCore.WebAPI",
6 | "shortName": "dntcore-api",
7 | "tags": {
8 | "language": "C#"
9 | },
10 | "sourceName": "ProjectName"
11 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.API/Authentication/SignInResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ProjectName.API.Authentication
4 | {
5 | public class SignInResult
6 | {
7 | private Token _token;
8 |
9 | private SignInResult() { }
10 | public static SignInResult Ok(Token token) => new SignInResult { Failed = false, _token = token };
11 | public static SignInResult Fail(string message) => new SignInResult { Failed = true, Message = message };
12 |
13 | public bool Failed { get; private set; }
14 | public string Message { get; private set; }
15 | public Token Token => !Failed ? _token : throw new InvalidOperationException();
16 | }
17 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.API/Authentication/TokenOptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ProjectName.API.Authentication
4 | {
5 | public class TokenOptions
6 | {
7 | public string SigningKey { set; get; }
8 | public string Issuer { set; get; }
9 | public string Audience { set; get; }
10 | public TimeSpan TokenExpiration { set; get; }
11 | public bool LoginFromSameUserEnabled { set; get; }
12 | public bool LogoutEverywhereEnabled { set; get; }
13 | }
14 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.API/Models/LoginModel.cs:
--------------------------------------------------------------------------------
1 | namespace ProjectName.API.Models
2 | {
3 | public class LoginModel
4 | {
5 | public string UserName { get; set; }
6 | public string Password { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.API/Resources/MessagesResource.cs:
--------------------------------------------------------------------------------
1 | namespace ProjectName.Resources.Resources
2 | {
3 | ///
4 | /// Dummy class to group message resources
5 | ///
6 | public class MessagesResource
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.API/Resources/MessagesResource.en-us.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 | text/microsoft-resx
4 |
5 |
6 | 1.3
7 |
8 |
9 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
10 |
11 |
12 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
13 |
14 |
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.API/Resources/MessagesResource.fa-ir.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 | text/microsoft-resx
4 |
5 |
6 | 1.3
7 |
8 |
9 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
10 |
11 |
12 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
13 |
14 |
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.API/Resources/SharedResource.cs:
--------------------------------------------------------------------------------
1 | namespace ProjectName.Resources.Resources
2 | {
3 | ///
4 | /// Dummy class to group shared resources
5 | ///
6 | public class SharedResource
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.API/Resources/SharedResource.en-us.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 | text/microsoft-resx
4 |
5 |
6 | 1.3
7 |
8 |
9 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
10 |
11 |
12 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
13 |
14 |
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.API/Resources/SharedResource.fa-ir.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 | text/microsoft-resx
4 |
5 |
6 | 1.3
7 |
8 |
9 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
10 |
11 |
12 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
13 |
14 |
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.API/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Debug",
5 | "System": "Information",
6 | "Microsoft": "Information"
7 | },
8 | "EFCore": {
9 | "LogLevel": {
10 | "Default": "Information",
11 | "Microsoft": "None",
12 | "System": "None"
13 | }
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.API/dotnet_publish.bat:
--------------------------------------------------------------------------------
1 | dotnet publish -c Release
2 | pause
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.API/dotnet_restore.bat:
--------------------------------------------------------------------------------
1 | rmdir /S /Q bin
2 | rmdir /S /Q obj
3 | dotnet restore
4 | pause
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.API/dotnet_run.bat:
--------------------------------------------------------------------------------
1 | dotnet watch run
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Application/Configuration/ProjectOptions.cs:
--------------------------------------------------------------------------------
1 | namespace ProjectName.Application.Configuration
2 | {
3 | public class ProjectOptions
4 | {
5 | public UserSeed UserSeed { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Application/Configuration/UserSeed.cs:
--------------------------------------------------------------------------------
1 | namespace ProjectName.Application.Configuration
2 | {
3 | public class UserSeed
4 | {
5 | public string UserName { get; set; }
6 | public string Password { get; set; }
7 | public string DisplayName { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Application/Identity/Models/PermissionModel.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Application;
2 |
3 | namespace ProjectName.Application.Identity.Models
4 | {
5 | public class PermissionModel : Model
6 | {
7 | public string Name { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Application/Identity/Models/RoleModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using DNTFrameworkCore.Application;
3 |
4 | namespace ProjectName.Application.Identity.Models
5 | {
6 | public class RoleModel : MasterModel
7 | {
8 | public string Name { get; set; }
9 | public string Description { get; set; }
10 | public ICollection Permissions { get; set; } = new HashSet();
11 | }
12 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Application/Identity/Models/RoleReadModel.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Application;
2 |
3 | namespace ProjectName.Application.Identity.Models
4 | {
5 | public class RoleReadModel : ReadModel
6 | {
7 | public string Name { get; set; }
8 | public string Description { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Application/Identity/Models/UserReadModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Application;
3 |
4 | namespace ProjectName.Application.Identity.Models
5 | {
6 | public class UserReadModel : ReadModel
7 | {
8 | public string UserName { get; set; }
9 | public string DisplayName { get; set; }
10 | public bool IsActive { get; set; }
11 | public DateTimeOffset? LastLoggedInDateTime { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Application/Identity/Models/UserRoleModel.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Application;
2 |
3 | namespace ProjectName.Application.Identity.Models
4 | {
5 | public class UserRoleModel : Model
6 | {
7 | public long RoleId { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Application/Localization/ITranslationService.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Dependency;
2 |
3 | namespace ProjectName.Application.Localization
4 | {
5 | public interface ITranslationService : ISingletonDependency
6 | {
7 | string this[string index] { get; }
8 | string Translate(string key, params object[] arguments);
9 | string Translate(string key);
10 | }
11 |
12 | public class NullTranslationService : ITranslationService
13 | {
14 | public static readonly ITranslationService Instance = new NullTranslationService();
15 | public string this[string index] => index;
16 | public string Translate(string key, params object[] arguments) => key;
17 | public string Translate(string key) => key;
18 | }
19 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Domain/Identity/Claim.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace ProjectName.Domain.Identity
4 | {
5 | public abstract class Claim : Entity, IHasRowIntegrity, ICreationTracking, IModificationTracking
6 | {
7 | public const int TypeLength = 256;
8 |
9 | public string Type { get; set; }
10 | public string Value { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Domain/Identity/Permission.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace ProjectName.Domain.Identity
4 | {
5 | ///
6 | /// Base class for TPH inheritance strategy
7 | ///
8 | public abstract class Permission : TrackableEntity, IHasRowIntegrity, ICreationTracking, IModificationTracking
9 | {
10 | public const int NameLength = 128;
11 |
12 | ///
13 | /// Unique Name of the Permission
14 | ///
15 | public string Name { get; set; }
16 |
17 | ///
18 | /// Indicate This Permission Is Granted With Role/User or Not
19 | ///
20 | public bool IsGranted { get; set; } = true;
21 | }
22 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Domain/Identity/RoleClaim.cs:
--------------------------------------------------------------------------------
1 | namespace ProjectName.Domain.Identity
2 | {
3 | public class RoleClaim : Claim
4 | {
5 | public Role Role { get; set; }
6 | public long RoleId { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Domain/Identity/RoleNames.cs:
--------------------------------------------------------------------------------
1 | namespace ProjectName.Domain.Identity
2 | {
3 | public static class RoleNames
4 | {
5 | public const string Administrators = nameof(Administrators);
6 | }
7 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Domain/Identity/RolePermission.cs:
--------------------------------------------------------------------------------
1 | namespace ProjectName.Domain.Identity
2 | {
3 | public class RolePermission : Permission
4 | {
5 | public long RoleId { get; set; }
6 | public Role Role { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Domain/Identity/UserClaim.cs:
--------------------------------------------------------------------------------
1 | namespace ProjectName.Domain.Identity
2 | {
3 | public class UserClaim : Claim
4 | {
5 | public User User { get; set; }
6 | public long UserId { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Domain/Identity/UserPermission.cs:
--------------------------------------------------------------------------------
1 | namespace ProjectName.Domain.Identity
2 | {
3 | public class UserPermission : Permission
4 | {
5 | public long UserId { get; set; }
6 | public User User { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Domain/Identity/UserRole.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace ProjectName.Domain.Identity
4 | {
5 | public class UserRole : TrackableEntity, IHasRowIntegrity, ICreationTracking, IModificationTracking
6 | {
7 | public long UserId { get; set; }
8 | public User User { get; set; }
9 | public Role Role { get; set; }
10 | public long RoleId { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Domain/Identity/UserToken.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace ProjectName.Domain.Identity
5 | {
6 | public class UserToken : TrackableEntity, ICreationTracking, IModificationTracking
7 | {
8 | public const int TokenHashLength = 256;
9 | public string TokenHash { get; set; }
10 | public DateTime TokenExpirationDateTime { get; set; }
11 | public long UserId { get; set; }
12 | public User User { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Domain/ProjectName.Domain.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Infrastructure/Mappings/Identity/PermissionConfiguration.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Microsoft.EntityFrameworkCore.Metadata.Builders;
3 | using ProjectName.Domain.Identity;
4 |
5 | namespace ProjectName.Infrastructure.Mappings.Identity
6 | {
7 | public class PermissionConfiguration : IEntityTypeConfiguration
8 | {
9 | public void Configure(EntityTypeBuilder builder)
10 | {
11 | builder.HasDiscriminator("EntityName");
12 | builder.Property(a => a.Name).HasMaxLength(Permission.NameLength).IsRequired();
13 | builder.Property("EntityName").HasMaxLength(50);
14 |
15 | builder.HasIndex("EntityName").HasDatabaseName("IX_Permission_EntityName");
16 |
17 | builder.ToTable(nameof(Permission));
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Infrastructure/Mappings/Identity/UserTokenConfiguration.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Microsoft.EntityFrameworkCore.Metadata.Builders;
3 | using ProjectName.Domain.Identity;
4 |
5 | namespace ProjectName.Infrastructure.Mappings.Identity
6 | {
7 | public class UserTokenConfiguration : IEntityTypeConfiguration
8 | {
9 | public void Configure(EntityTypeBuilder builder)
10 | {
11 | builder.Property(a => a.TokenHash).HasMaxLength(UserToken.TokenHashLength).IsRequired();
12 |
13 | builder.HasIndex(a => a.TokenHash).HasDatabaseName("IX_UserToken_TokenHash");
14 |
15 | builder.ToTable(nameof(UserToken));
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Infrastructure/add_migrations.cmd:
--------------------------------------------------------------------------------
1 | For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set _date=%%c_%%a_%%b)
2 | For /f "tokens=1-2 delims=/:" %%a in ("%TIME: =0%") do (set _time=%%a%%b)
3 | dotnet build
4 | dotnet ef migrations --startup-project ../ProjectName.API/ add V%_date%_%_time%
5 | pause
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Infrastructure/remove_migrations.cmd:
--------------------------------------------------------------------------------
1 | dotnet ef migrations --startup-project ../ProjectName.API/ remove
2 | pause
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/src/ProjectName.Infrastructure/update_db.cmd:
--------------------------------------------------------------------------------
1 | dotnet ef --startup-project ../ProjectName.API/ database update
2 | pause
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/test/ProjectName.IntegrationTests/Stubs/StubEventBus.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using DNTFrameworkCore.Domain;
4 | using DNTFrameworkCore.Eventing;
5 | using DNTFrameworkCore.Functional;
6 |
7 | namespace ProjectName.IntegrationTests.Stubs
8 | {
9 | public class StubEventBus : IEventBus
10 | {
11 | public Task Dispatch(IBusinessEvent businessEvent, CancellationToken cancellationToken = default)
12 | {
13 | return Task.FromResult(Result.Ok());
14 | }
15 |
16 | public Task Dispatch(IDomainEvent domainEvent, CancellationToken cancellationToken = default)
17 | {
18 | return Task.CompletedTask;
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/templates/aspnet-core-api/content/update_dependencies.bat:
--------------------------------------------------------------------------------
1 | dotnet restore
2 | setx DOTNET_HOST_PATH "%ProgramFiles%\dotnet\dotnet.exe" /M
3 | dotnet tool uninstall --global dotnet-outdated
4 | dotnet tool update --global dotnet-outdated-tool
5 | dotnet outdated -u
6 | dotnet restore
7 | pause
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.EFCore.Tests/Numbering/NumberingPreInsertHookTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 |
3 | namespace DNTFrameworkCore.EFCore.Tests.Numbering
4 | {
5 | [TestFixture]
6 | public class NumberingPreInsertHookTests
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.EFCore.Tests/Numbering/NumberingTestEntity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.EFCore.Tests.Numbering
5 | {
6 | public class NumberingTestEntity : Entity, INumberedEntity, ICreationTracking, IModificationTracking
7 | {
8 | public string Number { get; set; }
9 | public string NumberBasedOnBranchId { get; set; }
10 | public string NumberBasedOnBranchIdDateTime { get; set; }
11 | public string NumberBasedOnBranchIdCreatedDateTime { get; set; }
12 | public long BranchId { get; set; }
13 | public DateTime DateTime { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.EFCore.Tests/TestingHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | namespace DNTFrameworkCore.EFCore.Tests
5 | {
6 | public static class TestingHelper
7 | {
8 | public static void ExecuteInParallel(Action test, int count = 10)
9 | {
10 | var tests = new Action[count];
11 | for (var i = 0; i < count; i++)
12 | {
13 | tests[i] = test;
14 | }
15 |
16 | Parallel.Invoke(tests);
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.FluentValidation.Tests/ServiceProviderValidatorFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FluentValidation;
3 |
4 | namespace DNTFrameworkCore.FluentValidation.Tests
5 | {
6 | public class ServiceProviderValidatorFactory : ValidatorFactoryBase {
7 | private readonly IServiceProvider _serviceProvider;
8 |
9 | public ServiceProviderValidatorFactory(IServiceProvider serviceProvider) {
10 | _serviceProvider = serviceProvider;
11 | }
12 |
13 | public override IValidator CreateInstance(Type validatorType) {
14 | return _serviceProvider.GetService(validatorType) as IValidator;
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.Licensing.Tests/FingerPrintTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Shouldly;
3 |
4 | namespace DNTFrameworkCore.Licensing.Tests
5 | {
6 | [TestFixture]
7 | public class FingerPrintTests
8 | {
9 | [Test]
10 | public void Should_Create_16_Bytes_FingerPrint()
11 | {
12 | var value = FingerPrint.Value;
13 | value.ShouldNotBeNull();
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.Licensing.Tests/LicensedProduct.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.Licensing.Tests
2 | {
3 | public class LicensedProduct : ILicensedProduct
4 | {
5 | public LicensedProduct(string productVersion, string serialNumber, string productName)
6 | {
7 | ProductVersion = productVersion;
8 | UniqueId = serialNumber;
9 | ProductName = productName;
10 | }
11 |
12 | public string ProductName { get; }
13 | public string ProductVersion { get; }
14 | public string UniqueId { get; }
15 | }
16 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Application/Blogging/Validators/BlogValidator.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.FluentValidation;
2 | using DNTFrameworkCore.TestAPI.Application.Blogging.Models;
3 | using DNTFrameworkCore.TestAPI.Resources;
4 | using FluentValidation;
5 |
6 | namespace DNTFrameworkCore.TestAPI.Application.Blogging.Validators
7 | {
8 | public class BlogValidator : FluentModelValidator
9 | {
10 | public BlogValidator(IMessageLocalizer localizer)
11 | {
12 | RuleFor(b => b.Title).NotEmpty()
13 | .WithMessage(localizer["Blog.Fields.Title.Required"]);
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Application/Configuration/ProjectOptions.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestAPI.Application.Configuration
2 | {
3 | public class ProjectOptions
4 | {
5 | public UserSeedOptions UserSeed { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Application/Configuration/UserSeedOptions.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestAPI.Application.Configuration
2 | {
3 | public class UserSeedOptions
4 | {
5 | public string UserName { get; set; }
6 | public string Password { get; set; }
7 | public string DisplayName { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Application/Identity/Models/PermissionModel.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Application;
2 |
3 | namespace DNTFrameworkCore.TestAPI.Application.Identity.Models
4 | {
5 | public class PermissionModel : Model
6 | {
7 | public string Name { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Application/Identity/Models/RoleModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using DNTFrameworkCore.Application;
3 |
4 | namespace DNTFrameworkCore.TestAPI.Application.Identity.Models
5 | {
6 | public class RoleModel : MasterModel
7 | {
8 | public string Name { get; set; }
9 | public string Description { get; set; }
10 | public ICollection Permissions { get; set; } = new HashSet();
11 | }
12 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Application/Identity/Models/RoleReadModel.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Application;
2 |
3 | namespace DNTFrameworkCore.TestAPI.Application.Identity.Models
4 | {
5 | public class RoleReadModel : ReadModel
6 | {
7 | public string Name { get; set; }
8 | public string Description { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Application/Identity/Models/UserReadModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Application;
3 |
4 | namespace DNTFrameworkCore.TestAPI.Application.Identity.Models
5 | {
6 | public class UserReadModel : ReadModel
7 | {
8 | public string UserName { get; set; }
9 | public string DisplayName { get; set; }
10 | public bool IsActive { get; set; }
11 | public DateTimeOffset? LastLoggedInDateTime { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Application/Identity/Models/UserRoleModel.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Application;
2 |
3 | namespace DNTFrameworkCore.TestAPI.Application.Identity.Models
4 | {
5 | public class UserRoleModel : Model
6 | {
7 | public long RoleId { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Application/Tasks/Models/TaskFilteredPagedQueryModel.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Querying;
2 | using DNTFrameworkCore.TestAPI.Domain.Tasks;
3 |
4 | namespace DNTFrameworkCore.TestAPI.Application.Tasks.Models
5 | {
6 | public class TaskFilteredPagedRequest : FilteredPagedRequest
7 | {
8 | public TaskState? State { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Application/Tasks/Models/TaskReadModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Application;
3 | using DNTFrameworkCore.TestAPI.Domain.Tasks;
4 |
5 | namespace DNTFrameworkCore.TestAPI.Application.Tasks.Models
6 | {
7 | public class TaskReadModel : ReadModel
8 | {
9 | public string Title { get; set; }
10 | public string Number { get; set; }
11 | public TaskState State { get; set; } = TaskState.Todo;
12 | public DateTime LocalDateTime { get; set; }
13 | public DateTime CreatedDateTime { get; set; }
14 | public DateTime? NullableDateTime { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Application/Tasks/Validators/TaskValidator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using DNTFrameworkCore.TestAPI.Application.Tasks.Models;
4 | using DNTFrameworkCore.TestAPI.Domain.Tasks;
5 | using DNTFrameworkCore.Validation;
6 |
7 | namespace DNTFrameworkCore.TestAPI.Application.Tasks.Validators
8 | {
9 | public class TaskValidator : ModelValidator
10 | {
11 | public override IEnumerable Validate(TaskModel model)
12 | {
13 | if (!Enum.IsDefined(typeof(TaskState), model.State))
14 | {
15 | yield return new ValidationFailure(nameof(TaskModel.State), "Validation from IModelValidator");
16 | }
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Authentication/SignInResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.TestAPI.Authentication
4 | {
5 | public class SignInResult
6 | {
7 | private Token _token;
8 |
9 | private SignInResult() { }
10 | public static SignInResult Ok(Token token) => new SignInResult { Failed = false, _token = token };
11 | public static SignInResult Fail(string message) => new SignInResult { Failed = true, Message = message };
12 |
13 | public bool Failed { get; private set; }
14 | public string Message { get; private set; }
15 | public Token Token => !Failed ? _token : throw new InvalidOperationException();
16 | }
17 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Authentication/TokenOptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DNTFrameworkCore.TestAPI.Authentication
4 | {
5 | public class TokenOptions
6 | {
7 | public string SigningKey { set; get; }
8 | public string Issuer { set; get; }
9 | public string Audience { set; get; }
10 | public TimeSpan TokenExpiration { set; get; }
11 | public bool LoginFromSameUserEnabled { set; get; }
12 | public bool LogoutEverywhereEnabled { set; get; }
13 | }
14 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Domain/Blogging/Blog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.TestAPI.Domain.Blogging
5 | {
6 | public class Blog : Entity, IHasRowVersion, IHasRowIntegrity, ICreationTracking, IModificationTracking
7 | {
8 | public const int MaxTitleLength = 50;
9 | public const int MaxUrlLength = 50;
10 | public string Title { get; set; }
11 | public string NormalizedTitle { get; set; }
12 | public string Url { get; set; }
13 | public byte[] Version { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Domain/Identity/Claim.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.TestAPI.Domain.Identity
5 | {
6 | public abstract class Claim : Entity, IHasRowIntegrity, ICreationTracking, IModificationTracking
7 | {
8 | public const int MaxTypeLength = 256;
9 |
10 | public string Type { get; set; }
11 | public string Value { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Domain/Identity/Permission.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.TestAPI.Domain.Identity
5 | {
6 | public abstract class Permission : TrackableEntity, IHasRowIntegrity, ICreationTracking, IModificationTracking
7 | {
8 | public const int MaxNameLength = 128;
9 | public string Name { get; set; }
10 | public bool IsGranted { get; set; } = true;
11 |
12 | }
13 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Domain/Identity/RoleClaim.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestAPI.Domain.Identity
2 | {
3 | public class RoleClaim : Claim
4 | {
5 | public Role Role { get; set; }
6 | public long RoleId { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Domain/Identity/RoleNames.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestAPI.Domain.Identity
2 | {
3 | public static class RoleNames
4 | {
5 | public const string Administrators = nameof(Administrators);
6 | }
7 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Domain/Identity/RolePermission.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestAPI.Domain.Identity
2 | {
3 | public class RolePermission : Permission
4 | {
5 | public long RoleId { get; set; }
6 | public Role Role { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Domain/Identity/UserClaim.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestAPI.Domain.Identity
2 | {
3 | public class UserClaim : Claim
4 | {
5 | public User User { get; set; }
6 | public long UserId { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Domain/Identity/UserPermission.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestAPI.Domain.Identity
2 | {
3 | public class UserPermission : Permission
4 | {
5 | public long UserId { get; set; }
6 | public User User { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Domain/Identity/UserRole.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.TestAPI.Domain.Identity
5 | {
6 | public class UserRole : TrackableEntity, IHasRowIntegrity, ICreationTracking, IModificationTracking
7 | {
8 | public long UserId { get; set; }
9 | public User User { get; set; }
10 | public Role Role { get; set; }
11 | public long RoleId { get; set; }
12 |
13 | }
14 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Domain/Identity/UserToken.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.TestAPI.Domain.Identity
5 | {
6 | public class UserToken : Entity, IHasRowIntegrity, ICreationTracking, IModificationTracking
7 | {
8 | public const int MaxTokenHashLength = 256;
9 | public string TokenHash { get; set; }
10 | public DateTime TokenExpirationDateTime { get; set; }
11 | public long UserId { get; set; }
12 | public User User { get; set; }
13 |
14 | }
15 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Domain/Tasks/TaskState.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestAPI.Domain.Tasks
2 | {
3 | public enum TaskState : byte
4 | {
5 | Todo = 1,
6 | Doing = 2,
7 | Done = 3
8 | }
9 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Hubs/NotificationHubMethods.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestAPI.Hubs
2 | {
3 | public static class NotificationHubMethods
4 | {
5 | public const string Send = nameof(Send);
6 | }
7 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Infrastructure/Mappings/Blogging/BlogConfiguration.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.TestAPI.Domain.Blogging;
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Metadata.Builders;
4 |
5 | namespace DNTFrameworkCore.TestAPI.Infrastructure.Mappings.Blogging
6 | {
7 | public class BlogConfiguration : IEntityTypeConfiguration
8 | {
9 | public void Configure(EntityTypeBuilder builder)
10 | {
11 | builder.Property(b => b.Title).IsRequired().HasMaxLength(Blog.MaxTitleLength);
12 | builder.Property(b => b.NormalizedTitle).IsRequired().HasMaxLength(Blog.MaxTitleLength);
13 | builder.Property(b => b.Url).IsRequired().HasMaxLength(Blog.MaxUrlLength);
14 |
15 | builder.HasIndex(b => b.NormalizedTitle).HasDatabaseName("Blog_NormalizedTitle").IsUnique();
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Infrastructure/Mappings/Identity/PermissionConfiguration.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.TestAPI.Domain.Identity;
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Metadata.Builders;
4 |
5 | namespace DNTFrameworkCore.TestAPI.Infrastructure.Mappings.Identity
6 | {
7 | public class PermissionConfiguration : IEntityTypeConfiguration
8 | {
9 | public void Configure(EntityTypeBuilder builder)
10 | {
11 | builder.HasDiscriminator("EntityName");
12 | builder.Property(a => a.Name).HasMaxLength(Permission.MaxNameLength).IsRequired();
13 | builder.Property("EntityName").HasMaxLength(50);
14 |
15 | builder.HasIndex("EntityName").HasDatabaseName("IX_Permission_EntityName");
16 |
17 | builder.ToTable(nameof(Permission));
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Infrastructure/Mappings/Identity/UserTokenConfiguration.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.TestAPI.Domain.Identity;
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Metadata.Builders;
4 |
5 | namespace DNTFrameworkCore.TestAPI.Infrastructure.Mappings.Identity
6 | {
7 | public class UserTokenConfiguration : IEntityTypeConfiguration
8 | {
9 | public void Configure(EntityTypeBuilder builder)
10 | {
11 | builder.Property(a => a.TokenHash).HasMaxLength(UserToken.MaxTokenHashLength).IsRequired();
12 |
13 | builder.HasIndex(a => a.TokenHash).HasDatabaseName("IX_UserToken_TokenHash");
14 |
15 | builder.ToTable(nameof(UserToken));
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Infrastructure/Migrations/20191128091917_V2019_11_28_1248.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore.Migrations;
2 |
3 | namespace DNTFrameworkCore.TestAPI.Infrastructure.Migrations
4 | {
5 | public partial class V2019_11_28_1248 : Migration
6 | {
7 | protected override void Up(MigrationBuilder migrationBuilder)
8 | {
9 | migrationBuilder.AddColumn(
10 | name: "Hash",
11 | table: "Task",
12 | maxLength: 256,
13 | nullable: false,
14 | defaultValue: "");
15 | }
16 |
17 | protected override void Down(MigrationBuilder migrationBuilder)
18 | {
19 | migrationBuilder.DropColumn(
20 | name: "Hash",
21 | table: "Task");
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Infrastructure/Migrations/20200119191252_V2020_01_19_2242.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.EntityFrameworkCore.Migrations;
3 |
4 | namespace DNTFrameworkCore.TestAPI.Infrastructure.Migrations
5 | {
6 | public partial class V2020_01_19_2242 : Migration
7 | {
8 | protected override void Up(MigrationBuilder migrationBuilder)
9 | {
10 | migrationBuilder.AddColumn(
11 | name: "NullableDateTime",
12 | table: "Task",
13 | nullable: true);
14 | }
15 |
16 | protected override void Down(MigrationBuilder migrationBuilder)
17 | {
18 | migrationBuilder.DropColumn(
19 | name: "NullableDateTime",
20 | table: "Task");
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Infrastructure/Migrations/20201029111725_V2020_10_29_1446.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore.Migrations;
2 |
3 | namespace DNTFrameworkCore.TestAPI.Infrastructure.Migrations
4 | {
5 | public partial class V2020_10_29_1446 : Migration
6 | {
7 | protected override void Up(MigrationBuilder migrationBuilder)
8 | {
9 | migrationBuilder.RenameColumn("SecurityStamp", "User", "SecurityToken");
10 | }
11 |
12 | protected override void Down(MigrationBuilder migrationBuilder)
13 | {
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Models/ErrorViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestAPI.Models
2 | {
3 | public class ErrorViewModel
4 | {
5 | public string RequestId { get; set; }
6 |
7 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
8 | }
9 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Models/LoginModel.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestAPI.Models
2 | {
3 | public class LoginModel
4 | {
5 | public string UserName { get; set; }
6 | public string Password { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/Resources/LocalizationRegistry.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 |
3 | namespace DNTFrameworkCore.TestAPI.Resources
4 | {
5 | public static class LocalizationRegistry
6 | {
7 | public static void AddResources(this IServiceCollection services)
8 | {
9 | services.AddSingleton();
10 | services.AddSingleton();
11 | services.AddSingleton();
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/add_migrations.cmd:
--------------------------------------------------------------------------------
1 | For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set _date=%%c_%%a_%%b)
2 | For /f "tokens=1-2 delims=/:" %%a in ("%TIME: =0%") do (set _time=%%a%%b)
3 | dotnet build
4 | dotnet ef migrations add V%_date%_%_time% --output-dir Infrastructure/Migrations
5 | pause
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Debug",
5 | "System": "Information",
6 | "Microsoft": "Information"
7 | },
8 | "EFCore": {
9 | "LogLevel": {
10 | "Default": "Debug",
11 | "Microsoft": "None",
12 | "System": "None"
13 | }
14 | }
15 | },
16 | "Authentication": {
17 | "SigningKey": "8180A9FE-481C-ADE3-53E6DCCF5EF6",
18 | "EncryptingKey": "76143F7F-C170-41",
19 | "Issuer": "http://localhost/",
20 | "Audience": "Any",
21 | "TokenExpiration": "0.01:00:00.0000",
22 | "LoginFromSameUserEnabled": false,
23 | "LogoutEverywhereEnabled": false
24 | }
25 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/dotnet_run.bat:
--------------------------------------------------------------------------------
1 | dotnet watch run
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/remove_migrations.cmd:
--------------------------------------------------------------------------------
1 | dotnet ef migrations remove
2 | pause
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestAPI/update_db.cmd:
--------------------------------------------------------------------------------
1 | dotnet ef database update
2 | pause
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Application/Catalog/Policies/PriceTypePolicy.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.TestCqrsAPI.Domain.Catalog;
2 | using DNTFrameworkCore.TestCqrsAPI.Domain.Catalog.Policies;
3 |
4 | namespace DNTFrameworkCore.TestCqrsAPI.Application.Catalog.Policies
5 | {
6 | public class PriceTypePolicy : IPriceTypePolicy
7 | {
8 | public bool IsUnique(PriceType priceType)
9 | {
10 | throw new System.NotImplementedException();
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Application/DependencyInjection.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Cqrs;
2 | using DNTFrameworkCore.TestCqrsAPI.Application.Catalog.Policies;
3 | using DNTFrameworkCore.TestCqrsAPI.Domain.Catalog.Policies;
4 | using Microsoft.Extensions.DependencyInjection;
5 |
6 | namespace DNTFrameworkCore.TestCqrsAPI.Application
7 | {
8 | public static class DependencyInjection
9 | {
10 | public static IServiceCollection AddApplication(this IServiceCollection serviceCollection)
11 | {
12 | serviceCollection.AddCqrs(typeof(DependencyInjection));
13 | serviceCollection.AddScoped();
14 | return serviceCollection;
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Authorization/Permissions.cs:
--------------------------------------------------------------------------------
1 | // ReSharper disable InconsistentNaming
2 | namespace DNTFrameworkCore.TestCqrsAPI.Authorization
3 | {
4 | public class Permissions
5 | {
6 | public const string PriceTypes_View = nameof(PriceTypes_View);
7 | public const string PriceTypes_Create = nameof(PriceTypes_Create);
8 | public const string PriceTypes_Remove = nameof(PriceTypes_Remove);
9 | }
10 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Controllers/ProductsController.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestCqrsAPI.Controllers
2 | {
3 | public class ProductsController
4 | {
5 |
6 | }
7 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Catalog/Commands/CreatePriceTypeCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 | using DNTFrameworkCore.Cqrs.Commands;
3 | using DNTFrameworkCore.Functional;
4 |
5 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Catalog.Commands
6 | {
7 | public sealed class CreatePriceTypeCommand : ICommand
8 | {
9 | public string Title { get; }
10 | [JsonConstructor]
11 | public CreatePriceTypeCommand(string title) => Title = title;
12 | }
13 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Catalog/Commands/RemovePriceTypeCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 | using DNTFrameworkCore.Cqrs.Commands;
3 |
4 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Catalog.Commands
5 | {
6 | public sealed class RemovePriceTypeCommand : ICommand
7 | {
8 | public int PriceTypeId { get; }
9 | [JsonConstructor]
10 | public RemovePriceTypeCommand(int priceTypeId) => PriceTypeId = priceTypeId;
11 | }
12 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Catalog/Commands/RemoveProductCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 | using DNTFrameworkCore.Cqrs.Commands;
3 |
4 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Catalog.Commands
5 | {
6 | public class RemoveProductCommand : ICommand
7 | {
8 | public long ProductId { get; }
9 |
10 | [JsonConstructor]
11 | public RemoveProductCommand(long productId) => ProductId = productId;
12 | }
13 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Catalog/Commands/UpdateProductTitleCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 |
3 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Catalog.Commands
4 | {
5 | public class UpdateProductTitleCommand
6 | {
7 | public string Title { get; }
8 | [JsonConstructor]
9 | public UpdateProductTitleCommand(string title) => Title = title;
10 | }
11 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Catalog/Events/PriceTypeCreatedDomainEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Catalog.Events
5 | {
6 | public sealed class PriceTypeCreatedDomainEvent : DomainEvent
7 | {
8 | public PriceTypeCreatedDomainEvent(PriceType priceType)
9 | {
10 | PriceType = priceType ?? throw new ArgumentNullException(nameof(priceType));
11 | }
12 |
13 | public PriceType PriceType { get; }
14 | }
15 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Catalog/Events/ProductCreatedDomainEvent.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Catalog.Events
4 | {
5 | public sealed class ProductCreatedDomainEvent : DomainEvent
6 | {
7 | public ProductCreatedDomainEvent(Product product)
8 | {
9 | Product = product;
10 | }
11 |
12 | public Product Product { get; }
13 | }
14 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Catalog/Policies/IPriceTypePolicy.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Catalog.Policies
4 | {
5 | public interface IPriceTypePolicy
6 | {
7 | bool IsUnique(PriceType priceType);
8 | }
9 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Catalog/Policies/IProductPolicy.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Catalog.Policies
4 | {
5 | public interface IProductPolicy
6 | {
7 | bool IsUnique(Product product);
8 | }
9 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Catalog/Repositories/IPriceTypeRepository.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Catalog.Repositories
4 | {
5 | public interface IPriceTypeRepository : IRepository
6 | {
7 | }
8 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Catalog/Repositories/IProductRepository.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Catalog.Repositories
4 | {
5 | public interface IProductRepository : IRepository
6 | {
7 | }
8 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Identity/Claim.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Identity
5 | {
6 | public abstract class Claim : TrackableEntity, IHasRowIntegrity, ICreationTracking, IModificationTracking
7 | {
8 | public const int MaxTypeLength = 256;
9 |
10 | public string Type { get; set; }
11 | public string Value { get; set; }
12 |
13 |
14 | }
15 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Identity/Permission.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Identity
5 | {
6 | public abstract class Permission : TrackableEntity, IHasRowIntegrity, ICreationTracking,
7 | IModificationTracking
8 | {
9 | public const int MaxNameLength = 128;
10 | public string Name { get; set; }
11 | public bool IsGranted { get; set; } = true;
12 |
13 |
14 | }
15 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Identity/RoleClaim.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Identity
2 | {
3 | public class RoleClaim : Claim
4 | {
5 | public Role Role { get; set; }
6 | public long RoleId { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Identity/RolePermission.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Identity
2 | {
3 | public class RolePermission : Permission
4 | {
5 | public long RoleId { get; set; }
6 | public Role Role { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Identity/UserClaim.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Identity
2 | {
3 | public class UserClaim : Claim
4 | {
5 | public User User { get; set; }
6 | public long UserId { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Identity/UserPermission.cs:
--------------------------------------------------------------------------------
1 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Identity
2 | {
3 | public class UserPermission : Permission
4 | {
5 | public long UserId { get; set; }
6 | public User User { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Identity/UserRole.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Identity
5 | {
6 | public class UserRole : TrackableEntity, IHasRowIntegrity, ICreationTracking, IModificationTracking
7 | {
8 | public long UserId { get; set; }
9 | public User User { get; set; }
10 | public Role Role { get; set; }
11 | public long RoleId { get; set; }
12 |
13 |
14 | }
15 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Identity/UserToken.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Identity
5 | {
6 | public class UserToken : Entity, IHasRowIntegrity, ICreationTracking, IModificationTracking
7 | {
8 | public const int MaxTokenHashLength = 256;
9 | public string TokenHash { get; set; }
10 | public DateTime TokenExpirationDateTime { get; set; }
11 | public long UserId { get; set; }
12 | public User User { get; set; }
13 |
14 |
15 | }
16 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Orders/OrderHistory.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Orders
4 | {
5 | public class OrderHistory : Entity
6 | {
7 | }
8 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Parties/Customer.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Parties
4 | {
5 | public class Customer : Entity, IAggregateRoot, IHasRowVersion, INumberedEntity
6 | {
7 | public string FirstName { get; set; }
8 | public string LastName { get; set; }
9 | public byte[] Version { get; set; }
10 | public string Number { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Sales/Action.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Sales
5 | {
6 | public class Action : Entity
7 | {
8 | public Action(string name, ActionType type, string displayName)
9 | {
10 | if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
11 | if (string.IsNullOrEmpty(displayName)) throw new ArgumentNullException(nameof(displayName));
12 |
13 | Type = type ?? throw new ArgumentNullException(nameof(type));
14 | Name = name;
15 | DisplayName = displayName;
16 | }
17 |
18 | public ActionType Type { get; private set; }
19 | public string Name { get; private set; }
20 | public string DisplayName { get; private set; }
21 | }
22 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Sales/ActionType.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Sales
4 | {
5 | public class ActionType : Enumeration
6 | {
7 | public static readonly ActionType Save = new ActionType(1, nameof(Save));
8 | public static readonly ActionType Print = new ActionType(3, nameof(Print));
9 | public static readonly ActionType Ship = new ActionType(4, nameof(Ship));
10 | public static readonly ActionType Pay = new ActionType(5, nameof(Pay));
11 | public static readonly ActionType Cancel = new ActionType(6, nameof(Cancel));
12 |
13 | private ActionType(int value, string name) : base(value, name)
14 | {
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Sales/ActivityType.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Sales
4 | {
5 | public class ActivityType : Enumeration
6 | {
7 | public static readonly ActivityType PreparationPrint = new ActivityType(1, nameof(PreparationPrint));
8 | public static readonly ActivityType PrintInvoice = new ActivityType(2, nameof(PrintInvoice));
9 | public static readonly ActivityType SendEmail = new ActivityType(3, nameof(SendEmail));
10 | public static readonly ActivityType SendNote = new ActivityType(4, nameof(SendNote));
11 |
12 | private ActivityType() //Required for ORM
13 | {
14 | }
15 |
16 | private ActivityType(int value, string name) : base(value, name)
17 | {
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Sales/Commands/NewSaleMethod.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Cqrs.Commands;
2 |
3 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Sales.Commands
4 | {
5 | public class NewSaleMethod : ICommand
6 | {
7 | public string Title { get; set; }
8 | public int NatureId { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Sales/Events/SaleMethodAddedDomainEvent.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Sales.Events
4 | {
5 | public class SaleMethodAddedDomainEvent : DomainEvent
6 | {
7 | public long SaleMethodId { get; }
8 |
9 | public SaleMethodAddedDomainEvent(long saleMethodId)
10 | {
11 | SaleMethodId = saleMethodId;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Sales/Repositories/ISaleMethodRepository.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 |
3 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Sales.Repositories
4 | {
5 | public interface ISaleMethodRepository : IRepository
6 | {
7 |
8 | }
9 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Sales/Rules/ISaleMethodRules.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using DNTFrameworkCore.Domain;
3 | using DNTFrameworkCore.TestCqrsAPI.Domain.SharedKernel;
4 |
5 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Sales.Rules
6 | {
7 | public interface ISaleMethodRules
8 | {
9 | Task IsTitleUnique(Title title, int id);
10 | }
11 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Sales/SaleMethodPriceType.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 | using DNTFrameworkCore.TestCqrsAPI.Domain.Catalog;
3 |
4 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Sales
5 | {
6 | public class SaleMethodPriceType : Entity
7 | {
8 | public int PriceTypeId { get; set; }
9 | public PriceType PriceType { get; set; }
10 | public int SaleMethodId { get; set; }
11 | public SaleMethod SaleMethod { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Sales/SaleMethodProduct.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 | using DNTFrameworkCore.TestCqrsAPI.Domain.Catalog;
3 |
4 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Sales
5 | {
6 | public class SaleMethodProduct : Entity
7 | {
8 | public Product Product { get; private set; }
9 | public int ProductId { get; private set; }
10 | private SaleMethodProduct()
11 | {
12 | }
13 | public SaleMethodProduct(int productId)
14 | {
15 | ProductId = productId;
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Sales/SaleMethodUser.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.Domain;
2 | using DNTFrameworkCore.TestCqrsAPI.Domain.Identity;
3 |
4 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Sales
5 | {
6 | public class SaleMethodUser : Entity
7 | {
8 | public User User { get; private set; }
9 | public long UserId { get; private set; }
10 |
11 | private SaleMethodUser() //Required for ORM
12 | {
13 | }
14 |
15 | public SaleMethodUser(long userId)
16 | {
17 | UserId = userId;
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Sales/State.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DNTFrameworkCore.Domain;
3 |
4 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Sales
5 | {
6 | public class State : Entity
7 | {
8 | private State()
9 | {
10 | }
11 |
12 | public State(string name, StateType type, string displayName)
13 | {
14 | if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
15 | if (string.IsNullOrEmpty(displayName)) throw new ArgumentNullException(nameof(displayName));
16 |
17 | Type = type ?? throw new ArgumentNullException(nameof(type));
18 | Name = name;
19 | DisplayName = displayName;
20 | }
21 |
22 | public StateType Type { get; private set; }
23 | public string Name { get; private set; }
24 | public string DisplayName { get; private set; }
25 | }
26 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Domain/Sales/Transition.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using DNTFrameworkCore.Domain;
4 |
5 | namespace DNTFrameworkCore.TestCqrsAPI.Domain.Sales
6 | {
7 | public class Transition : Entity
8 | {
9 | public Transition(Action trigger, State @from, State to,
10 | IEnumerable activities)
11 | {
12 | Trigger = trigger;
13 | From = @from;
14 | To = to;
15 | Activities = activities.ToList();
16 | }
17 |
18 | public Action Trigger { get; private set; }
19 | public State From { get; private set; }
20 | public State To { get; private set; }
21 | public IReadOnlyList Activities { get; private set; }
22 | }
23 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Infrastructure/Mappings/Identity/RoleClaimConfiguration.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.TestCqrsAPI.Domain.Identity;
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Metadata.Builders;
4 |
5 | namespace DNTFrameworkCore.TestCqrsAPI.Infrastructure.Mappings.Identity
6 | {
7 | public class RoleClaimConfiguration : IEntityTypeConfiguration
8 | {
9 | public void Configure(EntityTypeBuilder builder)
10 | {
11 | builder.Property(a => a.Type).IsRequired().HasMaxLength(Claim.MaxTypeLength);
12 | builder.Property(a => a.Value).IsRequired();
13 |
14 | builder.ToTable(nameof(RoleClaim));
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Infrastructure/Mappings/Identity/UserTokenConfiguration.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.TestCqrsAPI.Domain.Identity;
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Metadata.Builders;
4 |
5 | namespace DNTFrameworkCore.TestCqrsAPI.Infrastructure.Mappings.Identity
6 | {
7 | public class UserTokenConfiguration : IEntityTypeConfiguration
8 | {
9 | public void Configure(EntityTypeBuilder builder)
10 | {
11 | builder.Property(a => a.TokenHash).HasMaxLength(UserToken.MaxTokenHashLength).IsRequired();
12 |
13 | builder.HasIndex(a => a.TokenHash).HasDatabaseName("IX_UserToken_TokenHash");
14 |
15 | builder.ToTable(nameof(UserToken));
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Infrastructure/Repositories/Catalog/PriceTypeRepository.cs:
--------------------------------------------------------------------------------
1 | using DNTFrameworkCore.EFCore.Context;
2 | using DNTFrameworkCore.EFCore.Persistence;
3 | using DNTFrameworkCore.TestCqrsAPI.Domain.Catalog;
4 | using DNTFrameworkCore.TestCqrsAPI.Domain.Catalog.Repositories;
5 |
6 | namespace DNTFrameworkCore.TestCqrsAPI.Infrastructure.Repositories.Catalog
7 | {
8 | public class PriceTypeRepository : RepositoryBase, IPriceTypeRepository
9 | {
10 | public PriceTypeRepository(IDbContext dbContext) : base(dbContext)
11 | {
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/test/DNTFrameworkCore.TestCqrsAPI/Infrastructure/Repositories/Catalog/ProductRepository.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using DNTFrameworkCore.EFCore.Context;
3 | using DNTFrameworkCore.EFCore.Persistence;
4 | using DNTFrameworkCore.TestCqrsAPI.Domain.Catalog;
5 | using DNTFrameworkCore.TestCqrsAPI.Domain.Catalog.Repositories;
6 | using Microsoft.EntityFrameworkCore;
7 |
8 | namespace DNTFrameworkCore.TestCqrsAPI.Infrastructure.Repositories.Catalog
9 | {
10 | public class ProductRepository : RepositoryBase