CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
HasRegEx.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="HasRegEx.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>no summary</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.Collections.Generic;
10using System.Text;
11
13{
14 public class HasRegEx : BusinessBase<HasRegEx>
15 {
16 public static PropertyInfo<string> SsnProperty = RegisterProperty<string>(c => c.Ssn);
17 public string Ssn
18 {
19 get { return GetProperty(SsnProperty); }
20 set { SetProperty(SsnProperty, value); }
21 }
22
23 public static PropertyInfo<string> Ssn2Property = RegisterProperty<string>(c => c.Ssn2);
24 public string Ssn2
25 {
26 get { return GetProperty(Ssn2Property); }
27 set { SetProperty(Ssn2Property, value); }
28 }
29
30 protected override void AddBusinessRules()
31 {
32 BusinessRules.AddRule(new Csla.Rules.CommonRules.RegExMatch(SsnProperty, @"^\d{3}-\d{2}-\d{4}$"));
33 BusinessRules.AddRule(new Csla.Rules.CommonRules.RegExMatch(Ssn2Property, @"^\d{3}-\d{2}-\d{4}$"));
34 }
35
36 [Create]
37 private void Create()
38 {
39 }
40 }
41}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
Maintains metadata about a property.
Business rule that evaluates a regular expression.
Definition: CommonRules.cs:486
static PropertyInfo< string > Ssn2Property
Definition: HasRegEx.cs:23
static PropertyInfo< string > SsnProperty
Definition: HasRegEx.cs:16
override void AddBusinessRules()
Definition: HasRegEx.cs:30