/// <summary> /// Gets the property with specified name for current entity /// </summary> /// <typeparam name="T"></typeparam> /// <param name="entity"></param> /// <param name="propertyName"></param> /// <param name="langId"></param> /// <returns></returns> public static LocalizedProperty GetLocalizedProperty <T>(this IHasLocalizedProperty <T> entity, string propertyName, int langId) where T : BaseEntity { var localizedPropertyService = EngineContext.Current.Resolve <ILocalizedPropertyService>(); return (localizedPropertyService.Get( x => x.LocaleKeyGroup == typeof(T).Name && x.EntityId == entity.Id && x.LanguageId == langId && x.LocaleKey == propertyName, null).FirstOrDefault()); }
/// <summary> /// Gets the properties of entity /// </summary> /// <typeparam name="T"></typeparam> /// <param name="entity"></param> /// <param name="langId"></param> /// <returns></returns> public static IList <LocalizedProperty> GetLocalizedPropertys <T>(this IHasLocalizedProperty <T> entity, int langId) where T : BaseEntity { if (entity == null) { return(null); } var localizedPropertyService = EngineContext.Current.Resolve <ILocalizedPropertyService>(); return(localizedPropertyService.Get( x => x.LocaleKeyGroup == typeof(T).Name && x.EntityId == entity.Id && x.LanguageId == langId).ToList()); }
/// <summary> /// Gets the property valueas stored /// </summary> /// <typeparam name="T"></typeparam> /// <param name="entity"></param> /// <param name="propertyName"></param> /// <param name="langId"></param> /// <returns></returns> public static object GetLocalizedPropertyValue <T>(this IHasLocalizedProperty <T> entity, string propertyName, int langId) where T : BaseEntity { var localizedProperty = GetLocalizedProperty(entity, propertyName, langId); return(localizedProperty?.LocaleValue); }