init lserp cs 5.0

This commit is contained in:
cyf
2026-07-10 15:25:05 +08:00
commit 90f3fda86a
3799 changed files with 976868 additions and 0 deletions
@@ -0,0 +1,49 @@
using System;
using System.Reflection;
namespace Zhaizj.Framework.ORM {
/// <summary>
/// 检查对象属性是否已经赋值,如果是字符串类型,empty的字符串也是不合法的
/// </summary>
[Serializable]
public class NotNullAttribute : ValidationAttribute {
public NotNullAttribute() {
}
public NotNullAttribute( String msg ) {
base.Message = msg;
}
public override void Validate( String action, IEntity target, EntityPropertyInfo info, Result result ) {
Object obj = target.get( info.Name );
Boolean isNull = false;
if (info.Type == typeof( String )) {
if (obj == null) {
isNull = true;
}
else if (strUtil.IsNullOrEmpty( obj.ToString() )) {
isNull = true;
}
}
else if (obj == null) {
isNull = true;
}
if (isNull) {
if (strUtil.HasText( this.Message )) {
result.Add( this.Message );
}
else {
EntityInfo ei = Entity.GetInfo( target );
String str = "[" + ei.FullName + "] : property \"" + info.Name + "\" ";
result.Add( str + "can not be null" );
}
}
}
}
}