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.
Csla.test/ObjectFactory/CommandObject.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="CommandObject.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;
12
14{
15 [Csla.Server.ObjectFactory("Csla.Test.ObjectFactory.CommandObjectFactory, Csla.Tests")]
17 public class CommandObject : CommandBase<CommandObject>
18 {
19 #region Authorization Methods
20
21 public static bool CanExecuteCommand()
22 {
23 return true;
24 }
25
26 #endregion
27
28 #region Factory Methods
29
30 public static bool Execute(IDataPortal<CommandObject> dataPortal)
31 {
32 if (!CanExecuteCommand())
33 throw new Csla.Security.SecurityException("Not authorized to execute command");
34
35 CommandObject cmd = dataPortal.Create();
36 cmd.BeforeServer();
37 cmd = dataPortal.Execute(cmd);
38 cmd.AfterServer();
39 return cmd.Result;
40 }
41
42 #endregion
43
44 #region Client-side Code
45
46 public static readonly PropertyInfo<bool> ResultProperty = RegisterProperty<CommandObject, bool>(p => p.Result);
47 public bool Result
48 {
49 get { return ReadProperty<bool>(ResultProperty); }
50 set { LoadProperty<bool>(ResultProperty, value); }
51 }
52
53 private void BeforeServer()
54 {
55 }
56
57 private void AfterServer()
58 {
59 }
60
61 #endregion
62
63 }
64}
This is the base class from which command objects will be derived.
Definition: CommandBase.cs:51
Maintains metadata about a property.
Base class to be used when creating a data portal factory object.
static bool Execute(IDataPortal< CommandObject > dataPortal)
Interface defining the members of the data portal type.
Definition: IDataPortalT.cs:17
object Execute(object obj)
Called to execute a Command object on the server.
object Create(params object[] criteria)
Called by a factory method in a business class to create a new object, which is loaded with default v...
@ Serializable
Prevents updating or inserting until the transaction is complete.