public static async Task SaveAsync <TDomain, TDomainCriteria>(this IPersistenceFactory persistanceFactory, TDomain entity)
     where TDomain : class
     where TDomainCriteria : DomainCriteria
 {
     Invariant.IsNotNull(persistanceFactory, () => $"IPersistenceFactory null in '{typeof(IPersistenceFactoryExtensions).PrettyPrint()}'");
     await persistanceFactory.GetPersistence <TDomain>().Save(entity, CancellationToken.None);
 }
        /// <summary>
        /// Creates a new instance of <see cref="MacroStabilityInwardsCalculationExporter"/>.
        /// </summary>
        /// <param name="calculation">The calculation to export.</param>
        /// <param name="generalInput">General calculation parameters that are the same across all calculations.</param>
        /// <param name="persistenceFactory">The persistence factory to use.</param>
        /// <param name="filePath">The file path to export to.</param>
        /// <param name="getNormativeAssessmentLevelFunc"><see cref="Func{TResult}"/>
        /// for obtaining the normative assessment level.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="calculation"/>,
        /// <paramref name="generalInput"/>, <paramref name="persistenceFactory"/> or
        /// <paramref name="getNormativeAssessmentLevelFunc"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when <paramref name="filePath"/> is invalid.</exception>
        /// <remarks>A valid path:
        /// <list type="bullet">
        /// <item>is not empty or <c>null</c>,</item>
        /// <item>does not consist out of only whitespace characters,</item>
        /// <item>does not contain an invalid character,</item>
        /// <item>does not end with a directory or path separator (empty file name).</item>
        /// </list></remarks>
        public MacroStabilityInwardsCalculationExporter(MacroStabilityInwardsCalculation calculation,
                                                        GeneralMacroStabilityInwardsInput generalInput,
                                                        IPersistenceFactory persistenceFactory,
                                                        string filePath, Func <RoundedDouble> getNormativeAssessmentLevelFunc)
        {
            if (calculation == null)
            {
                throw new ArgumentNullException(nameof(calculation));
            }

            if (generalInput == null)
            {
                throw new ArgumentNullException(nameof(generalInput));
            }

            if (persistenceFactory == null)
            {
                throw new ArgumentNullException(nameof(persistenceFactory));
            }

            if (getNormativeAssessmentLevelFunc == null)
            {
                throw new ArgumentNullException(nameof(getNormativeAssessmentLevelFunc));
            }

            IOUtils.ValidateFilePath(filePath);

            this.calculation        = calculation;
            this.generalInput       = generalInput;
            this.persistenceFactory = persistenceFactory;
            this.filePath           = filePath;
            this.getNormativeAssessmentLevelFunc = getNormativeAssessmentLevelFunc;
        }
예제 #3
0
 public RuleDomainObject(IPersistenceFactory <State> factory, ISemanticLog log,
                         IAppProvider appProvider, IRuleEnqueuer ruleEnqueuer)
     : base(factory, log)
 {
     this.appProvider  = appProvider;
     this.ruleEnqueuer = ruleEnqueuer;
 }
        protected NonTransactionalAuctionService GetNonTransactionalAuctionService()
        {
            IPersistenceFactory            persistenceFactory = GetPersistenceFactory();
            NonTransactionalAuctionService service            = new NonTransactionalAuctionService();

            service.SetPersistenceFactory(persistenceFactory);
            return(service);
        }
예제 #5
0
        public AssetDomainObject(IPersistenceFactory <State> factory, ISemanticLog log,
                                 IServiceProvider serviceProvider)
            : base(factory, log)
        {
            this.serviceProvider = serviceProvider;

            Capacity = 2;
        }
예제 #6
0
        public ContentDomainObject(IPersistenceFactory <State> persistence, ISemanticLog log,
                                   IServiceProvider serviceProvider)
            : base(persistence, log)
        {
            this.serviceProvider = serviceProvider;

            Capacity = int.MaxValue;
        }
예제 #7
0
        public AssetFolderDomainObject(IPersistenceFactory <State> factory, ISemanticLog log,
                                       IAssetQueryService assetQuery)
            : base(factory, log)
        {
            Guard.NotNull(assetQuery, nameof(assetQuery));

            this.assetQuery = assetQuery;
        }
