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.
PropertyDefinitionTests.cs
Go to the documentation of this file.
1using System;
2
4{
6 public sealed class PropertiesAndRegions
7 : BusinessBase<PropertiesAndRegions>
8 {
9 // This should fail because it isn't public (even if it is hidden in a region).
10 #region Properties
11 private static readonly PropertyInfo<Guid> MyGuidProperty = RegisterProperty<Guid>(c => c.MyGuid);
12 public Guid MyGuid => this.GetProperty(PropertiesAndRegions.MyGuidProperty);
13 #endregion
14 }
15
18 : CommandBase<PropertyDefinitionTests>
19 {
20 // This should fail because it isn't readonly
21 public static PropertyInfo<int> ResourceNotReadOnlyProperty = RegisterProperty<int>(c => c.ResourceNotReadOnly);
23 {
24 get { return ReadProperty(ResourceNotReadOnlyProperty); }
25 private set { LoadProperty(ResourceNotReadOnlyProperty, value); }
26 }
27
28 // This should fail because it isn't static
29 public readonly PropertyInfo<bool> ResourceNotStaticProperty = RegisterProperty<bool>(c => c.ResourceNotStatic);
31 {
32 get { return ReadProperty(ResourceNotStaticProperty); }
33 private set { LoadProperty(ResourceNotStaticProperty, value); }
34 }
35
36 // This should fail because it isn't public
37 private static readonly PropertyInfo<bool> ResourceNotPublicProperty = RegisterProperty<bool>(c => c.ResourceNotPublic);
39 {
40 get { return ReadProperty(ResourceNotPublicProperty); }
41 private set { LoadProperty(ResourceNotPublicProperty, value); }
42 }
43
44 // This should fail because it isn't anything
45 PropertyInfo<int> ResourceNotAnythingProperty = RegisterProperty<int>(c => c.ResourceNotAnything);
47 {
48 get { return ReadProperty(ResourceNotAnythingProperty); }
49 private set { LoadProperty(ResourceNotAnythingProperty, value); }
50 }
51
52 [Execute]
53 protected override void DataPortal_Execute() { }
54 }
55}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
This is the base class from which command objects will be derived.
Definition: CommandBase.cs:51
Maintains metadata about a property.
@ Serializable
Prevents updating or inserting until the transaction is complete.
@ Execute
Execute operation.