CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
TransactionalAttribute.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="TransactionalAttribute.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Marks a DataPortal_XYZ method to run within</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.Transactions;
10
11namespace Csla
12{
38 [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
39 public sealed class TransactionalAttribute : Attribute
40 {
41
48 {
49 }
50
59 {
60 TransactionType = transactionType;
61#if NETSTANDARD2_0 || NET5_0
62 if (transactionType == TransactionalTypes.TransactionScope)
63#else
64 if (transactionType == TransactionalTypes.TransactionScope ||
65 transactionType == TransactionalTypes.EnterpriseServices)
66#endif
67 {
68 TransactionIsolationLevel = ApplicationContext.DefaultTransactionIsolationLevel;
69 TimeoutInSeconds = ApplicationContext.DefaultTransactionTimeoutInSeconds;
70 }
71 }
72
89 TransactionalTypes transactionType,
90 TransactionIsolationLevel transactionIsolationLevel,
91 int timeoutInSeconds)
92 {
93 TransactionType = transactionType;
94 TransactionIsolationLevel = transactionIsolationLevel;
95 TimeoutInSeconds = timeoutInSeconds;
96 }
97
111 TransactionalTypes transactionType,
112 TransactionIsolationLevel transactionIsolationLevel)
113 {
114 TransactionType = transactionType;
115 TransactionIsolationLevel = transactionIsolationLevel;
116#if NETSTANDARD2_0 || NET5_0
117 if (transactionType == TransactionalTypes.TransactionScope)
118#else
119 if (transactionType == TransactionalTypes.TransactionScope ||
120 transactionType == TransactionalTypes.EnterpriseServices)
121#endif
122 {
123 TimeoutInSeconds = ApplicationContext.DefaultTransactionTimeoutInSeconds;
124 }
125 }
126
144 TransactionalTypes transactionType,
145 TransactionIsolationLevel transactionIsolationLevel,
146 TransactionScopeAsyncFlowOption asyncFlowOption)
147 {
148 TransactionType = transactionType;
149 TransactionIsolationLevel = transactionIsolationLevel;
150#if NETSTANDARD2_0 || NET5_0
151 if (transactionType == TransactionalTypes.TransactionScope)
152#else
153 if (transactionType == TransactionalTypes.TransactionScope ||
154 transactionType == TransactionalTypes.EnterpriseServices)
155#endif
156 {
157 TimeoutInSeconds = ApplicationContext.DefaultTransactionTimeoutInSeconds;
158 }
159 AsyncFlowOption = asyncFlowOption;
160 }
161
166 public TransactionalTypes TransactionType { get; private set; }
167
174
181 public int TimeoutInSeconds { get; private set; }
182
186 public TransactionScopeAsyncFlowOption AsyncFlowOption { get; private set; } =
187 TransactionScopeAsyncFlowOption.Suppress;
188 }
189}
Marks a DataPortal_XYZ method to run within the specified transactional context.
int TimeoutInSeconds
Timeout for transaction, in seconds
TransactionalAttribute(TransactionalTypes transactionType, TransactionIsolationLevel transactionIsolationLevel)
Marks a method to run within the specified type of transactional context.
TransactionalAttribute(TransactionalTypes transactionType)
Marks a method to run within the specified type of transactional context.
TransactionalTypes TransactionType
Gets the type of transaction requested by the business object method.
TransactionalAttribute(TransactionalTypes transactionType, TransactionIsolationLevel transactionIsolationLevel, int timeoutInSeconds)
Marks a method to run within the specified type of transactional context.
TransactionalAttribute(TransactionalTypes transactionType, TransactionIsolationLevel transactionIsolationLevel, TransactionScopeAsyncFlowOption asyncFlowOption)
Marks a method to run within the specified type of transactional context.
TransactionalAttribute()
Marks a method to run within a COM+ transactional context.
TransactionScopeAsyncFlowOption AsyncFlowOption
Gets the AsyncFlowOption for this transaction
TransactionalTypes
Provides a list of possible transactional technologies to be used by the server-side DataPortal.
@ TransactionScope
Causes the server-side DataPortal to use System.Transactions TransactionScope style transactions.
TransactionIsolationLevel
Specifies an isolation level for transactions controlled by TransactionalAttribute