예제 #1
0
 public ModelApplier(
     ChangingBt.ChangesetApplier btChangesetApplier,
     ChangingBt.ModelToChangesetTransformer btModelTransformer,
     ChangingPsto.ChangesetApplier pstoChangesetApplier,
     ChangingPsto.ModelToChangesetTransformer pstoModelTransformer,
     ChangingTtbbv.ChangesetApplier ttbbvChangesetApplier,
     ChangingTtbbv.ModelToChangesetTransformer ttbbvModelTransformer,
     ChangingTtbpt.ChangesetApplier ttbptChangesetApplier,
     ChangingTtbpt.ModelToChangesetTransformer ttbptModelTransformer,
     ModelValidator modelValidator,
     IDataManagerFactory dataManagerFactory,
     ManagingCalculations.CalculationRequester calculationRequester
     )
 {
     this.btChangesetApplier    = btChangesetApplier;
     this.btModelTransformer    = btModelTransformer;
     this.pstoChangesetApplier  = pstoChangesetApplier;
     this.pstoModelTransformer  = pstoModelTransformer;
     this.ttbbvChangesetApplier = ttbbvChangesetApplier;
     this.ttbbvModelTransformer = ttbbvModelTransformer;
     this.ttbptChangesetApplier = ttbptChangesetApplier;
     this.ttbptModelTransformer = ttbptModelTransformer;
     this.modelValidator        = modelValidator;
     this.dataManagerFactory    = dataManagerFactory;
     this.calculationRequester  = calculationRequester;
 }
예제 #2
0
 public static void WithDataManager(this IDataManagerFactory factory, Action <IDataManager> func, IsolationLevel?level = null)
 {
     factory.WithDataManager(manager =>
     {
         func(manager);
         return(true);
     }, level);
 }
예제 #3
0
 public static void WithTransaction(this IDataManagerFactory factory, Action <ITransactionDataManager> func, IsolationLevel level = IsolationLevel.ReadCommitted)
 {
     factory.WithTransaction(manager =>
     {
         func(manager);
         return(true);
     }, level);
 }
예제 #4
0
 public ChangesetApplier(
     IDataManagerFactory manageFactory,
     ModelToTaxonomyTransformer modelTransformer
     )
 {
     this.managerFactory   = manageFactory;
     this.modelTransformer = modelTransformer;
 }
예제 #5
0
        public static T WithTransaction <T>(this IDataManagerFactory factory, Func <ITransactionDataManager, T> func, IsolationLevel level = IsolationLevel.ReadCommitted)
        {
            using (var manager = factory.GetTransactionManager(level))
            {
                var result = func(manager);

                manager.Commit();
                return(result);
            }
        }
예제 #6
0
 public Deserializer(
     ISqlConnectionFactory connectionFactory,
     IDataManagerFactory <TDataManager> dataManagerFactory,
     RepositoryManager repositoryManager
     )
 {
     this.connectionFactory  = connectionFactory;
     this.dataManagerFactory = dataManagerFactory;
     this.repositoryManager  = repositoryManager;
 }
예제 #7
0
        public void RecalculateRootModel(
            RootModel root,
            ISqlConnectionFactory connectionFactory,
            IDataManagerFactory dataManagerFactory,
            CalculationTicket ticket
            )
        {
            // everything is recalculated automatically but overlays in case they were changed
#warning it's a big question whether overlays need to be recalculated every time
#warning we need to see if somebody has changed PST composition since we opened for editing but haven't yet saved

            SecurityRepository  securityRepository;
            PortfolioRepository portfolioRepository;
            ManagingPst.PortfolioSecurityTargetRepository portfolioSecurityTargetRepository;
            using (var ondemandManager = new OnDemandDataManager(connectionFactory, dataManagerFactory))
            {
                securityRepository  = this.repositoryManager.ClaimSecurityRepository(ondemandManager);
                portfolioRepository = this.repositoryManager.ClaimPortfolioRepository(ondemandManager);
                portfolioSecurityTargetRepository = this.repositoryManager.ClaimPortfolioSecurityTargetRepository(
                    root.LatestPstChangeset,
                    ondemandManager.Claim()
                    );


                // in order to proceed we need to make sure all missing countries are there
                IEnumerable <BenchmarkSumByIsoInfo> benchmarks = new BenchmarkSumByIsoInfo[] { };
                var computations            = this.modelBuilder.CreateComputations(root.Globe, this.Traverser);
                var countryRepository       = this.repositoryManager.ClaimCountryRepository(ondemandManager);
                var targetingTypeRepository = this.repositoryManager.ClaimTargetingTypeRepository(ondemandManager);
                var targetingType           = targetingTypeRepository.GetTargetingType(root.TargetingType.Id);
                this.RegisterMissingCountriesIfAny(
                    root,
                    computations,
                    countryRepository,
                    targetingType,
                    securityRepository,
                    portfolioRepository,
                    portfolioSecurityTargetRepository,
                    benchmarks
                    );
            }


            this.InitializeOverlay(
                root,
                securityRepository,
                portfolioRepository,
                portfolioSecurityTargetRepository
                );

            // required to inject problems to base values
            // we are not interested in the result of validation
            this.modelApplier.ValidateModel(root, ticket);
        }
