This commit is contained in:
owenchen committed 2026-05-12 10:32:46 +08:00
commit 5959bae57b
56 files changed
+5152

No files matched your search

@@ -0,0 +1,86 @@
using Microsoft.AspNetCore.Authorization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace CloudBuilder.CodeGenerator.Data
{
public class ClassInfo
{
public string ClassName { get; set; }
public string InterfaceName { get; set; }
public string ImplementTypeName { get; set; }
public string[] Usings { get; set; }
public bool IsDownload { get; set; } = false;
public ClassConstructorInfo[] ClassConstructorInfos;
public ClassMethodInfo[] ClassMethodInfos;
public ClassPropertyInfo[] ClassProperties;
public ClassFieldInfo[] ClassFields;
}
public class ClassFieldInfo
{
public bool IsValueType { get; set; } = false;
public string FieldName { get; set; }
public string FieldTypeName { get; set; }
public string FieldValue { get; set; }
}
public class ClassPropertyInfo
{
public bool IsValueType { get; set; } = false;
public string PropertyName { get; set; }
public string PropertyTypeName { get; set; }
}
public class ClassConstructorInfo
{
public string ConstructorName { get; set; }
public MethodParameter[] Parameters { get; set; }
}
public class ClassMethodInfo
{
public string MethodName { get; set; }
public string HttpName { get; set; } = "[HttpPost]";
public string UnitOfWorkName { get; set; } = "[UnitOfWork]";
public string AuthorizeName { get; set; } = "[AllowAnonymous]";
public string PermissionOperate { get; set; } = "[PermissionOperate(name: {0}, operate: {1})]";
public PermissionOperateAttribute PermissionOperateAttribute { get; set; }
public string MethodReturnName { get; set; }
public bool IsValueType { get; set; } = false;
public MethodParameter[] Parameters { get; set; }
}
public class MethodParameter
{
public bool IsValueType { get; set; } = false;
public string ParameterName { get; set; }
public string ParameterTypeName { get; set; }
public static bool CheckValueType(Type type)
{
var typeInfo = type.GetTypeInfo();
if (typeInfo.IsGenericType && typeInfo.GetGenericTypeDefinition() == typeof(Nullable<>))
{
// nullable type, check if the nested type is simple.
return CheckValueType(typeInfo.GetGenericArguments()[0]);
}
return typeInfo.IsPrimitive
|| typeInfo.BaseType?.Name == "ValueType"
|| typeInfo.IsEnum
|| type.Equals(typeof(string))
|| type.Equals(typeof(DateTime))
|| type.Equals(typeof(decimal));
}
}
}
@@ -0,0 +1,28 @@
using CloudBuilder.CodeGenerator.Config;
using CloudBuilder.CodeGenerator.Data;
using CloudBuilder.CodeGenerator.Entity;
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
using static System.Windows.Forms.LinkLabel;
namespace CloudBuilder.CodeGenerator.Data
{
public class ModelData
{
public SysTableSchemaViewEntity[] sysTableSchemas;
public NamespaceObject NamespaceObject;
public ClassInfo[] ClassInfos;
public ClassInfo ClassInfo;
public string KeyType;
public int KeyCount;
}
}
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CloudBuilder.CodeGenerator.Data
{
public class SysTable
{
public string Selected { get; set; } = null!;
public string TableName { get; set; } = null!;
}
}