ow
This commit is contained in:
commit
f05d2d215f
678 files changed
+73865
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user