예제 #8
0
 public Deserializer(
     ISqlConnectionFactory connectionFactory,
     IDataManagerFactory dataManagerFactory,
     TopDown.Core.RepositoryManager repositoryManager
     )
     : base(connectionFactory, dataManagerFactory, repositoryManager)
 {
     this.connectionFactory  = connectionFactory;
     this.dataManagerFactory = dataManagerFactory;
     this.repositoryManager  = repositoryManager;
 }
예제 #9
0
 public ModelManager(
     ISqlConnectionFactory connectionFactory,
     IDataManagerFactory dataManagerFactory,
     RepositoryManager repositoryManager,
     ModelBuilder modelBuilder
     )
 {
     this.connectionFactory  = connectionFactory;
     this.dataManagerFactory = dataManagerFactory;
     this.repositoryManager  = repositoryManager;
     this.modelBuilder       = modelBuilder;
 }
예제 #10
0
        public static T WithDataManager <T>(this IDataManagerFactory factory, Func <IDataManager, T> func, IsolationLevel?level = null)
        {
            using (var manager = level == null ? factory.GetManager() : factory.GetTransactionManager(level.Value))
            {
                var result = func(manager);

                var transaction = manager as IUnitOfWork;
                if (transaction != null)
                {
                    transaction.Commit();
                }

                return(result);
            }
        }
예제 #11
0
 public Facade(
     Core.ModelManager modelManager,
     Aims.Data.Server.Serializer commonSerializer,
     Serializer serializer,
     Deserializer deserializer,
     ISqlConnectionFactory connectionFactory,
     IDataManagerFactory dataManagerFactory,
     RepositoryManager repositoryManager
     )
 {
     this.modelManager       = modelManager;
     this.serializer         = serializer;
     this.connectionFactory  = connectionFactory;
     this.dataManagerFactory = dataManagerFactory;
     this.RepositoryManager  = repositoryManager;
     this.commonSerializer   = commonSerializer;
     this.deserializer       = deserializer;
 }
예제 #12
0
 public ModelApplier(
     IDataManagerFactory dataManagerFactory,
     ChangingTtgbsbv.ChangesetApplier ttgbsbvChangesetApplier,
     ChangingTtgbsbv.ModelToChangesetTransformer ttgbsbvModelTransformer,
     ChangingBpst.PortfolioTargetChangesetApplier bpstChangesetApplier,
     ChangingBpst.ModelToChangesetTransformter bpstModelTransformter,
     ManagingCalculations.CalculationRequester calculationRequester,
     ModelValidator modelValidator,
     RepositoryManager repositoryManager
     )
 {
     this.dataManagerFactory      = dataManagerFactory;
     this.bpstChangesetApplier    = bpstChangesetApplier;
     this.ttgbsbvChangesetApplier = ttgbsbvChangesetApplier;
     this.ttgbsbvModelTransformer = ttgbsbvModelTransformer;
     this.bpstModelTransformter   = bpstModelTransformter;
     this.calculationRequester    = calculationRequester;
     this.modelValidator          = modelValidator;
     this.repositoryManager       = repositoryManager;
 }
예제 #13
0
 public Facade(
     ISqlConnectionFactory connectionFactory,
     ISqlConnectionFactory usersConnectionFactory,
     IDataManagerFactory dataManagerFactory,
     IUsersDataManagerFactory dataUsersManagerFactory,
     RepositoryManager repositoryManager,
     ManagingBpt.ModelManager bptManager,
     ExpressionPicker expressionPicker,
     CommonParts commonParts,
     PstManager pstManager,
     BasketManager basketManager,
     ProtfolioPickerManager protfolioPickerManager,
     Gadgets.BasketPicker.ModelManager basketPickerManager,
     ManagingBpst.ModelManager bpstModelManager,
     ManagingPortfolios.PortfolioManager portfolioManager,
     ManagingCalculations.Hopper hopper,
     ManagingComments.CommentManager commentsManager
     )
 {
     this.usersConnectionFactory  = usersConnectionFactory;
     this.connectionFactory       = connectionFactory;
     this.dataManagerFactory      = dataManagerFactory;
     this.dataUsersManagerFactory = dataUsersManagerFactory;
     this.RepositoryManager       = repositoryManager;
     this.BptManager              = bptManager;
     this.ExpressionPicker        = expressionPicker;
     this.CommonParts             = commonParts;
     this.PstManager              = pstManager;
     this.BasketManager           = basketManager;
     this.PortfiolioPickerManager = protfolioPickerManager;
     this.BasketPickerManager     = basketPickerManager;
     this.BpstManager             = bpstModelManager;
     this.PortfolioManager        = portfolioManager;
     this.hopper         = hopper;
     this.commentManager = commentsManager;
 }
