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.
HasRulesManager.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="HasRulesManager.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;
13using Csla.Core;
14
16{
17 [Serializable()]
18 public partial class HasRulesManager : BusinessBase<HasRulesManager>
19 {
20 public static PropertyInfo<string> NameProperty = RegisterProperty<string>(c => c.Name);
21 public string Name
22 {
23 get { return GetProperty(NameProperty); }
24 set { SetProperty(NameProperty, value); }
25 }
26
27 protected override void AddBusinessRules()
28 {
29 BusinessRules.AddRule(new Csla.Rules.CommonRules.Required(NameProperty));
30 BusinessRules.AddRule(new Csla.Rules.CommonRules.MaxLength(NameProperty, 10));
31 }
32
33 [Serializable()]
34 public class Criteria : CriteriaBase<Criteria>
35 {
36 public string _name;
37
38 public Criteria()
39 {
40 _name = "<new>";
41 }
42
43 public Criteria(string name)
44 {
45 this._name = name;
46 }
47
48 protected override void OnGetState(SerializationInfo info, StateMode mode)
49 {
50 base.OnGetState(info, mode);
51 info.AddValue("_name", _name);
52 }
53
54 protected override void OnSetState(SerializationInfo info, StateMode mode)
55 {
56 base.OnSetState(info, mode);
57 _name = info.GetValue<string>("_name");
58 }
59 }
60 }
61}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
Base type from which Criteria classes can be derived in a business class.
Definition: CriteriaBase.cs:25
Maintains metadata about a property.
Business rule for a maximum length string.
Definition: CommonRules.cs:168
Business rule for a required string.
Definition: CommonRules.cs:106
Object containing the serialization data for a specific object.
void AddValue(string name, object value)
Adds a value to the serialization stream.
override void OnSetState(SerializationInfo info, StateMode mode)
override void OnGetState(SerializationInfo info, StateMode mode)
static PropertyInfo< string > NameProperty
StateMode
Indicates the reason the MobileFormatter functionality has been invoked.
Definition: StateMode.cs:20
@ Serializable
Prevents updating or inserting until the transaction is complete.