private void EnsureTables(ITableEntityOperation tableEntityOperations)
        {
            if (!_created)
            {
                // for management
                tableEntityOperations.EnsureTable("LoginUser");
                tableEntityOperations.EnsureTable("User");
                tableEntityOperations.EnsureTable("Company");
                tableEntityOperations.EnsureTable("Service");
                tableEntityOperations.EnsureTable("Network");
                tableEntityOperations.EnsureTable("Device");
                tableEntityOperations.EnsureTable("Setting");

                // for data
                tableEntityOperations.EnsureTable("CurrentData");
                tableEntityOperations.EnsureTable("TimeSeries");
            }
            _created = true;
        }
示例#2
0
        public void Setup(IDynamicConnectionStringResolver dynamicConnectionStringResolver, IDictionary <string, string> parameters)
        {
            string connectionString = null;

            if (!parameters.TryGetValue(ConnectionStringString, out connectionString))
            {
                connectionString =
                    dynamicConnectionStringResolver.Resolve(parameters[ConnectionNameString]).ConnectionString;
            }

            var cloudStorageAccount = CloudStorageAccount.Parse(connectionString);
            var cloudTableClient    = cloudStorageAccount.CreateCloudTableClient();

            TableEntityOperation = new AzureTableEntityOperations(cloudTableClient);
            TableName            = parameters[TableString];

            if (!TableName.All(char.IsLetterOrDigit))
            {
                throw new ArgumentException("Invalid table name");
            }
        }
示例#3
0
 public ServiceRepository(ITableEntityOperation tableEntityOperation)
     : base(tableEntityOperation)
 {
 }
示例#4
0
 public NetworkRepository(ITableEntityOperation tableEntityOperation)
     : base(tableEntityOperation)
 {
 }
示例#5
0
 public SettingOperations(ICloudStorageClientFactory cloudStorageClientFactory)
 {
     _tableEntityOperation = cloudStorageClientFactory.GetTableEntityOperation();
 }
示例#6
0
 public UserRepository(ITableEntityOperation tableEntityOperation)
     : base(tableEntityOperation)
 {
 }
示例#7
0
 public SettingRepository(ITableEntityOperation tableEntityOperation)
     : base(tableEntityOperation)
 {
 }
示例#8
0
 public CompanyRepository(ITableEntityOperation tableEntityOperation) : base(tableEntityOperation)
 {
 }
示例#9
0
 public GenericRepository(ITableEntityOperation tableEntityOperation, string tableName)
     : base(tableEntityOperation)
 {
     _tableName = tableName;
 }
示例#10
0
 public NetworkOperations(ICloudStorageClientFactory cloudStorageClientFactory)
 {
     _tableEntityOperation = cloudStorageClientFactory.GetTableEntityOperation();
 }
示例#11
0
 protected Repository(ITableEntityOperation tableEntityOperation)
 {
     _tableEntityOperation = tableEntityOperation;
 }