One of these days I will find a genuine problem...
Why is it that the EntityInserted event is not fired when LivePersistance=false.
When LivePersistance=true: EntityInserting, then EntityInserted both fire as expected.
When LivePersistance=false: EntityInserting, then PerformWork fire. As it fires EntityInserting it must know that an entity is being inserted, so why does it not fire EntityInserted?
The help(Generated code - Databinding with ASP.NET 2.0, Adapter) says "In any case, the changed event is raised so the bound control(s) can refetch the data from the LLBLGenProDataSource2 control." Where is this changed event?
aspx code:
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp
etailsView ID="DetailsView1" runat="server"
AutoGenerateRows="False" DataSourceID="detailsDataSource" DefaultMode="Insert"
CssClass="detailsview"
GridLines="None">
<Fields>
<asp:BoundField DataField="PageText" HeaderText="Text" SortExpression="PageText" />
<asp:CommandField ShowInsertButton="True" />
</Fields>
</asp
etailsView>
</ContentTemplate>
</asp:UpdatePanel>
<llblgenpro:LLBLGenProDataSource2 ID="detailsDataSource" runat="server"
AdapterTypeName="em.DatabaseSpecific.DataAccessAdapter, emDBSpecific"
DataContainerType="EntityCollection"
EntityFactoryTypeName="em.FactoryClasses.PageEntityFactory, em"
onentityinserted="detailsDataSource_EntityInserted"
onentityinserting="detailsDataSource_EntityInserting"
ThrowExceptionOnIllegalFieldInput="True" LivePersistence="True"
onperformwork="detailsDataSource_PerformWork">
</llblgenpro:LLBLGenProDataSource2>
c# code
protected void detailsDataSource_EntityInserted(object sender, DataSourceActionEventArgs e)
{
}
protected void detailsDataSource_EntityInserting(object sender, CancelableDataSourceActionEventArgs e)
{
var newPage = (PageEntity)e.InvolvedEntity;
newPage.Order = 1;
}
protected void detailsDataSource_PerformWork(object sender, PerformWorkEventArgs2 e)
{
e.Uow.Commit(new DataAccessAdapter());
}