예제 #8
0
        public ContentDomainObject(IPersistenceFactory <State> persistence, ILogger <ContentDomainObject> log,
                                   IServiceProvider serviceProvider)
            : base(persistence, log)
        {
            this.serviceProvider = serviceProvider;

            Capacity = 5;
        }
예제 #9
0
        public RuleDomainObject(IPersistenceFactory <State> factory, ISemanticLog log,
                                IAppProvider appProvider, IRuleEnqueuer ruleEnqueuer)
            : base(factory, log)
        {
            Guard.NotNull(appProvider, nameof(appProvider));
            Guard.NotNull(ruleEnqueuer, nameof(ruleEnqueuer));

            this.appProvider  = appProvider;
            this.ruleEnqueuer = ruleEnqueuer;
        }
예제 #10
0
 public AggregateStore(IServiceProvider serviceProvider)
 {
     _serviceProvider           = serviceProvider;
     _logger                    = serviceProvider.GetRequiredService <ILogger <AggregateStore> >();
     _eventJsonSerializer       = serviceProvider.GetRequiredService <IEventJsonSerializer>();
     _persistenceFactory        = serviceProvider.GetRequiredService <IPersistenceFactory>();
     _aggregateFactory          = serviceProvider.GetRequiredService <IAggregateFactory>();
     _transientFaultHandler     = serviceProvider.GetRequiredService <ITransientFaultHandler <IOptimisticConcurrencyResilientStrategy> >();
     _cancellationConfiguration = serviceProvider.GetRequiredService <ICancellationConfiguration>();
 }
예제 #11
0
 public AppDomainObject(IPersistenceFactory <State> persistence, ISemanticLog log,
                        InitialSettings initialPatterns,
                        IAppPlansProvider appPlansProvider,
                        IAppPlanBillingManager appPlansBillingManager,
                        IUserResolver userResolver)
     : base(persistence, log)
 {
     this.userResolver           = userResolver;
     this.appPlansProvider       = appPlansProvider;
     this.appPlansBillingManager = appPlansBillingManager;
     this.initialSettings        = initialPatterns;
 }
예제 #12
0
        public AssetDomainObject(IPersistenceFactory <AssetDomainObject.State> factory, ISemanticLog log,
                                 IAssetTagService assetTags,
                                 IAssetQueryService assetQuery,
                                 IContentRepository contentRepository)
            : base(factory, log)
        {
            Guard.NotNull(assetTags, nameof(assetTags));
            Guard.NotNull(assetQuery, nameof(assetQuery));
            Guard.NotNull(contentRepository, nameof(contentRepository));

            this.assetTags         = assetTags;
            this.assetQuery        = assetQuery;
            this.contentRepository = contentRepository;

            Capacity = int.MaxValue;
        }
