How to solve out of memory exception error in Entity FramWork?
- by programmerist
Hello; these below codes give whole data of my Rehber datas. But if i want to show web page via Gridview send me out of memory exception error.
GenoTip.BAL:
public static List<Rehber> GetAllDataOfRehber()
{
using (GenoTipSatisEntities genSatisCtx = new GenoTipSatisEntities())
{
ObjectQuery<Rehber> rehber = genSatisCtx.Rehber;
return rehber.ToList();
}
}
if i bind data directly dummy gridview like that no problem occures every thing is great!!!
<asp:GridView ID="gwRehber" runat="server">
</asp:GridView>
if above codes send data to Satis.aspx page:
using GenoTip.BAL;
namespace GenoTip.Web.ContentPages.Satis
{
public partial class Satis : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
gwRehber.DataSource = SatisServices.GetAllDataOfRehber();
gwRehber.DataBind();
//gwRehber.Columns[0].Visible = false;
}
}
}
}
but i rearranged my gridview send me out of memory exception!!!! i need this arrangenment to show deta!!!
<asp:GridView ID="gwRehber" runat="server">
<Columns>
<%-- <asp:TemplateField>
<ItemTemplate>
<asp:Button runat="server" ID="btnID" CommandName="select" CommandArgument='<%# Eval("ID") %>' Text="Seç" />
</ItemTemplate>
</asp:TemplateField>--%>
<asp:BoundField DataField="Ad" HeaderText="Ad" />
<asp:BoundField DataField="BireyID" HeaderText="BireyID" Visible="false" />
<asp:BoundField DataField="Degistiren" HeaderText="Degistiren" />
<asp:BoundField DataField="EklemeTarihi" HeaderText="EklemeTarihi" />
<asp:BoundField DataField="DegistirmeTarihi" HeaderText="Degistirme Tarihi" Visible="false" />
<asp:BoundField DataField="Ekleyen" HeaderText="Ekleyen" />
<asp:BoundField DataField="ID" HeaderText="ID" Visible="false" />
<asp:BoundField DataField="Imza" HeaderText="Imza" />
<asp:BoundField DataField="KurumID" HeaderText="KurumID" Visible="false" />
</Columns>
</asp:GridView>
Error Detail :
[OutOfMemoryException: 'System.OutOfMemoryException' türünde özel durum olusturuldu.]
System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity) +29
System.Convert.ToBase64String(Byte[] inArray, Int32 offset, Int32 length, Base64FormattingOptions options) +146
System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph) +183
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Serialize(Object state) +4
System.Web.UI.Util.SerializeWithAssert(IStateFormatter formatter, Object stateGraph) +37
System.Web.UI.HiddenFieldPageStatePersister.Save() +79
System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state) +105
System.Web.UI.Page.SaveAllState() +236
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1099