v4 Datasource2 SelectParameters not working?

Posts   
 
    
tnero
User
Posts: 18
Joined: 09-Apr-2013
# Posted on: 09-Apr-2013 17:05:17   

Hi,

I am testing the latest release v4 (currently using 3.1) and after the update I'm having issues with code that works in v3.1 relating to SelectParameters for typedlists bound to grids

So here is a simple example:

   <llblgenpro:LLBLGenProDataSource2 ID="dataSource" runat="server" DataContainerType="TypedList"
                AdapterTypeName="XX.Data.DatabaseSpecific.DataAccessAdapter, XX.DataDBSpecific"
                TypedListTypeName="XX.Data.TypedListClasses.ItemTLTypedList, XX.Data">
       <SelectParameters>
         <asp:QueryStringParameter Name="Code" QueryStringField="Code" DbType="String" />
       </SelectParameters>
            </llblgenpro:LLBLGenProDataSource2>

The grid is showing all items and nothing that i do in the select parameters makes a difference.

I made a simple test page with no code behind and the behaviour is not correct.

I am trying this on 2 different projects converting from v3.1 to 4 and both are exhibiting this issue.

Can you test on your side that v4 is obeying these paramaters?

tnero
User
Posts: 18
Joined: 09-Apr-2013
# Posted on: 09-Apr-2013 17:31:03   

It's definitely ignoring it in v4.

The ItemId below is a Guid:

If i set it up incorrectly as per

<asp:QueryStringParameter Name="ItemId" QueryStringField="ItemId" Type="String" DefaultValue="axx" />

in v3.1 - it throws an exception "Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)."

in v4 - it does nothing... just binds unfiltered list

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 09-Apr-2013 18:08:21   

Sounds like a bug. Could you paste the HTML of the page you used for testing? Not sure whether the guid issue is related or not, but we'll look into that as well. If we can reproduce it, it will be tomorrow (wednesday) before a fix is available.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 09-Apr-2013 18:54:46   

Can't reproduce it.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="SD.LLBLGen.Pro.ORMSupportClasses.Web" Namespace="SD.LLBLGen.Pro.ORMSupportClasses" TagPrefix="llblgenpro" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        All customers:<br />
        Customers:
        <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="customerDS" 
            DataTextField="CompanyName" DataValueField="CustomerId" AutoPostBack="True">
        </asp:DropDownList><br />
        ShipCountry:
        <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True">
            <asp:ListItem>Spain</asp:ListItem>
            <asp:ListItem>Germany</asp:ListItem>
        </asp:DropDownList><br />
        
        <llblgenpro:llblgenprodatasource2 id="customerDS" runat="server" 
            cachelocation="Session" datacontainertype="EntityCollection" enablepaging="True" 
            AdapterTypeName="NW.DatabaseSpecific.DataAccessAdapter, NWDBSpecific" 
            EntityFactoryTypeName="NW.FactoryClasses.CustomerEntityFactory, NW">
        </llblgenpro:llblgenprodatasource2>
        
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="orderDS" 
            DataKeyNames="OrderId" AllowPaging="True" PageSize="5">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="ShipAddress" HeaderText="ShipAddress" SortExpression="ShipAddress" />
                <asp:BoundField DataField="ShipName" HeaderText="ShipName" SortExpression="ShipName" />
                <asp:BoundField DataField="ShipCountry" HeaderText="ShipCountry" SortExpression="ShipCountry" />
                <asp:BoundField DataField="CustomerId" HeaderText="CustomerId" SortExpression="CustomerId" />
                <asp:BoundField DataField="ShipRegion" HeaderText="ShipRegion" SortExpression="ShipRegion" />
                <asp:BoundField DataField="ShipCity" HeaderText="ShipCity" SortExpression="ShipCity" />
                <asp:BoundField DataField="OrderId" HeaderText="OrderId" SortExpression="OrderId" />
                <asp:BoundField DataField="ShipPostalCode" HeaderText="ShipPostalCode" SortExpression="ShipPostalCode" />
            </Columns>
        </asp:GridView>
        
        <llblgenpro:llblgenprodatasource2 id="orderDS" runat="server" cachelocation="Session" 
            datacontainertype="EntityCollection" enablepaging="True" 
            AdapterTypeName="NW.DatabaseSpecific.DataAccessAdapter, NWDBSpecific" 
            EntityFactoryTypeName="NW.FactoryClasses.OrderEntityFactory, NW">
            <SelectParameters>
                <asp:ControlParameter ControlID="DropDownList1" Name="CustomerId" 
                    PropertyName="SelectedValue" Type="String" />
                <asp:ControlParameter ControlID="DropDownList2" Name="ShipCountry" 
                    PropertyName="SelectedValue" Type="String" />
            </SelectParameters>
        </llblgenpro:llblgenprodatasource2>
    </form>
