添加项目文件。

This commit is contained in:
zgf committed 2023-07-25 19:20:18 +08:00
1 parent 05e131ca4e
commit 514d6f5255
1162 files changed
+81255

No files matched your search

@@ -0,0 +1,46 @@
using System;
using System.Linq;
using Microsoft.Extensions.Localization;
namespace WalkingTec.Mvvm.Core
{
/// <summary>
/// 标记Controller和Action的描述
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]
public class ActionDescriptionAttribute : Attribute
{
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
public string ClassFullName { get; set; }
public bool IsPage { get; set; }
public IStringLocalizer _localizer { get; set; }
/// <summary>
/// 新建一个描述
/// </summary>
public ActionDescriptionAttribute(string desc)
{
this.Description = desc;
}
public ActionDescriptionAttribute(string desc, string classFullName)
{
this.Description = desc;
this.ClassFullName = classFullName;
}
public ActionDescriptionAttribute(string desc, string classFullName, bool ispage)
{
this.Description = desc;
this.ClassFullName = classFullName;
this.IsPage = ispage;
}
public void SetLoccalizer(Type controllertype)
{
_localizer = Core.CoreProgram._localizer;
}
}
}
@@ -0,0 +1,12 @@
using System;
namespace WalkingTec.Mvvm.Core
{
/// <summary>
/// 标记Controller或Action不受权限控制,只要登录任何人都可访问
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]
public class AllRightsAttribute : Attribute
{
}
}
@@ -0,0 +1,13 @@
using System;
namespace WalkingTec.Mvvm.Core
{
/// <summary>
/// 标记模型上的字段不能被修改
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class CanNotEditAttribute : Attribute
{
}
}
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WalkingTec.Mvvm.Core
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]
public class DebugOnlyAttribute : Attribute
{
}
}
@@ -0,0 +1,50 @@
using System;
namespace WalkingTec.Mvvm.Core
{
public enum DBOperationEnum { Default, Read, Write }
/// <summary>
/// 标记Controller或Action使用固定的连接字符串,不受其他设定控制
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]
public class FixConnectionAttribute : Attribute
{
/// <summary>
/// 连接字符串名称
/// </summary>
public string CsName { get; set; }
public DBTypeEnum? DbType { get; set; }
/// <summary>
/// 操作类型,读或写
/// </summary>
public DBOperationEnum Operation { get; set; }
/// <summary>
/// 新建固定连接字符串标记
/// </summary>
/// <param name="Operation">Operation</param>
/// <param name="CsName">the key of the ConnectionString in appsettings</param>
public FixConnectionAttribute(DBOperationEnum Operation = DBOperationEnum.Default, string CsName = "")
{
this.CsName = CsName;
this.Operation = Operation;
this.DbType = null;
}
/// <summary>
/// 操作类型,读或写
/// </summary>
/// <param name="DbType">the database type, if t is Default, the value in appsettings will be used</param>
/// <param name="Operation">Operation</param>
/// <param name="CsName">the key of the ConnectionString in appsettings</param>
public FixConnectionAttribute(DBTypeEnum DbType, DBOperationEnum Operation = DBOperationEnum.Default, string CsName = "")
{
this.CsName = CsName;
this.Operation = Operation;
this.DbType = DbType;
}
}
}
@@ -0,0 +1,13 @@
using System;
using Microsoft.AspNetCore.Authorization;
namespace WalkingTec.Mvvm.Core
{
/// <summary>
/// 标记Action只能由主用户访问,租户用户不能访问
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]
public class MainTenantOnlyAttribute : Attribute
{
}
}
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WalkingTec.Mvvm.Core.Attributes
{
/// <summary>
/// 标记某个Model是一个多对多的中间表
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class MiddleTableAttribute : Attribute
{
}
}
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WalkingTec.Mvvm.Core
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]
public class NoLogAttribute : Attribute
{
}
}
@@ -0,0 +1,13 @@
using System;
using Microsoft.AspNetCore.Authorization;
namespace WalkingTec.Mvvm.Core
{
/// <summary>
/// 标记Action返回的为公共页面,跳过权限验证,不需要登录即可访问
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]
public class PublicAttribute : Attribute, IAllowAnonymous
{
}
}
@@ -0,0 +1,27 @@
using System;
namespace WalkingTec.Mvvm.Core
{
public enum ReInitModes { FAILEDONLY, SUCCESSONLY, ALWAYS }
/// <summary>
/// 标记VM中的ReInit方法是在提交错误时触发,提交成功时触发,或是都触发。这是为了一些特殊逻辑的VM设计的
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class ReInitAttribute : Attribute
{
/// <summary>
/// 触发模式
/// </summary>
public ReInitModes ReInitMode { get; set; }
/// <summary>
/// 新建触发标记
/// </summary>
/// <param name="mode">触发模式</param>
public ReInitAttribute(ReInitModes mode)
{
this.ReInitMode = mode;
}
}
}
@@ -0,0 +1,18 @@
using System;
namespace WalkingTec.Mvvm.Core
{
/// <summary>
/// 标记模型上的字段不能被修改
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class SoftFKAttribute : Attribute
{
public string PropertyName { get; set; }
public SoftFKAttribute(string proName)
{
this.PropertyName = proName;
}
}
}
@@ -0,0 +1,18 @@
using System;
namespace WalkingTec.Mvvm.Core
{
/// <summary>
/// 标记模型上的字段不能被修改
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class SoftKeyAttribute : Attribute
{
public string PropertyName { get; set; }
public SoftKeyAttribute(string proName)
{
this.PropertyName = proName;
}
}
}
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WalkingTec.Mvvm.Core
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]
public class ValidateFormItemOnlyAttribute : Attribute
{
}
}