示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PocoTableStore{T, TPartitionKey, TRowKey}" /> class.
        /// </summary>
        /// <param name="tableName">Name of the azure storage table.</param>
        /// <param name="storageConnectionString">The azure storage connection string.</param>
        /// <param name="partitionProperty">The property to be used as a partition key.</param>
        /// <param name="rowProperty">The property to be used as a row key.</param>
        /// <param name="tableStorageOptions">The table storage options.</param>
        /// <param name="ignoredProperties">The properties that should not be serialized.</param>
        /// <exception cref="ArgumentNullException">tableName
        /// or
        /// storageConnectionString
        /// or
        /// partitionProperty
        /// or
        /// rowProperty</exception>
        public PocoTableStore(string tableName, string storageConnectionString, Expression <Func <T, object> > partitionProperty,
                              Expression <Func <T, object> > rowProperty, TableStorageOptions tableStorageOptions = null, params Expression <Func <T, object> >[] ignoredProperties)
        {
            if (tableName == null)
            {
                throw new ArgumentNullException(nameof(tableName));
            }
            if (storageConnectionString == null)
            {
                throw new ArgumentNullException(nameof(storageConnectionString));
            }
            if (partitionProperty == null)
            {
                throw new ArgumentNullException(nameof(partitionProperty));
            }
            if (rowProperty == null)
            {
                throw new ArgumentNullException(nameof(rowProperty));
            }


            _keysConverter = new SimpleKeysConverter <T, TPartitionKey, TRowKey>(partitionProperty, rowProperty, ignoredProperties);

            tableStorageOptions = tableStorageOptions ?? new TableStorageOptions();
            _tableStore         = new TableStore <DynamicTableEntity>(tableName, storageConnectionString, tableStorageOptions);
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PocoTableStore{T, TPartitionKey, TRowKey}" /> class.
        /// </summary>
        /// <param name="tableName">Name of the table.</param>
        /// <param name="storageConnectionString">The storage connection string.</param>
        /// <param name="keysConverter">The table converter.</param>
        /// <param name="tableStorageOptions">The table storage options.</param>
        /// <exception cref="ArgumentNullException">tableName
        /// or
        /// storageConnectionString
        /// or
        /// tableConverter</exception>
        public PocoTableStore(string tableName, string storageConnectionString,
                              CalculatedKeysConverter <T, TPartitionKey, TRowKey> keysConverter, TableStorageOptions tableStorageOptions = null)
        {
            if (tableName == null)
            {
                throw new ArgumentNullException(nameof(tableName));
            }
            if (storageConnectionString == null)
            {
                throw new ArgumentNullException(nameof(storageConnectionString));
            }
            if (keysConverter == null)
            {
                throw new ArgumentNullException(nameof(keysConverter));
            }

            _keysConverter      = keysConverter;
            tableStorageOptions = tableStorageOptions ?? new TableStorageOptions();
            _tableStore         = new TableStore <DynamicTableEntity>(tableName, storageConnectionString, tableStorageOptions);
        }