mirror of https://github.com/abpframework/abp.git
csharpabpc-sharpframeworkblazoraspnet-coredotnet-coreaspnetcorearchitecturesaasdomain-driven-designangularmulti-tenancy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
using System.Linq;
|
|
using Blazorise;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.Extensions.Localization;
|
|
using Volo.Abp.AspNetCore.Components.Web;
|
|
using Volo.Abp.Data;
|
|
using Volo.Abp.ObjectExtending;
|
|
|
|
namespace Volo.Abp.BlazoriseUI.Components.ObjectExtending;
|
|
|
|
public abstract class ExtensionPropertyComponentBase<TEntity, TResourceType> : OwningComponentBase
|
|
where TEntity : IHasExtraProperties
|
|
{
|
|
[Inject]
|
|
public IStringLocalizerFactory StringLocalizerFactory { get; set; }
|
|
|
|
[Parameter]
|
|
public TEntity Entity { get; set; }
|
|
|
|
[Parameter]
|
|
public ObjectExtensionPropertyInfo PropertyInfo { get; set; }
|
|
|
|
[Parameter]
|
|
public AbpBlazorMessageLocalizerHelper<TResourceType> LH { get; set; }
|
|
|
|
protected virtual void Validate(ValidatorEventArgs e)
|
|
{
|
|
e.Status = ValidationStatus.Success;
|
|
|
|
var result = ExtensibleObjectValidator.GetValidationErrors(Entity, PropertyInfo.Name, e.Value);
|
|
if (!result.Any())
|
|
{
|
|
return;
|
|
}
|
|
|
|
e.Status = ValidationStatus.Error;
|
|
e.ErrorText = result.First().ErrorMessage;
|
|
}
|
|
}
|
|
|