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.
TransactionContextUser.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="TransactionContextUser.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 System.Data;
12using System.Data.SqlClient;
13using System.Configuration;
14using Csla.Data;
15
16namespace Csla.Test.Data
17{
18 [Serializable()]
19 public class TransactionContextUser : BusinessBase<TransactionContextUser>
20 {
21 private static PropertyInfo<string> firstNameProperty = RegisterProperty<string>(new PropertyInfo<string>("FirstName"));
22
23 public string FirstName
24 {
25 get { return GetProperty(firstNameProperty); }
26 set { SetProperty(firstNameProperty, value); }
27 }
28 private static PropertyInfo<string> lastNameProperty = RegisterProperty<string>(new PropertyInfo<string>("LastName"));
29 public string LastName
30 {
31 get { return GetProperty(lastNameProperty); }
32 set { SetProperty(lastNameProperty, value); }
33 }
34
35 private static PropertyInfo<string> smallColumnProperty = RegisterProperty<string>(new PropertyInfo<string>("SmallColumn"));
36 public string SmallColumn
37 {
38 get { return GetProperty(smallColumnProperty); }
39 set { SetProperty(smallColumnProperty, value); }
40 }
41
43 {
45 }
46
48 {
50 }
51
52
53 [RunLocal]
54 [Create]
55 protected void DataPortal_Create()
56 {
57
58 }
59
60 protected void Child_Fetch(Csla.Data.SafeDataReader reader)
61 {
62 LoadProperty(firstNameProperty, reader.GetString("FirstName"));
63 LoadProperty(lastNameProperty, reader.GetString("LastName"));
64 LoadProperty(smallColumnProperty, reader.GetString("SmallColumn"));
65 }
66
67 protected void Child_DeleteSelf()
68 {
70 {
71 using (SqlCommand command = new SqlCommand("Delete From Table2 Where FirstName = '" + ReadProperty(firstNameProperty) + "' And LastName = '" + ReadProperty(lastNameProperty) + "' And SmallColumn = '" + ReadProperty(smallColumnProperty) + "'", manager.Transaction.Connection, manager.Transaction))
72 {
73 command.ExecuteNonQuery();
74 }
75 }
76 }
77
79 {
81 {
82 using (SqlCommand command = new SqlCommand("INSERT INTO Table2(FirstName, LastName, SmallColumn) VALUES('" + ReadProperty(firstNameProperty) + "', '" + ReadProperty(lastNameProperty) + "', '" + ReadProperty(smallColumnProperty) + "')", manager.Transaction.Connection, manager.Transaction))
83 {
84 command.ExecuteNonQuery();
85 }
86 }
87 }
88
89 }
90}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
This is an IDataReader that 'fixes' any null values before they are returned to our business code.
Provides an automated way to reuse open database connections and associated ADO.NET transactions with...
T Transaction
Gets a reference to the current ADO.NET transaction object.
TransactionManager< C, T > GetManager(string database)
Gets the TransactionManager object for the specified database.
Client side data portal used for making asynchronous data portal calls in .NET.
Definition: DataPortalT.cs:24
T Create(params object[] criteria)
Called by a factory method in a business class to create a new object, which is loaded with default v...
Definition: DataPortalT.cs:151
T FetchChild()
Fetches an existing child business object.
Definition: DataPortalT.cs:685
Maintains metadata about a property.
void Child_Fetch(Csla.Data.SafeDataReader reader)
static TransactionContextUser NewTransactionContextUser()
void Child_Insert(TransactionContextUserList parent)
static TransactionContextUser GetTransactionContextUser(Csla.Data.SafeDataReader reader)
static string DataPortalTestDatabase
@ Serializable
Prevents updating or inserting until the transaction is complete.
@ Create
Create operation.