/// <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); } }
/// <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); }