HI Я использую архитектуру 3 шины для моего проекта я получаю follpwing ошибку: Необработанное исключение типа "Получение сообщение об ошибке «Необработанное исключение типа StackOverflowException» между несколькими классами
namespace Dal_AddTranction
{
public class Add_Trancation_Dal
{
Add_Tranction_UI ObjAdd = new Add_Tranction_UI();
Add_Tranction_Bal objAddBal = new Add_Tranction_Bal();
string cs = ConfigurationManager.ConnectionStrings["adesh"].ConnectionString;
public Add_Trancation_Dal()
{
//
// TODO: Add constructor logic here
//
}
public void Add_Tranction(DateTime Date, string Particuler, decimal Price)
{
using (SqlConnection connection = new SqlConnection(cs))
{
connection.Open();
SqlCommand cmd = new SqlCommand("Asp_Add_Tranction", connection);
cmd.CommandType = CommandType.StoredProcedure;
try
{
cmd.Parameters.AddWithValue("@Date",Date);
cmd.Parameters.AddWithValue("@Particulare", Particuler);
cmd.Parameters.AddWithValue("@Price", Price);
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
throw ex;
}
}
}
}
}
дает необработанное исключение типа 'System.StackOverflowException' произошло в App_Code.hup8rwkz.dll
Здесь находятся самые Add_Tranction_UI и Add_Tranction_Bal классы:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Dal_AddTranction;
using Bal_AddTranction;
/// <summary>
/// Summary description for Add_Tranction_UI
/// </summary>
///
namespace UI_AddTranction
{
public class Add_Tranction_UI
{
public Add_Tranction_UI()
{
//
// TODO: Add constructor logic here
//
}
private DateTime _date;
public DateTime date
{
get
{
return _date;
}
set
{
_date = value;
}
}
private string _Particuler;
public string Particuler
{
get
{
return _Particuler;
}
set
{
_Particuler = value;
}
}
private decimal _Price;
public decimal Price
{
get
{
return _Price;
}
set
{
_Price = value;
}
}
}
}
***Bal***
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Dal_AddTranction;
using UI_AddTranction;
/// <summary>
/// Summary description for Add_Tranction_Bal
/// </summary>
///
namespace Bal_AddTranction
{
public class Add_Tranction_Bal
{
Add_Trancation_Dal objAddDal = new Add_Trancation_Dal();
public Add_Tranction_Bal()
{
//
// TODO: Add constructor logic here
//
}
public void Add_Tranction(Add_Tranction_UI objAddUI)
{
objAddDal.Add_Tranction(objAddUI);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Dal_AddTranction;
using UI_AddTranction;
using Bal_AddTranction;
public partial class Daily_ADD_Tranction : System.Web.UI.Page
{
Add_Tranction_UI objAddUI = new Add_Tranction_UI();
Add_Tranction_Bal objAddBal = new Add_Tranction_Bal();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void imgDate_Click(object sender, ImageClickEventArgs e)
{
if (clddate.Visible == true)
{
clddate.Visible = false;
}
else
{
clddate.Visible = true;
}
}
protected void clddate_SelectionChanged(object sender, EventArgs e)
{
txtDate.Text = clddate.SelectedDate.ToShortDateString();
clddate.Visible = false;
}
protected void btnAdd_Click(object sender, EventArgs e)
{
Add_Tranction();
lblMesssage.Text = "Trancation Added Sucessfully";
}
public void Add_Tranction()
{
try
{
objAddUI.date = Convert.ToDateTime(txtDate.Text);
objAddUI.Particuler = Convert.ToString(txtParticuler.Text);
objAddUI.Price = Convert.ToDecimal(txtPrice.Text);
objAddBal.Add_Tranction(objAddUI);
}
catch (Exception ex)
{
throw ex;
}
}
}
Из какой строки возникает StackOverflowException? –
Add_Tranction_UI ObjAdd = new Add_Tranction_UI(); –
from ths line @ Kevin Chen –