</body>
</html>

Works fine. Filters are created based on the selected values in the select parameters.

So I'm not sure what exactly makes your test form fail. If you could show us a test form that would be great simple_smile (with the aspects of the entity/ies in the form so we can reproduce it here). I used northwind in the above testform. It's from the docs.

Frans Bouma | Lead developer LLBLGen Pro
tnero
User
Posts: 18
Joined: 09-Apr-2013
# Posted on: 09-Apr-2013 19:48:40   

Okay, well im trying to create a new project from scratch using Northwinds. But for the second time now when pressing f7 to generate, prior to seeing the generate message I get an exception:

LLBLGen Pro version 4.0. Build April 6th, 2013
-----[Core exception]--------------------
   at SD.LLBLGen.Pro.ApplicationCore.EntityModel.EntityModelGraph.Validate()
   at SD.LLBLGen.Pro.ApplicationCore.ProjectClasses.Project.ValidateModelAndMappingData()
   at SD.LLBLGen.Pro.ApplicationCore.ProjectClasses.Project.RunValidationAndMetaDataAdjustProcess(Boolean validationOnly)
   at SD.LLBLGen.Pro.ApplicationCore.ProjectClasses.Project.ValidateAndOptionallyAdjustMetaData(Boolean validationOnly)
   at SD.LLBLGen.Pro.Gui.Classes.GuiController.<>c__DisplayClassec.<PerformProjectValidationAndOptionallyMetaDataAdjustmentAction>b__e7()
   at SD.Tools.Algorithmia.Commands.Command`1.Do() in c:\Myprojects\VS.NET Projects\Algorithmia_hg\SD.Tools.Algorithmia\Commands\Command.cs:line 178
   at SD.Tools.Algorithmia.Commands.CommandQueue.PerformDoRedoCommand(Boolean performRedo) in c:\Myprojects\VS.NET Projects\Algorithmia_hg\SD.Tools.Algorithmia\Commands\CommandQueue.cs:line 151
   at SD.Tools.Algorithmia.Commands.CommandQueue.DoCurrentCommand() in c:\Myprojects\VS.NET Projects\Algorithmia_hg\SD.Tools.Algorithmia\Commands\CommandQueue.cs:line 127
   at SD.Tools.Algorithmia.Commands.CommandQueueManager.EnqueueAndRunCommand(CommandBase toEnqueueAndRun) in c:\Myprojects\VS.NET Projects\Algorithmia_hg\SD.Tools.Algorithmia\Commands\CommandQueueManager.cs:line 394
   at SD.LLBLGen.Pro.Gui.Classes.GuiController.PerformProjectValidationAndOptionallyMetaDataAdjustmentAction(Boolean validationOnly, Boolean showMessageBoxOnZeroErrors)
   at SD.LLBLGen.Pro.Gui.Classes.GuiController.PerformGenerateSourceCodeAction()
   at SD.LLBLGen.Pro.Gui.Forms.MainWindow.HandleMainMenuCommand(CommandEventArgs e)
   at Janus.Windows.UI.CommandBars.UICommandBar.a(Shortcut , UICommandCollection , Control , Message )
   at Janus.Windows.UI.CommandBars.UICommandBar.a(Shortcut , UICommandCollection , Control , Message )
   at Janus.Windows.UI.CommandBars.UICommandManager.a(Shortcut , Control , Message )
   at Janus.Windows.UI.CommandBars.UICommandManager.a(Message& )
   at System.Windows.Forms.Application.ThreadContext.ProcessFilters(MSG& msg, Boolean& modified)
   at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at SD.LLBLGen.Pro.Gui.Program.DoApplicationStart(String appStartPath, String fileToLoad, Boolean startedFromVSNet)
   at SD.LLBLGen.Pro.Gui.Program.Main(String[] args)

I will try some more rage

Your example - can you please use Querystring and Session SelectParameters since those are specifically the ones which are giving me problems

[Edit] The exception happened twice when creating new project and trying to generate. First time didnt save my project, second time i did, but exception still happened.

On third time when opening the saved project then it showed generate window okay...

Busy with making the example code for original problem...

tnero
User
Posts: 18
Joined: 09-Apr-2013
# Posted on: 09-Apr-2013 20:05:39   

Amen - it does NOT work wink

The sln file is in the Webapplication1 folder - excuse the nasty demo..

Run that or just make a Typed list with Customer table (all fields) and the following html:


 <div>
      <a href="default.aspx?customerid=ALFKI">Filter to ALFKI</a>
    </div>
    <llblgenpro:LLBLGenProDataSource2 ID="ds" runat="server" AdapterTypeName="NW.DatabaseSpecific.DataAccessAdapter, NWDBSpecific" DataContainerType="TypedList" TypedListTypeName="NW.TypedListClasses.CustomerTLTypedList, NW">
      <SelectParameters>
        <asp:QueryStringParameter Name="CustomerId" QueryStringField="CustomerId" Type="String" />
      </SelectParameters>
    </llblgenpro:LLBLGenProDataSource2>

    <asp:GridView DataSourceID="ds" runat="server" AutoGenerateColumns="true" />

Attachments
Filename File size Added on Approval
coolj.zip 147,321 09-Apr-2013 20:06.13 Approved
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 10-Apr-2013 08:56:14   

tnero wrote:

Okay, well im trying to create a new project from scratch using Northwinds. But for the second time now when pressing f7 to generate, prior to seeing the generate message I get an exception:

LLBLGen Pro version 4.0. Build April 6th, 2013
-----[Core exception]--------------------
   at SD.LLBLGen.Pro.ApplicationCore.EntityModel.EntityModelGraph.Validate()
   at SD.LLBLGen.Pro.ApplicationCore.ProjectClasses.Project.ValidateModelAndMappingData()
   at SD.LLBLGen.Pro.ApplicationCore.ProjectClasses.Project.RunValidationAndMetaDataAdjustProcess(Boolean validationOnly)
   at SD.LLBLGen.Pro.ApplicationCore.ProjectClasses.Project.ValidateAndOptionallyAdjustMetaData(Boolean validationOnly)
   at SD.LLBLGen.Pro.Gui.Classes.GuiController.<>c__DisplayClassec.<PerformProjectValidationAndOptionallyMetaDataAdjustmentAction>b__e7()
   at SD.Tools.Algorithmia.Commands.Command`1.Do() in c:\Myprojects\VS.NET Projects\Algorithmia_hg\SD.Tools.Algorithmia\Commands\Command.cs:line 178
   at SD.Tools.Algorithmia.Commands.CommandQueue.PerformDoRedoCommand(Boolean performRedo) in c:\Myprojects\VS.NET Projects\Algorithmia_hg\SD.Tools.Algorithmia\Commands\CommandQueue.cs:line 151
   at SD.Tools.Algorithmia.Commands.CommandQueue.DoCurrentCommand() in c:\Myprojects\VS.NET Projects\Algorithmia_hg\SD.Tools.Algorithmia\Commands\CommandQueue.cs:line 127
   at SD.Tools.Algorithmia.Commands.CommandQueueManager.EnqueueAndRunCommand(CommandBase toEnqueueAndRun) in c:\Myprojects\VS.NET Projects\Algorithmia_hg\SD.Tools.Algorithmia\Commands\CommandQueueManager.cs:line 394
   at SD.LLBLGen.Pro.Gui.Classes.GuiController.PerformProjectValidationAndOptionallyMetaDataAdjustmentAction(Boolean validationOnly, Boolean showMessageBoxOnZeroErrors)
   at SD.LLBLGen.Pro.Gui.Classes.GuiController.PerformGenerateSourceCodeAction()
   at SD.LLBLGen.Pro.Gui.Forms.MainWindow.HandleMainMenuCommand(CommandEventArgs e)
   at Janus.Windows.UI.CommandBars.UICommandBar.a(Shortcut , UICommandCollection , Control , Message )
   at Janus.Windows.UI.CommandBars.UICommandBar.a(Shortcut , UICommandCollection , Control , Message )
   at Janus.Windows.UI.CommandBars.UICommandManager.a(Shortcut , Control , Message )
   at Janus.Windows.UI.CommandBars.UICommandManager.a(Message& )
   at System.Windows.Forms.Application.ThreadContext.ProcessFilters(MSG& msg, Boolean& modified)
   at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at SD.LLBLGen.Pro.Gui.Program.DoApplicationStart(String appStartPath, String fileToLoad, Boolean startedFromVSNet)
   at SD.LLBLGen.Pro.Gui.Program.Main(String[] args)

