static void Main(string[] args) { //初始化全局事件 InitEvents(); BusinessStore store = new BusinessStore(); while (true) { //同时启动制作包子和吃包子 Task.WaitAll( //制作包子 Task.Run(() => store.BeginCooker(cookers)), //吃包子 Task.Run(() => store.BeginConsumer(consumers)) ); } }
public static async Task <List <BaseModel> > SeedBusinessesAsync([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req, ExecutionContext context) { var tableName = req.Query["table"]; CloudTable table = await DatabaseHelper.CreateTableAsync(tableName, context); var store = new BusinessStore(new WebClient(new HttpClient())); var businesses = await store.SeedItemsAsync(); var businessesEnitites = businesses.Select(x => new ModelEntity { Model = x, PartitionKey = tableName, RowKey = x.Id }); foreach (var business in businessesEnitites) { await table.InsertOrMergeEntityAsync(business); } return(businesses.ToList <BaseModel>()); }
public BusinessService(BusinessStore businessStore, NotificationSender notificationService, UserManager <ApplicationUser> userManager) { this.businessStore = businessStore; this.notificationSender = notificationService; this.userManager = userManager; }
public BusinessAuthorize(BusinessStore businessStore, InvoiceStore invoiceStore, ClientStore clientStore) { this.businessStore = businessStore; this.invoiceStore = invoiceStore; this.clientStore = clientStore; }