Exemple #1
0
        /// <summary>
        /// LUA结构支持
        /// </summary>
        /// <returns></returns>
        public override void GetLuaStruct(StringBuilder code)
        {
            base.GetLuaStruct(code);
            int idx;

            idx = 0;
            code.AppendLine("['ApiItems'] ={");
            foreach (var val in ApiItems)
            {
                if (idx++ > 0)
                {
                    code.Append(',');
                }
                code.AppendLine($@"{val.GetLuaStruct()}");
            }
            code.AppendLine("},");

            idx = 0;
            code.AppendLine("['Entities'] ={");
            foreach (var val in Entities)
            {
                if (idx++ > 0)
                {
                    code.Append(',');
                }
                code.AppendLine($@"{val.GetLuaStruct()}");
            }
            code.AppendLine("},");

            code.AppendLine($@"['ReadOnly'] ={(ReadOnly.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(DataBaseObjectName))
            {
                code.AppendLine($@"['DataBaseObjectName'] = '{DataBaseObjectName.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['DataBaseObjectName'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(NameSpace))
            {
                code.AppendLine($@"['NameSpace'] = '{NameSpace.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['NameSpace'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(PagePath))
            {
                code.AppendLine($@"['PagePath'] = '{PagePath.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['PagePath'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(BusinessPath))
            {
                code.AppendLine($@"['BusinessPath'] = '{BusinessPath.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['BusinessPath'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ClientCsPath))
            {
                code.AppendLine($@"['ClientCsPath'] = '{ClientCsPath.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ClientCsPath'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ModelPath))
            {
                code.AppendLine($@"['ModelPath'] = '{ModelPath.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ModelPath'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(CodePath))
            {
                code.AppendLine($@"['CodePath'] = '{CodePath.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['CodePath'] = nil,");
            }

            code.AppendLine($@"['DbType'] ='{DbType}',");

            if (!string.IsNullOrWhiteSpace(DbHost))
            {
                code.AppendLine($@"['DbHost'] = '{DbHost.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['DbHost'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(DbSoruce))
            {
                code.AppendLine($@"['DbSoruce'] = '{DbSoruce.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['DbSoruce'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(DbPassWord))
            {
                code.AppendLine($@"['DbPassWord'] = '******',");
            }
            else
            {
                code.AppendLine($@"['DbPassWord'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(DbUser))
            {
                code.AppendLine($@"['DbUser'] = '******',");
            }
            else
            {
                code.AppendLine($@"['DbUser'] = nil,");
            }
        }