public DataServiceDesignedStartup(IDataServiceHostSettings dshs, IAuthorisation authorisation, IDataServiceDesignerDataService dsdDataService, ISchemaBrowserConnectionManager connectionManager)
 {
     _dshs              = dshs;
     _authorisation     = authorisation;
     _dsdDataService    = dsdDataService;
     _connectionManager = connectionManager;
 }
Пример #2
0
 public SchemaBrowserRepository(IAuthorisation authorisation, IMetadataProvider metadataProvider)
     : base(Constants.DataServiceName, authorisation, metadataProvider)
 {
     _utils        = new SchemaBrowserUtils();
     _nextIds      = new ConcurrentDictionary <Type, long>();
     _repositories = new ConcurrentDictionary <Type, ConcurrentDictionary <long, IHaveAssignableId <long> > >();
 }
Пример #3
0
        public ApiModule(IDataServiceHostSettings dshs, IAuthorisation authorisation, IDataServiceDesignerDataService dsdDataService, ISchemaBrowserRepository sbRepository)
            : base("api/dataServicedesigner")
        {
            _dshs           = dshs;
            _authorisation  = authorisation;
            _dsdDataService = dsdDataService;
            _sbRepository   = sbRepository;

            Get[@"/availableschemas/{dataServiceName}", true] = async(args, ct) =>
            {
                string dataServiceName = args.dataServiceName;

                var builder = new QueryBuilder <DomainDataService>()
                              .Filter(d => d.Property(p => p.Name).EqualTo(dataServiceName));
                //.Expand(d => d.Connection);

                var roleIds = await _authorisation.GetAdministratorRoleIdsAsync();

                var queryResult = _dsdDataService.Query(new Query(builder.GetQuery()), BwfSystemUser, roleIds, string.Empty, _dshs.SystemToken, out var fault);

                var dataService = queryResult?.Records?.SingleOrDefault() as DomainDataService;

                if (dataService is null)
                {
                    return(Response.AsJson(Enumerable.Empty <DbSchema>(), HttpStatusCode.BadRequest));
                }

                var schemas = _sbRepository.GetWhere <DbSchema>(s => s.Connection.Name == dataService.Connection.Name);
                return(Response.AsJson(schemas));
            };
        }
Пример #4
0
 public DataServiceDesignerStartup(IDataServiceDesignerRepository dsdRepository, IDataServiceHostSettings dshs, IAuthorisation authorisation, IDataServiceDesignerDataService dsdDataService, ISchemaBrowserHelpers schemaBrowserHelpers)
 {
     _dsdRepository        = dsdRepository;
     _dshs                 = dshs;
     _authorisation        = authorisation;
     _dsdDataService       = dsdDataService;
     _schemaBrowserHelpers = schemaBrowserHelpers;
 }
Пример #5
0
 public DataLakeGen2RestApi(IHttpClientWrapper httpClient, IAuthorisation authorisation,
                            string storageAccountName)
 {
     _httpClient         = httpClient;
     _authorisation      = authorisation;
     _storageAccountName = storageAccountName;
     _baseUri            = $"https://{_storageAccountName}.dfs.core.windows.net";
 }
Пример #6
0
 public UserController(ISessionManager sessionManager, IUserAuthenticator authenticator,
                       IUserRepository userRepository, IAuthorisation authoriser)
 {
     this.UserRepository = userRepository;
     this.SessionManager = sessionManager;
     this.Authenticator  = authenticator;
     this.Authorisation  = authoriser;
 }
Пример #7
0
        public StoreController(IProductRepository prodRepo, IOrderRepository orderRepo,
                               ISessionManager sessionManager, IUserRepository userRepo,
                               IAuthorisation authorizer)
        {
            this.ProductRepository = prodRepo;
            this.OrderRepository   = orderRepo;
            this.UserRepository    = userRepo;
            this.SessionManager    = sessionManager;

            this.Authorisation = authorizer;
        }
Пример #8
0
 //ISessionFactory _internalFactory;
 public DataServiceDesignerRepository(
     IHostConfiguration hostConfiguration,
     IGlobalisationProvider globalisationProvider,
     IAuthorisation authorisation,
     IMetadataProvider metadataProvider)
     : base(
         hostConfiguration,
         globalisationProvider,
         authorisation,
         new List <string>(),
         metadataProvider,
         Constants.DataServiceName,
         Constants.DataServiceSchema)
 {
 }
