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.
Legacy.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="Legacy.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 [Serializable()]
15 class Legacy : BusinessBase<Legacy>
16 {
17 #region Business Methods
18
19 public static PropertyInfo<int> IdProperty = RegisterProperty<int>(c => c.Id, RelationshipTypes.PrivateField);
20 private int _id = IdProperty.DefaultValue;
21 public int Id
22 {
23 get { return GetProperty(IdProperty, _id); }
24 set { SetProperty(IdProperty, ref _id, value); }
25 }
26
27 #endregion
28
29 #region Data Access
30
31 [Serializable()]
32 internal class Criteria
33 {
34 private int _id;
35 public int Id
36 {
37 get { return _id; }
38 }
39 public Criteria(int id)
40 { _id = id; }
41 }
42
43 [Create]
44 protected void DataPortal_Create()
45 {
46 _id = 0;
48 TestResults.Add("Legacy", "Created");
49 }
50
51 protected void DataPortal_Fetch(object criteria)
52 {
53 _id = ((Criteria)criteria).Id;
55 TestResults.Add("Legacy", "Fetched");
56 }
57
58 [Insert]
59 protected void DataPortal_Insert()
60 {
62 TestResults.Add("Legacy", "Inserted");
63 }
64
65 [Update]
66 protected void DataPortal_Update()
67 {
69 TestResults.Add("Legacy", "Updated");
70 }
71
72 [Delete]
73 protected void DataPortal_Delete(object criteria)
74 {
76 TestResults.Add("Legacy", "Deleted");
77 }
78
79 [DeleteSelf]
80 protected void DataPortal_DeleteSelf()
81 {
83 TestResults.Add("Legacy", "SelfDeleted");
84 }
85
86 #endregion
87 }
88}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
Maintains metadata about a property.
void DataPortal_Delete(object criteria)
Definition: Legacy.cs:73
void DataPortal_Fetch(object criteria)
Definition: Legacy.cs:51
static PropertyInfo< int > IdProperty
Definition: Legacy.cs:19
Static dictionary-like class that offers similar functionality to GlobalContext This is used in tests...
Definition: TestResults.cs:21
static void Reinitialise()
Reinitialise the dictionary, clearing any existing results, ready for the next test
Definition: TestResults.cs:69
static void Add(string key, string value)
Add an item to the test results, to indicate an outcome of a particular operation
Definition: TestResults.cs:29
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.
@ Update
Update operation (includes insert, update and delete self).
@ Create
Create operation.
@ Delete
Delete operation.