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.
BypassBusinessBase.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="BypassBusinessBase.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;
12
14{
15 [Serializable()]
16 public class BypassBusinessBase : BusinessBase<BypassBusinessBase>
17 {
19 {
20 MarkOld();
21 }
22
23 protected static PropertyInfo<int> IdProperty = RegisterProperty<int>(nameof(Id), "Id");
24 public int Id
25 {
26 get { return GetProperty<int>(IdProperty); }
27 set { SetProperty<int>(IdProperty, value, Csla.Security.NoAccessBehavior.ThrowException); }
28 }
29
30 protected static PropertyInfo<int> Id2Property = RegisterProperty<int>(c => c.Id2, "Id2");
31 public int Id2
32 {
33 get { return GetProperty<int>(Id2Property); }
34 set { SetProperty<int>(Id2Property, value, Csla.Security.NoAccessBehavior.ThrowException); }
35 }
36
37 private int _id3;
38 protected static PropertyInfo<int> Id3Property = RegisterProperty<int>(c => c.Id3, "Id3", 0, RelationshipTypes.PrivateField);
39 public int Id3
40 {
41 get { return GetProperty<int>(Id3Property, _id3); }
42 set { SetProperty<int>(Id3Property.Name, ref _id3, value, Csla.Security.NoAccessBehavior.ThrowException); }
43 }
44
45 private int _id4;
46 protected static PropertyInfo<int> Id4Property = RegisterProperty<int>(c => c.Id4, "Id4", 0, RelationshipTypes.PrivateField);
47 public int Id4
48 {
49 get { return GetProperty<int>(Id4Property, _id4); }
50 set { SetProperty<int>(Id4Property.Name, ref _id4, value, Csla.Security.NoAccessBehavior.ThrowException); }
51 }
52
53 protected override void AddBusinessRules()
54 {
55 BusinessRules.AddRule(new Csla.Rules.CommonRules.IsInRole(Rules.AuthorizationActions.ReadProperty, IdProperty, new List<string> { "Admin" }));
56 BusinessRules.AddRule(new Csla.Rules.CommonRules.IsInRole(Rules.AuthorizationActions.WriteProperty, IdProperty, new List<string> { "Admin" }));
57 BusinessRules.AddRule(new Csla.Rules.CommonRules.IsInRole(Rules.AuthorizationActions.ReadProperty, Id2Property, new List<string> { "Random" }));
58 BusinessRules.AddRule(new Csla.Rules.CommonRules.IsInRole(Rules.AuthorizationActions.WriteProperty, Id2Property, new List<string> { "Random" }));
59 BusinessRules.AddRule(new Csla.Rules.CommonRules.IsInRole(Rules.AuthorizationActions.ReadProperty, Id3Property, new List<string> { "Admin" }));
60 BusinessRules.AddRule(new Csla.Rules.CommonRules.IsInRole(Rules.AuthorizationActions.WriteProperty, Id3Property, new List<string> { "Admin" }));
61 BusinessRules.AddRule(new Csla.Rules.CommonRules.IsInRole(Rules.AuthorizationActions.ReadProperty, Id4Property, new List<string> { "Random" }));
62 BusinessRules.AddRule(new Csla.Rules.CommonRules.IsInRole(Rules.AuthorizationActions.WriteProperty, Id4Property, new List<string> { "Random" }));
63 }
64
65 public void LoadIdByPass(int id)
66 {
67 using (this.BypassPropertyChecks)
68 {
69 Id = id;
70 }
71 }
72
73 public void LoadIdByNestedPass(int id)
74 {
75 using (this.BypassPropertyChecks)
76 {
77 using (this.BypassPropertyChecks)
78 {
79
80 }
81 // must still be in bypass property checks
82 Id = id;
83 }
84 }
85
86 public void LoadId(int id)
87 {
88 Id = id;
89 }
90
91 public int ReadIdByPass()
92 {
93 using (this.BypassPropertyChecks)
94 {
95 return Id;
96 }
97 }
98
99 public int ReadId()
100 {
101 return Id;
102 }
103
104 public void LoadId2ByPass(int id)
105 {
106 using (this.BypassPropertyChecks)
107 {
108 Id2 = id;
109 }
110 }
111
112 public void LoadId2(int id)
113 {
114 Id2 = id;
115 }
116
117 public int ReadId2ByPass()
118 {
119 using (this.BypassPropertyChecks)
120 {
121 return Id2;
122 }
123 }
124
125 public int ReadId2()
126 {
127 return Id2;
128 }
129
130
131 public void LoadId3ByPass(int id)
132 {
133 using (this.BypassPropertyChecks)
134 {
135 Id3 = id;
136 }
137 }
138
139 public void LoadId3(int id)
140 {
141 Id3 = id;
142 }
143
144 public int ReadId3ByPass()
145 {
146 using (this.BypassPropertyChecks)
147 {
148 return Id3;
149 }
150 }
151
152 public int ReadId3()
153 {
154 return Id3;
155 }
156
157 public void LoadId4ByPass(int id)
158 {
159 using (this.BypassPropertyChecks)
160 {
161 Id4 = id;
162 }
163 }
164
165 public void LoadId4(int id)
166 {
167 Id4 = id;
168 }
169
170 public int ReadId4ByPass()
171 {
172 using (this.BypassPropertyChecks)
173 {
174 return Id4;
175 }
176 }
177
178 public int ReadId4()
179 {
180 return Id4;
181 }
182
183 [Create]
184 private void Create()
185 {
186 }
187
188 [Fetch]
189 private void Fetch()
190 {
191 }
192
193 }
194}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
Maintains metadata about a property.
IsInRole authorization rule.
RelationshipTypes
List of valid relationship types between a parent object and another object through a managed propert...
@ Serializable
Prevents updating or inserting until the transaction is complete.