1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using HeuristicLab.Services.Optimization.ControllerService.Model;
|
---|
6 |
|
---|
7 | namespace HeuristicLab.Services.Optimization.ControllerService.Interfaces {
|
---|
8 | public class StringEntry {
|
---|
9 | public string Key { get; set; }
|
---|
10 | public string Text { get; set; }
|
---|
11 | };
|
---|
12 |
|
---|
13 | public interface IScenarioDao {
|
---|
14 | bool Add(ScenarioEntity entity);
|
---|
15 | bool DeleteByName(string scenarioName);
|
---|
16 | ScenarioEntity FindByName(string scenarioName);
|
---|
17 | IEnumerable<ScenarioEntity> GetAllEntities();
|
---|
18 | }
|
---|
19 |
|
---|
20 | public interface IExperimentDao {
|
---|
21 | bool Add(string username, Experiment experiment);
|
---|
22 | bool Update(string username, Experiment experiment);
|
---|
23 | bool DeleteByName(string username, string experiment);
|
---|
24 | bool Delete(string username, string experimentId);
|
---|
25 | Experiment FindByName(string username, string experiment);
|
---|
26 | IEnumerable<Experiment> GetExperiments(string user, bool namesOnly = false);
|
---|
27 | Experiment GetExperimentByName(string username, string scenario);
|
---|
28 |
|
---|
29 | Experiment GetExperimentById(User user, string nodeId);
|
---|
30 | }
|
---|
31 |
|
---|
32 | public interface IJobDao {
|
---|
33 | bool Add(string username, Experiment experiment, string jobId);
|
---|
34 | bool Delete(string username, string jobId);
|
---|
35 | Experiment FindByJobId(string username, string jobId);
|
---|
36 | }
|
---|
37 |
|
---|
38 | public interface IBlobDao {
|
---|
39 | bool Add(StringEntry entry);
|
---|
40 | bool DeleteByKey(string entryKey);
|
---|
41 | StringEntry FindByKey(string entryKey);
|
---|
42 | }
|
---|
43 |
|
---|
44 |
|
---|
45 | public interface IVisualExtensionDao {
|
---|
46 | bool Add(string algorithmId, string script);
|
---|
47 | bool DeleteById(string algorithmId);
|
---|
48 | string FindById(string algorithmId);
|
---|
49 | bool Exists(string algorithmId);
|
---|
50 | }
|
---|
51 |
|
---|
52 | public interface IDataAccessLayer {
|
---|
53 | IScenarioDao ScenarioDao { get; }
|
---|
54 | IBlobDao BlobDao { get; }
|
---|
55 | IExperimentDao ExperimentDao { get; }
|
---|
56 | IVisualExtensionDao VisualExtensionDao { get; }
|
---|
57 | IJobDao JobDao { get; }
|
---|
58 | }
|
---|
59 |
|
---|
60 |
|
---|
61 | public static class DataAccessLayerProvider {
|
---|
62 | private static IDataAccessLayer layer = new Azure.AzureDataAccessLayer();
|
---|
63 | //private static IDataAccessLayer layer = new Mockup.MockupDataAccessLayer();
|
---|
64 |
|
---|
65 | public static IDataAccessLayer GetLayer() {
|
---|
66 | return layer;
|
---|
67 | }
|
---|
68 | }
|
---|
69 | }
|
---|
70 |
|
---|