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.
LocationBusinessBase.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="LocationBusinessBase.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;
11using Csla;
13
15{
17#pragma warning disable CS0436 // Type conflicts with imported type
18 public class LocationBusinessBase: BusinessBase<LocationBusinessBase>
19#pragma warning restore CS0436 // Type conflicts with imported type
20 {
21
22 protected static PropertyInfo<string> DataProperty = RegisterProperty<string>(new PropertyInfo<string>("Data"));
23 public string Data
24 {
25 get { return GetProperty(DataProperty); }
26 set { SetProperty(DataProperty, value); }
27 }
28
29 private static PropertyInfo<string> NestedDataProperty = RegisterProperty<string>(c => c.NestedData);
30 public string NestedData
31 {
32 get { return GetProperty(NestedDataProperty); }
33 set { SetProperty(NestedDataProperty, value); }
34 }
35
36 protected static PropertyInfo<string> RuleProperty = RegisterProperty<string>(new PropertyInfo<string>("Rule"));
37 public string Rule
38 {
39 get { return GetProperty(RuleProperty); }
40 set { SetProperty(RuleProperty, value); }
41 }
42
43#pragma warning disable CS0436 // Type conflicts with imported type
45#pragma warning restore CS0436 // Type conflicts with imported type
46 {
47#pragma warning disable CS0436 // Type conflicts with imported type
48 return dataPortal.Fetch();
49#pragma warning restore CS0436 // Type conflicts with imported type
50 }
51
52 protected override void AddBusinessRules()
53 {
54 BusinessRules.AddRule(new CheckRule { PrimaryProperty = DataProperty });
55 }
56
57 public class CheckRule : Rules.BusinessRule
58 {
59 protected override void Execute(Rules.IRuleContext context)
60 {
61#pragma warning disable CS0436 // Type conflicts with imported type
62 // TODO: Not sure how to replicate this functionality in Csla 6
63 // ((LocationBusinessBase)context.Target).Rule = ApplicationContext.LogicalExecutionLocation.ToString();
64#pragma warning restore CS0436 // Type conflicts with imported type
65 }
66 }
67
68 [Fetch]
69 protected void Fetch([Inject]IDataPortal<LocationBusinessBase> dataPortal)
70 {
72#pragma warning disable CS0436 // Type conflicts with imported type
73 var nested = dataPortal.Fetch(123);
74#pragma warning restore CS0436 // Type conflicts with imported type
75 NestedData = nested.Data;
76 }
77
78 [Fetch]
79 protected void Fetch(int criteria)
80 {
82 }
83
84 [Update]
85 protected void DataPortal_Update()
86 {
87
88 }
89
90 }
91}
Provides consistent context information between the client and server DataPortal objects.
LogicalExecutionLocations LogicalExecutionLocation
Return Logical Execution Location - Client or Server This is applicable to Local mode as well
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
Maintains metadata about a property.
static LocationBusinessBase GetLocationBusinessBase(IDataPortal< LocationBusinessBase > dataPortal)
void Fetch([Inject]IDataPortal< LocationBusinessBase > dataPortal)
Interface defining the members of the data portal type.
Definition: IDataPortalT.cs:17
object Fetch(params object[] criteria)
Called by a factory method in a business class to retrieve an object, which is loaded with values fro...
@ Serializable
Prevents updating or inserting until the transaction is complete.
@ Update
Update operation (includes insert, update and delete self).