I will try some more rage

Your example - can you please use Querystring and Session SelectParameters since those are specifically the ones which are giving me problems

[Edit] The exception happened twice when creating new project and trying to generate. First time didnt save my project, second time i did, but exception still happened.

On third time when opening the saved project then it showed generate window okay... Busy with making the example code for original problem...

Yep, I ran into the exact same exception when creating my test flushed . I fixed it right away and uploaded a new installer yesterday. Please download the new installer. Loading a project also makes this go away.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 10-Apr-2013 08:56:40   

tnero wrote:

Amen - it does NOT work wink

The sln file is in the Webapplication1 folder - excuse the nasty demo..

Run that or just make a Typed list with Customer table (all fields) and the following html:


 <div>
      <a href="default.aspx?customerid=ALFKI">Filter to ALFKI</a>
    </div>
    <llblgenpro:LLBLGenProDataSource2 ID="ds" runat="server" AdapterTypeName="NW.DatabaseSpecific.DataAccessAdapter, NWDBSpecific" DataContainerType="TypedList" TypedListTypeName="NW.TypedListClasses.CustomerTLTypedList, NW">
      <SelectParameters>
        <asp:QueryStringParameter Name="CustomerId" QueryStringField="CustomerId" Type="String" />
      </SelectParameters>
    </llblgenpro:LLBLGenProDataSource2>

    <asp:GridView DataSourceID="ds" runat="server" AutoGenerateColumns="true" />

Ok, we'll look into this!

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 10-Apr-2013 09:55:41   

Bug in EntityFields(2) class. fields[name] returns null in all cases if fields isn't part of entity, in a particular situation. Fields[name] is used to find the field based on the selectparameter. It fails in a typedlist situation and works in an entity situation, hence why my repro worked but yours didn't.

Working on fix.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 10-Apr-2013 10:18:47   

Fixed. See attached dll. New build of installer will be released shortly.

Attachments
Filename File size Added on Approval
SD.LLBLGen.Pro.ORMSupportClasses.zip 409,270 10-Apr-2013 10:18.56 Approved
Frans Bouma | Lead developer LLBLGen Pro
tnero
User
Posts: 18
Joined: 09-Apr-2013
# Posted on: 10-Apr-2013 10:57:42   

Thanks!

All working now - doing a few more tests and then buying the upgrade wink

Thanks again for speedy solution!!