예제 #13
0
        public AppDomainObject(IPersistenceFactory <State> persistence, ISemanticLog log,
                               InitialPatterns initialPatterns,
                               IAppPlansProvider appPlansProvider,
                               IAppPlanBillingManager appPlansBillingManager,
                               IUserResolver userResolver)
            : base(persistence, log)
        {
            Guard.NotNull(initialPatterns, nameof(initialPatterns));
            Guard.NotNull(userResolver, nameof(userResolver));
            Guard.NotNull(appPlansProvider, nameof(appPlansProvider));
            Guard.NotNull(appPlansBillingManager, nameof(appPlansBillingManager));

            this.userResolver           = userResolver;
            this.appPlansProvider       = appPlansProvider;
            this.appPlansBillingManager = appPlansBillingManager;
            this.initialPatterns        = initialPatterns;
        }
        /// <summary>
        /// Creates a new instance of <see cref="MacroStabilityInwardsCalculationGroupExporter"/>.
        /// </summary>
        /// <param name="calculationGroup">The calculation group to export.</param>
        /// <param name="generalInput">General calculation parameters that are the same across all calculations.</param>
        /// <param name="persistenceFactory">The persistence factory to use.</param>
        /// <param name="filePath">The file path to export to.</param>
        /// <param name="fileExtension">The extension of the files.</param>
        /// <param name="getNormativeAssessmentLevelFunc"><see cref="Func{T1,TResult}"/>
        /// for obtaining the normative assessment level.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="calculationGroup"/>, <paramref name="generalInput"/>,
        /// <paramref name="persistenceFactory"/>, or <paramref name="getNormativeAssessmentLevelFunc"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when <paramref name="filePath"/> is invalid.</exception>
        /// <remarks>A valid path:<list type="bullet">
        /// <item>is not empty or <c>null</c>,</item>
        /// <item>does not consist out of only whitespace characters,</item>
        /// <item>does not contain an invalid character,</item>
        /// <item>is not too long.</item>
        /// </list></remarks>
        public MacroStabilityInwardsCalculationGroupExporter(CalculationGroup calculationGroup, GeneralMacroStabilityInwardsInput generalInput,
                                                             IPersistenceFactory persistenceFactory, string filePath,
                                                             string fileExtension, Func <MacroStabilityInwardsCalculation, RoundedDouble> getNormativeAssessmentLevelFunc)
        {
            if (calculationGroup == null)
            {
                throw new ArgumentNullException(nameof(calculationGroup));
            }

            if (generalInput == null)
            {
                throw new ArgumentNullException(nameof(generalInput));
            }

            if (persistenceFactory == null)
            {
                throw new ArgumentNullException(nameof(persistenceFactory));
            }

            if (getNormativeAssessmentLevelFunc == null)
            {
                throw new ArgumentNullException(nameof(getNormativeAssessmentLevelFunc));
            }

            IOUtils.ValidateFilePath(filePath);

            this.calculationGroup   = calculationGroup;
            this.generalInput       = generalInput;
            this.persistenceFactory = persistenceFactory;
            this.filePath           = filePath;
            string folderPath = Path.GetDirectoryName(filePath);

            tempFolderPath     = Path.Combine(folderPath, "~temp");
            this.fileExtension = fileExtension;
            this.getNormativeAssessmentLevelFunc = getNormativeAssessmentLevelFunc;
        }
예제 #15
0
 public static T Create(IServiceProvider serviceProvider, IPersistenceFactory <TState> persistenceFactory)
 {
     return((T)ObjectFactory(serviceProvider, new object[] { persistenceFactory }));
 }
 public void SetPersistenceFactory(IPersistenceFactory persistenceFactory)
 {
     this.persistenceFactory = persistenceFactory;
     persistentAuctions = persistenceFactory.CreatePersistence() ;
 }
 public CriteriaDomainQueryHandler(IPersistenceFactory persistenceFactory)
 {
     _persistenceFactory = persistenceFactory;
 }
예제 #18
0
 public AssetFolderDomainObject(IPersistenceFactory <State> factory, ISemanticLog log,
                                IAssetQueryService assetQuery)
     : base(factory, log)
 {
     this.assetQuery = assetQuery;
 }
예제 #19
0
 public SchemaDomainObject(IPersistenceFactory <State> persistence, ISemanticLog log)
     : base(persistence, log)
 {
 }
예제 #20
0
 public void SetPersistenceFactory(IPersistenceFactory persistenceFactory)
 {
     this.persistenceFactory = persistenceFactory;
     persistentAuctions      = persistenceFactory.CreatePersistence();
 }
예제 #21
0
 public EFCoreCriteriaDomainQueryHandler(IPersistenceFactory persistenceFactory)
     : base(persistenceFactory)
 {
 }
예제 #22
0
 public PersistenceService(IPersistenceFactory factory)
 {
     Factory = factory;
 }
예제 #23
0
 public StoredProcedureQueryHandler(IPersistenceFactory persistenceFactory)
 {
     _persistenceFactory = persistenceFactory;
 }
예제 #24
0
 public SchemaDomainObject(IPersistenceFactory <State> persistence, ILogger <SchemaDomainObject> log)
     : base(persistence, log)
 {
 }
예제 #25
0
 public AssetFolderDomainObject(IPersistenceFactory <State> factory, ILogger <AssetFolderDomainObject> log,
                                IServiceProvider serviceProvider)
     : base(factory, log)
 {
     this.serviceProvider = serviceProvider;
 }