45 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C#
		
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C#
		
	
	
| using IRaCIS.Core.Domain.Models;
 | |
| using IRaCIS.Core.Domain.Share;
 | |
| using IRaCIS.Core.Domain.Share;
 | |
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.ComponentModel.DataAnnotations;
 | |
| using System.Linq;
 | |
| using System.Reflection;
 | |
| using System.Text;
 | |
| using System.Threading.Tasks;
 | |
| 
 | |
| namespace IRaCIS.Core.Infra.EFCore.Common
 | |
| {
 | |
|     public static class ReadingCommon
 | |
|     {
 | |
|        
 | |
|         public static bool IsNullOrEmpty(this string value)
 | |
|         {
 | |
|             if (value == null || value == string.Empty)
 | |
|             {
 | |
|                 return true;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 return false;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|      
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 获取DisplayName
 | |
|         /// </summary>
 | |
|         /// <param name="enumName"></param>
 | |
|         /// <returns></returns>
 | |
|         public static string GetDisplayName(this Enum enumName)
 | |
|         {
 | |
|             var type = enumName.GetType();//先获取这个枚举的类型
 | |
|             var field = type.GetField(enumName.ToString());//通过这个类型获取到值
 | |
|             var obj = (DisplayAttribute)field.GetCustomAttribute(typeof(DisplayAttribute));//得到特性
 | |
|             return obj.Name ?? "";
 | |
|         }
 | |
|     }
 | |
| }
 |