コード例 #1
0
        // ARM
        public async Task <ResourceGroup> ActivateLogicApp(LogicTemplate template, TryWebsitesIdentity userIdentity, string anonymousUserName)
        {
            return(await ActivateResourceGroup(userIdentity, AppService.Logic, false, DeploymentType.CsmDeploy, async (resourceGroup, inProgressOperation) =>
            {
                SimpleTrace.TraceInformation("{0}; {1}; {2}; {3}; {4}",
                                             AnalyticsEvents.OldUserCreatedSiteWithLanguageAndTemplateName, "Logic", template.Name, resourceGroup.ResourceUniqueId, AppService.Logic.ToString());

                var logicApp = new LogicApp(resourceGroup.SubscriptionId, resourceGroup.ResourceGroupName, Guid.NewGuid().ToString().Replace("-", ""))
                {
                    Location = resourceGroup.GeoRegion
                };

                var csmTemplateString = string.Empty;

                using (var reader = new StreamReader(template.CsmTemplateFilePath))
                {
                    csmTemplateString = await reader.ReadToEndAsync();
                }

                csmTemplateString = csmTemplateString.Replace("{{logicAppName}}", logicApp.LogicAppName);
                //csmTemplateString = csmTemplateString.Replace("{{gatewayName}}", Guid.NewGuid().ToString().Replace("-", "")).Replace("{{logicAppName}}", logicApp.LogicAppName);

                await inProgressOperation.CreateDeployment(JsonConvert.DeserializeObject <JToken>(csmTemplateString), block: true, subscriptionType: resourceGroup.SubscriptionType);

                // After a deployment, we have no idea what changes happened in the resource group
                // we should reload it.
                // TODO: consider reloading the resourceGroup along with the deployment itself.
                await resourceGroup.Load();

                var rbacTask = resourceGroup.AddResourceGroupRbac(userIdentity.Puid, userIdentity.Email);
                resourceGroup.IsRbacEnabled = await rbacTask;
                return resourceGroup;
            }));
        }
コード例 #2
0
        public static void GenerateDataAccess(string tableName)
        {
            var fieldList  = generateDal.GetFieldList(tableName);
            var tableModel = generateDal.GetTableList().Single(o => o.Name == tableName);

            ModelTemplate modelTemplate = new ModelTemplate(fieldList, tableModel);
            String        contentModel  = modelTemplate.TransformText();

            System.IO.File.WriteAllText(Utility.FileHelper.PathExists(Config.BusinessEntitiesPath, tableName, Enums.GenerateType.Model), contentModel, Encoding.UTF8);

            DataAccessTemplate dataAccessTemplate = new DataAccessTemplate(fieldList, tableModel);
            String             contentDataAccess  = dataAccessTemplate.TransformText();

            System.IO.File.WriteAllText(Utility.FileHelper.PathExists(Config.DataAccessPath, tableName, Enums.GenerateType.DataAccess), contentDataAccess, Encoding.UTF8);

            LogicTemplate logicTemplate = new LogicTemplate(fieldList, tableModel);
            String        contentLogic  = logicTemplate.TransformText();

            System.IO.File.WriteAllText(Utility.FileHelper.PathExists(Config.BusinessLogicPath, tableName, Enums.GenerateType.Logic), contentLogic, Encoding.UTF8);

            //业务逻辑层接口
            if (Utility.Config.IBusinessLogicEnable == true)
            {
                IDataAccessTemplate idataAccessTemplate = new IDataAccessTemplate(fieldList, tableModel);
                String icontentDataAccess = idataAccessTemplate.TransformText();
                System.IO.File.WriteAllText(Utility.FileHelper.PathExists(Config.IDataAccessPath, "I" + tableName, Enums.GenerateType.DataAccess), icontentDataAccess, Encoding.UTF8);
            }

            //数据访问层接口
            if (Utility.Config.IDataAccessEnable == true)
            {
                ILogicTemplate ilogicTemplate = new ILogicTemplate(fieldList, tableModel);
                String         icontentLogic  = ilogicTemplate.TransformText();
                System.IO.File.WriteAllText(Utility.FileHelper.PathExists(Config.IBusinessLogicPath, "I" + tableName, Enums.GenerateType.Logic), icontentLogic, Encoding.UTF8);
            }
        }