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

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

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

            if (PrimaryColumn != null)
            {
                code.AppendLine($@"['PrimaryColumn'] = {PrimaryColumn.GetLuaStruct()},");
            }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            //idx = 0;
            //code.AppendLine("['ReadCoreCodes'] ={");
            //foreach (var val in ReadCoreCodes.Values)
            //{
            //    if (idx++ > 0)
            //        code.Append(',');
            //    code.AppendLine($@"{val.GetLuaStruct()}");
            //}
            //code.AppendLine("},");
        }
コード例 #2
0
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "classid": // Int
                return(ClassId.ToString(strFormat, formatProvider));

            case "namespaceid": // Int
                return(NamespaceId.ToString(strFormat, formatProvider));

            case "componentid": // Int
                if (ComponentId == null)
                {
                    return("");
                }
                ;
                return(((int)ComponentId).ToString(strFormat, formatProvider));

            case "classname": // NVarChar
                return(PropertyAccess.FormatString(ClassName, strFormat));

            case "declaration": // NVarChar
                if (Declaration == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Declaration, strFormat));

            case "documentation": // NVarCharMax
                if (Documentation == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Documentation, strFormat));

            case "description": // NVarCharMax
                if (Description == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Description, strFormat));

            case "appearedinversion": // VarChar
                return(PropertyAccess.FormatString(AppearedInVersion, strFormat));

            case "deprecatedinversion": // VarChar
                if (DeprecatedInVersion == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(DeprecatedInVersion, strFormat));

            case "disappearedinversion": // VarChar
                if (DisappearedInVersion == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(DisappearedInVersion, strFormat));

            case "isdeprecated": // Bit
                return(IsDeprecated.ToString());

            case "deprecationmessage": // NVarChar
                if (DeprecationMessage == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(DeprecationMessage, strFormat));

            case "documentationid": // Int
                if (DocumentationId == null)
                {
                    return("");
                }
                ;
                return(((int)DocumentationId).ToString(strFormat, formatProvider));

            case "pendingdescription": // NVarCharMax
                if (PendingDescription == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(PendingDescription, strFormat));

            case "fullname": // NVarChar
                return(PropertyAccess.FormatString(FullName, strFormat));

            case "isabstract": // Bit
                return(IsAbstract.ToString());

            case "isansiclass": // Bit
                return(IsAnsiClass.ToString());

            case "isarray": // Bit
                return(IsArray.ToString());

            case "isautoclass": // Bit
                return(IsAutoClass.ToString());

            case "isautolayout": // Bit
                return(IsAutoLayout.ToString());

            case "isbeforefieldinit": // Bit
                return(IsBeforeFieldInit.ToString());

            case "isbyreference": // Bit
                return(IsByReference.ToString());

            case "isclass": // Bit
                return(IsClass.ToString());

            case "isdefinition": // Bit
                return(IsDefinition.ToString());

            case "isenum": // Bit
                return(IsEnum.ToString());

            case "isexplicitlayout": // Bit
                return(IsExplicitLayout.ToString());

            case "isfunctionpointer": // Bit
                return(IsFunctionPointer.ToString());

            case "isgenericinstance": // Bit
                return(IsGenericInstance.ToString());

            case "isgenericparameter": // Bit
                return(IsGenericParameter.ToString());

            case "isimport": // Bit
                return(IsImport.ToString());

            case "isinterface": // Bit
                return(IsInterface.ToString());

            case "isnested": // Bit
                return(IsNested.ToString());

            case "isnestedassembly": // Bit
                return(IsNestedAssembly.ToString());

            case "isnestedprivate": // Bit
                return(IsNestedPrivate.ToString());

            case "isnestedpublic": // Bit
                return(IsNestedPublic.ToString());

            case "isnotpublic": // Bit
                return(IsNotPublic.ToString());

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }