コード例 #1
0
        /// <summary>
        /// Add Object to storage
        /// </summary>
        public void Add(AzureDataModel entity)
        {
            try
            {

                // Create storage context
                DataServiceContext dataServiceContext = this.cloudTableClient.GetDataServiceContext();

                // Add object to context
                dataServiceContext.AddObject(AzureTableName, entity);

                // Save context which saves object to storage
                DataServiceResponse response = dataServiceContext.SaveChanges();
            }
            catch(Exception ex)
            {
                Debug.WriteLine("*****AzureDataModelFactory:Add ex.Message=" + ex.Message);
            }
        }
コード例 #2
0
        /// <summary>
        /// Create a New Object - doesn't put it in storage
        /// </summary>
        /// <returns></returns>
        public AzureDataModel Create(string processName, DateTime dateEntered)
        {
            // constructor uses dateEntered to generate
            // rowkey and partition key
            AzureDataModel entity = new AzureDataModel(dateEntered)
            {
                DateEntered = dateEntered,
                ProcessName = processName
            };

            return (entity);
        }