예제 #14
0
 public PstManager(
     ChangesetApplier applier,
     ModelValidator modelValidator,
     ModelToChangesetTransformer transformer,
     ModelFromJsonDeserializer modelDeserializer,
     ModelBuilder modelBuilder,
     RepositoryManager repositoryManager,
     ModelChangeDetector modelChangeDetector,
     IDataManagerFactory dataManagerFactory,
     ManagingCalculations.CalculationRequester calculationRequester,
     ModelToJsonSerializer modelSerializer
     )
 {
     this.applier              = applier;
     this.modelValidator       = modelValidator;
     this.transformer          = transformer;
     this.modelDeserializer    = modelDeserializer;
     this.modelBuilder         = modelBuilder;
     this.repositoryManager    = repositoryManager;
     this.modelChangeDetector  = modelChangeDetector;
     this.dataManagerFactory   = dataManagerFactory;
     this.calculationRequester = calculationRequester;
     this.modelSerializer      = modelSerializer;
 }
예제 #15
0
 /// <param name="factory">Factory used to instantinate data access tolls</param>
 public DataManager(IDataManagerFactory factory)
 {
     _factory = factory;
 }
 public ProjectXSQLConnectionManager(IDataManagerFactory factory)
 {
     _factory = factory;
 }
예제 #17
0
 public OnDemandDataManager(SqlConnection connection, IDataManagerFactory dataManagerFactory)
     : base(connection, dataManagerFactory)
 {
 }
예제 #18
0
 public OnDemandDataManager(ISqlConnectionFactory connectionFactory, IDataManagerFactory dataManagerFactory)
     : base(connectionFactory, dataManagerFactory)
 {
 }
예제 #19
0
 public ChatDb(IDataManagerFactory dataManagerFactory)
 {
     _dataManagerFactory = dataManagerFactory;
 }
예제 #20
0
 public OnDemandDataManager(ISqlConnectionFactory connectionFactory, IDataManagerFactory <TDataManager> dataManagerFactory)
 {
     this.connectionFactory  = connectionFactory;
     this.dataManagerFactory = dataManagerFactory;
 }
예제 #21
0
 public static void WithRepository <TRepo>(this IDataManagerFactory factory, Action <TRepo> func, IsolationLevel?level = null) where TRepo : class
 {
     factory.WithDataManager(manager => manager.WithRepository(func), level);
 }
예제 #22
0
 public static T WithRepository <TRepo, T>(this IDataManagerFactory factory, Func <TRepo, T> func, IsolationLevel?level = null) where TRepo : class
 {
     return(factory.WithDataManager(manager => manager.WithRepository(func), level));
 }
예제 #23
0
 public UserFacade(IDataManagerFactory factory, HashAlgorithm algorithm)
 {
     this.factory   = factory;
     this.algorithm = algorithm;
 }
 public DataManagerFactoryLazyDecorator(IDataManagerFactory factory)
 {
     _factory = factory;
 }
예제 #25
0
 public OfferFacade(IDataManagerFactory factory)
 {
     this.factory = factory;
 }
예제 #26
0
 public LazyDataGetter(IDataGetter <TEntity> getter, IDataManagerFactory lazyFactory)
 {
     _getter         = getter;
     _lazyFactory    = lazyFactory;
     _mainEntityInfo = _lazyFactory.InfoAbout <TEntity>();
 }
예제 #27
0
 public OfferFacade(IDataManagerFactory factory)
 {
     this.factory = factory;
 }
예제 #28
0
 public UserFacade(IDataManagerFactory factory, HashAlgorithm algorithm)
 {
     this.factory = factory;
     this.algorithm = algorithm;
 }
예제 #29
0
 static DALConfigurationManager()
 {
     connectionManager = new ProjectXSQLConnectionManager(new ProjectXSQLDataManagerFactory(new DefaultConnectionManager(sharedConnectionString)));
     sqlFactory        = new ProjectXSQLDataManagerFactory(connectionManager);
     sqlcacheFactory   = new ProjectXSQLDataManagerFactory(connectionManager);
 }
예제 #30
0
 public OnDemandDataManager(SqlConnection connection, IDataManagerFactory <TDataManager> dataManagerFactory)
 {
     this.connection         = connection;
     this.dataManagerFactory = dataManagerFactory;
 }