- jQuery von Version 3.4.1 auf Version 3.6.0 geupdated
- Beim Laden von Objekten aus der Datenbank wird vorher geprüft, ob der angemeldete Benutzer das Recht hat, das Objekt zu sehen.
29 lines
1.0 KiB
C#
29 lines
1.0 KiB
C#
using System.Reflection;
|
|
|
|
namespace BS.Shared.Extensions
|
|
{
|
|
public static class ObjectExtensions
|
|
{
|
|
public static bool EqualsNullCheck(this object pObject, object otherObject)
|
|
{
|
|
return pObject == null ? otherObject == null : pObject.Equals(otherObject);
|
|
}
|
|
|
|
public static object GetPropertyValue(this object pObject, string pPropertyName)
|
|
{
|
|
PropertyInfo pPropInfo = pObject.GetType().GetProperty(pPropertyName);
|
|
return pPropInfo == null ? null : pPropInfo.GetValue(pObject, null);
|
|
}
|
|
|
|
public static void SetPropertyValue(this object pObject, string pPropertyName, object value)
|
|
{
|
|
PropertyInfo pPropInfo = pObject.GetType().GetProperty(pPropertyName);
|
|
pPropInfo?.SetValue(pObject, value, null);
|
|
}
|
|
|
|
public static string ToStringNullCheck(this object pObject)
|
|
{
|
|
return pObject == null ? string.Empty : pObject.ToString();
|
|
}
|
|
}
|
|
} |