Пример #9
0
 public BCRRepository(
     IHostConfiguration hostConfiguration,
     IGlobalisationProvider globalisationProvider,
     IAuthorisation authorisation,
     IMetadataProvider metadataProvider)
     : base(
         hostConfiguration,
         globalisationProvider,
         authorisation,
         new List <string>(),
         metadataProvider,
         "bcr", // the name of the data service
         "dbo") // the default database schema the tables for the domain objects are in
 {
 }
 public ActionProcessingDataServiceRepository(
     IHostConfiguration hostConfiguration,
     IGlobalisationProvider globalisationProvider,
     IAuthorisation authorisation,
     IMetadataProvider metadataProvider,
     IRegisteredQueryManager registeredQueryManager)
     : base(hostConfiguration,
            globalisationProvider,
            authorisation,
            new List <string>(),
            metadataProvider,
            ActionProcessingDataServiceConstants.DataServiceName,
            ActionProcessingDataServiceConstants.SchemaName,
            registeredQueryManager: registeredQueryManager)
 {
 }
 public ActionProcessingDataService(
     IHostConfiguration hostConfiguration,
     IEnumerable <IRecordType> recordTypes,
     IGlobalisationProvider globalisationProvider,
     IAuthorisation authorisation,
     IMetadataProvider metadataProvider,
     IActionProcessingDataServiceRepository actionProcessingDataServiceRepository,
     IDatabaseStreamingQueryExecutor databaseStreamingQueryExecutor)
     : base(ActionProcessingDataServiceConstants.DataServiceName,
            globalisationProvider,
            actionProcessingDataServiceRepository as DatabaseDataServiceRepository,
            recordTypes,
            metadataProvider,
            databaseStreamingQueryExecutor)
 {
 }
Пример #12
0
 public SchemaBrowserDataService(
     IEnumerable <IRecordType> recordTypes,
     IGlobalisationProvider globalisationProvider,
     IAuthorisation authorisation,
     IMetadataProvider metadataProvider,
     ISchemaBrowserRepository repository)
     : base(
         Constants.DataServiceName,
         globalisationProvider,
         repository as InMemoryDataServiceRepository,
         recordTypes,
         authorisation,
         metadataProvider)
 {
     ValidatorOptions.CascadeMode = CascadeMode.StopOnFirstFailure;
 }
Пример #13
0
 public BCRDataService(
     IHostConfiguration hostConfiguration,
     IEnumerable <IRecordType> recordTypes,
     IGlobalisationProvider globalisationProvider,
     IAuthorisation authorisation,
     IMetadataProvider metadataProvider,
     IBCRRepository ibcrRepository,
     IDatabaseStreamingQueryExecutor databaseStreamingQueryExecutor)
     : base(
         "bcr", // the name of the data service
         globalisationProvider,
         ibcrRepository as DatabaseDataServiceRepository,
         recordTypes,
         metadataProvider,
         databaseStreamingQueryExecutor)
 {
     ValidatorOptions.CascadeMode = CascadeMode.StopOnFirstFailure;
 }
 public DataServiceDesignerDataService(
     IHostConfiguration hostConfiguration,
     IEnumerable <IRecordType> recordTypes,
     IGlobalisationProvider globalisationProvider,
     IAuthorisation authorisation,
     IMetadataProvider metadataProvider,
     IDataServiceDesignerRepository repository,
     IDatabaseStreamingQueryExecutor databaseStreamingQueryExecutor)
     : base(
         Constants.DataServiceName,
         globalisationProvider,
         repository as DatabaseDataServiceRepository,
         recordTypes,
         metadataProvider,
         databaseStreamingQueryExecutor)
 {
     ValidatorOptions.CascadeMode = CascadeMode.StopOnFirstFailure;
 }
Пример #15
0
        public ApiModule(IDataServiceHostSettings dshs, IAuthorisation authorisation, IDataServiceDesignerDataService dsdDataService, ISchemaBrowserRepository sbRepository)
            : base("api/dataservicedesigner")
        {
            _dshs           = dshs;
            _authorisation  = authorisation;
            _dsdDataService = dsdDataService;
            _sbRepository   = sbRepository;

            Get[@"/availableschemas/{dataServiceName}", true] = async(args, ct) =>
            {
                string dataServiceName = args.dataServiceName;

                var builder = new QueryBuilder <DomainDataService>()
                              .Filter(d => d.Property(p => p.Name).EqualTo(dataServiceName))
                              .Expand(d => d.Connection);

                var roleIds = await _authorisation.GetAdministratorRoleIdsAsync();

                var queryResult = _dsdDataService.Query(new Query(builder.GetQuery()), BwfSystemUser, roleIds, string.Empty, _dshs.SystemToken, out var fault);

                var dataService = queryResult?.Records?.SingleOrDefault() as DomainDataService;

                if (dataService is null)
                {
                    return(Response.AsJson(Enumerable.Empty <DbSchema>(), HttpStatusCode.BadRequest));
                }

                var schemas = _sbRepository.GetWhere <DbSchema>(s => s.Connection.Name == dataService.Connection.Name);
                return(Response.AsJson(schemas));
            };

            Get[@"generatetemplate/{solutionName}", true] = async(args, ct) => {
                string solutionName = args.solutionName;

                var solution = await GetSolution(solutionName);

                return(await Task.Run(() =>
                {
                    var templateGenerator = new TemplateGenerator();
                    var baseDir = AppDomain.CurrentDomain.BaseDirectory;
                    var zipPath = Path.Combine(baseDir, $"DownLoads\\{solutionName}");
                    var zipFile = templateGenerator.GenerateAllAndZip(solution, zipPath);

                    var stream = new FileStream(zipFile, FileMode.Open);
                    var response = new StreamResponse(() => stream, MimeTypes.GetMimeType(zipFile));
                    var fileName = Path.GetFileName(zipFile);
                    var attachment = response.AsAttachment(fileName);
                    return attachment;
                }));
            };

            async Task <DataServiceSolution> GetSolution(string solutionName)
            {
                var builder = new QueryBuilder <DataServiceSolution>()
                              .Expand(p => p.DataServices[0].Solution)
                              .Expand(p => p.DataServices[0].Connection)
                              .Expand(p => p.DataServices[0].Schemas)
                              .Expand(p => p.DataServices[0].Schemas[0].Objects)
                              .Expand(p => p.DataServices[0].Schemas[0].Objects[0].Properties)
                              .Expand(p => p.DataServices[0].Schemas[0].References)
                              .Expand(p => p.DataServices[0].Schemas[0].References[0].Properties)
                              .Filter(d => d.Property(p => p.Name).EqualTo(solutionName));

                var roleIds = await _authorisation.GetAdministratorRoleIdsAsync();

                var queryResult = _dsdDataService.Query(new Query(builder.GetQuery()), BwfSystemUser, roleIds, string.Empty, _dshs.SystemToken, out var fault);

                var solution = queryResult?.Records?.SingleOrDefault() as DataServiceSolution;

                return(solution);
            }
        }
 public ProvisionalContractDataServiceRepository(IHostConfiguration hostConfiguration, IGlobalisationProvider globalisation, IAuthorisation authorisation, IMetadataProvider metadataProvider, string databaseType = null, string connectionString = null)
     : base(hostConfiguration, globalisation, authorisation, new List <string>(), metadataProvider, Constants.DataServiceName, Constants.DefaultDatabaseSchema, databaseType, connectionString)
 {
 }
