CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
CslaInformationTagHelper.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="CslaInformationTagHelper.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Razor tag helper</summary>
7//-----------------------------------------------------------------------
8using Csla.Rules;
9using Microsoft.AspNetCore.Mvc.ViewFeatures;
10using Microsoft.AspNetCore.Razor.TagHelpers;
11
13{
18 [HtmlTargetElement("span", Attributes = "csla-information-for")]
19 public class CslaInformationTagHelper : TagHelper
20 {
24 public ModelExpression CslaInformationFor { get; set; }
25
31 public override void Process(TagHelperContext context, TagHelperOutput output)
32 {
33 if (CslaInformationFor == null)
34 return;
35 var parts = CslaInformationFor.Name.Split('.');
36 if (parts.Length == 0)
37 return;
38 var model = CslaInformationFor.ModelExplorer.Container.Model;
39 var propertyName = parts[parts.Length - 1];
40 object source = model;
41 for (int i = 0; i < parts.Length - 1; i++)
42 source = Csla.Reflection.MethodCaller.CallPropertyGetter(source, parts[i]);
43 var result = string.Empty;
44 if (source is Csla.Core.BusinessBase obj)
45 result = obj.BrokenRulesCollection.ToString(",", RuleSeverity.Information, propertyName);
46 output.Content.SetContent(result);
47 }
48 }
49}
Razor tag helper that displays CSLA .NET information text in a span.
override void Process(TagHelperContext context, TagHelperOutput output)
Process method
This is the non-generic base class from which most business objects will be derived.
RuleSeverity
Values for validation rule severities.
Definition: RuleSeverity.cs:16