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.
Server/DataPortalException.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="DataPortalException.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>This exception is returned from the </summary>
7//-----------------------------------------------------------------------
8using System;
9
10namespace Csla.Server
11{
17 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")]
19 public class DataPortalException : Exception
20 {
21 private DataPortalResult _result;
22 private string _innerStackTrace;
23
28 {
29 get { return _result; }
30 }
31
36 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)")]
37 public override string StackTrace
38 {
39 get { return String.Format("{0}{1}{2}",
40 _innerStackTrace, Environment.NewLine, base.StackTrace); }
41 }
42
50 string message, Exception ex, DataPortalResult result)
51 : base(message, ex)
52 {
53 _innerStackTrace = ex.StackTrace;
54 _result = result;
55 }
56
57#if !(ANDROID || IOS) && !NETFX_CORE
63 protected DataPortalException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
64 : base(info, context)
65 {
66 _result = (DataPortalResult)info.GetValue(
67 "_result", typeof(DataPortalResult));
68 _innerStackTrace = info.GetString("_innerStackTrace");
69 }
70
76 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods")]
77#if !NET5_0
78 [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.LinkDemand, Flags = System.Security.Permissions.SecurityPermissionFlag.SerializationFormatter)]
79 [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags = System.Security.Permissions.SecurityPermissionFlag.SerializationFormatter)]
80#endif
81 public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
82 {
83 base.GetObjectData(info, context);
84 info.AddValue("_result", _result);
85 info.AddValue("_innerStackTrace", _innerStackTrace);
86 }
87#endif
88 }
89}
This exception is returned from the server-side DataPortal and contains the exception and context dat...
DataPortalException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
Creates an instance of the object for serialization.
DataPortalResult Result
Returns the DataPortalResult object from the server.
override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
Serializes the object.
DataPortalException(string message, Exception ex, DataPortalResult result)
Creates an instance of the object.
override string StackTrace
Get the server-side stack trace from the original exception.
Returns data from the server-side DataPortal to the client-side DataPortal.
@ Serializable
Prevents updating or inserting until the transaction is complete.