Ejemplo n.º 1
0
        public void InsertOrReplace(Sample.Azure.Model.LargeObject.LargeObjectModel largeObjectModel)
        {
            Common.JSON.JSONService jsonService = new Common.JSON.JSONService();
            string json = jsonService.Serialize <Model.LargeObject.LargeObjectModel>(largeObjectModel);

            Model.File.FileModel fileModel = new Model.File.FileModel();
            string fileName  = largeObjectModel.LargeObjectId.ToString().ToLower() + ".json";
            string container = "largeobject";

            fileModel.Container = container;
            fileModel.Name      = fileName;
            fileModel.Text      = json;

            fileRepository.PutFileAsText(fileModel);
        }
        public void InsertOrReplace(Sample.Azure.Model.Customer.CustomerModel customerModel)
        {
            Common.JSON.JSONService jsonService = new Common.JSON.JSONService();
            string json = jsonService.Serialize <Model.Customer.CustomerModel>(customerModel);

            Model.File.FileModel fileModel = new Model.File.FileModel();
            string fileName  = customerModel.CustomerId.ToString().ToLower() + ".json";
            string container = "customer";

            fileModel.Container = container;
            fileModel.Name      = fileName;
            fileModel.Text      = json;

            fileRepository.PutFileAsText(fileModel);
        }
Ejemplo n.º 3
0
        public void CustomerQueue()
        {
            Model.Customer.CustomerModel customerModel = this.CreateCustomerModel();
            Common.JSON.JSONService      jsonService   = new Common.JSON.JSONService();
            string json = jsonService.Serialize <Model.Customer.CustomerModel>(customerModel);

            Interface.Repository.IQueueRepository queueRepository = DI.Container.Resolve <Interface.Repository.IQueueRepository>();
            queueRepository.Enqueue("customer", json); // Typically you would just put an id in the queue since they have size limits on their payload

            Model.Queue.QueueModel queueModel = new Model.Queue.QueueModel();
            queueModel = queueRepository.Dequeue("customer", TimeSpan.FromMinutes(1));
            Model.Customer.CustomerModel loadedModel = jsonService.Deserialize <Model.Customer.CustomerModel>(queueModel.Item);
            Assert.AreEqual(loadedModel.CustomerName, customerModel.CustomerName);
            queueRepository.DeleteItem("customer", queueModel);
        } // CustomerEntityFramework