Пример #17
0
 public DataLakeGen2Client(HttpClient httpClient, IAuthorisation authorisation, string storageAccountName) :
     this(new DataLakeGen2RestApi(httpClient, authorisation, storageAccountName))
 {
 }
        public ProvisionalContractDataService(IProvisionalContractDataServiceRepository repository, IDataServiceHostSettings hostSettings, IEnumerable <IRecordType> recordTypes, IAuthorisation authorisation, IGlobalisationProvider globalisationProvider, IMetadataProvider metadataProvider, IDatabaseStreamingQueryExecutor streamingQueryExecutor)
            : base(Constants.DataServiceName, globalisationProvider, repository as DatabaseDataServiceRepository, recordTypes, metadataProvider, streamingQueryExecutor)
        {
            _hostSettings = hostSettings;
            _hostUrl      = hostSettings.HostUrl;

            ValidatorOptions.CascadeMode = CascadeMode.StopOnFirstFailure;
        }
        //private string _databaseType;

        public TradeDatabaseDataServiceRepository(ITradeDataServiceSettings settings, IHostConfiguration hostConfiguration, IGlobalisationProvider globalisation, IAuthorisation authorisation, IMetadataProvider metadataProvider, string databaseType = null, string connectionString = null)
            : base(hostConfiguration, globalisation, authorisation, new List <string>(), metadataProvider, settings.DataServiceName, settings.DefaultSchema, databaseType, connectionString)
        {
        }
Пример #20
0
 public NavController(ISessionManager sessionManager, IAuthorisation authorisation, IUserRepository userRepository)
 {
     this.SessionManager = sessionManager;
     this.Authorisation  = authorisation;
     this.UserRepository = userRepository;
 }
Пример #21
0
 public DataLakeGen2RestApi(HttpClient httpClient, IAuthorisation authorisation, string storageAccountName) :
     this(new HttpClientWrapper(httpClient), authorisation, new DateTimeWrapper(), storageAccountName)
 {
 }
Пример #22
0
 public AdminController(IUserRepository userRepo, ISessionManager session, IAuthorisation authorisation)
 {
     this.UserRepository = userRepo;
     this.SessionManager = session;
     this.Authorisation  = authorisation;
 }
Пример #23
0
 public TradeDataService(ITradeDataServiceSettings settings, ITradeDataServiceRepository repository, IHostConfiguration hostConfiguration, IEnumerable <IRecordType> recordTypes, IAuthorisation authorisation, IGlobalisationProvider globalisationProvider, IMetadataProvider metadataProvider, string databaseType = null, string connectionString = null)
     : base(settings.DataServiceName, globalisationProvider, repository as DatabaseDataServiceRepository, recordTypes, metadataProvider)
 {
     ValidatorOptions.CascadeMode = CascadeMode.StopOnFirstFailure;
 }
Пример #24
0
 public InMemoryTradeDataServiceRepository(IAuthorisation authorisation, IMetadataProvider metadataProvider)
     : base("curveprovider", authorisation, metadataProvider)
 {
     _typeNextIds      = new ConcurrentDictionary <Type, long>();
     _typeRepositories = new ConcurrentDictionary <Type, ConcurrentDictionary <long, IHaveAssignableId <long> > >();
 }
Пример #25
0
 public UserAuthenticator(IAuthorisation authorisation)
 {
     Authorizer = authorisation;
 }