StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



ListView, BO, and passing a Dictionary to the...Expand / Collapse
Author
Message
Posted 02/10/2010 1:24:09 PM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 2 days ago @ 7:16:53 PM
Posts: 78, Visits: 587
H-

Having an issue filling a listView based on a BO filled using a stored procedure. Will try to distill the scenario below, hopefully not omitting any key elements.

--- Intro --------------------------------
The BO has a fill method with the following signature.

public void FillAfterRefresh(Dictionary tdictParameters)

The dictionary passed in includes values used as parameters in the call to the stored procedure.

The form has a listVview on it, that I want to populate using the result set returned by the stored procedure. It is set to manually populate, and I've specified the appropriate BO class and the above fill method.

For testing/debugging purposes I've thrown a few controls on the form as well and bound them to BO fields.

--- Observations/Problems ---------------------------------
1.) If I drop an instance of the BO onto the form, and call the above Fill method, passing a reference to a dictionary in as the lone argument, the fill works great (confirmed via the debugger and by being able to view the results in the test controls on the form).

2.) When I attempt to set the List View Population Settings, I see my fill method, but the parameter shows as (Dictionary`2). Not sure what's up with this? (But, willing to run it anyway since it compiles.) Note: See attached PNG.

3.) If I try to call the listview's requery, passing in the dictionary (either in the requery call or in the ListPopulating event using e.Parameters[0].Value = this.oDictUserInfo I get an immediate error at runtime:

Dynamically populating the ListView failed. Could not create and fill the business object of type 'IndexReviewSystem.Business_Objects.Reporting_Objects.boIRSPredictiveCompositionNullProblems'

Inner Exception Message: "Dynamically populating the ListView failed. Type 'System.Collections.Generic.Dictionary`2[[System.String' could not be found."

Can someone help me make sense of this?

I feel I have a workaround as I can put a BO on the form, fill it, then copy the filled datatable to the listview's internal datatable. I feel, however, I shouldn't need to do that… I'd really like to understand what's going on.

TIA


________________
_____/ Regards,
____/ al


  Post Attachments 
tmp2-10-2010 12-03-40 PM.png (31 views, 14.84 KB)
Post #25920
Posted 02/10/2010 2:25:06 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 07/06/2010 6:04:33 PM
Posts: 6,275, Visits: 6,165
I will respond to this in more detail later, but the long and short of it is this is how .NET reflection returns this through MethodInfo. The reason is that it is a generic and this is how generics show up through reflection. I can give a long winded explanation later, but this is not likely to change as it would require a fundamental change to the reflection interpretation which would break other things.
Post #25921
Posted 02/10/2010 3:51:52 PM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 2 days ago @ 7:16:53 PM
Posts: 78, Visits: 587
Hey Trent -

Thanks for the super-quick reply. No need for the chapter-and-verse. I am inferring from your response though that passing a dictionary in won't work, so Plan B ("now-needed" BO and a copy-from-bo-to-list-view approach wins out. Do I have that correct?



________________
_____/ Regards,
____/ al
Post #25925
Posted 02/10/2010 3:54:00 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 07/06/2010 6:04:33 PM
Posts: 6,275, Visits: 6,165
Yeah, that would work. You could also turn it into a KeyPair array and pass that over as well since it would no longer be interpreted as a generic.
Post #25926
Posted 02/10/2010 4:01:08 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 10:55:20 AM
Posts: 459, Visits: 18,484
Hey Alex -

Since you wouldn't accept my advice to check out Buffy as one of the greatest TV shows of all time you may pass on this too but ...

Regarding passing a lot of params to a sproc not sure if this will do you any good but might get you thinking about other ways to do it

http://forum.strataframe.net/Topic24706-26-1.aspx

I use if for stuff like passing a list of keys to do a subquery but the approach can be adapted for a lot of things.

Post #25927
Posted 02/11/2010 9:51:55 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 2 days ago @ 7:16:53 PM
Posts: 78, Visits: 587
LOL Charles... I figured enough time has passed and you would have forgotten about that by now!

Thanks for the link... I'll have a look and see where it leads me to.

________________
_____/ Regards,
____/ al


________________
_____/ Regards,
____/ al
Post #25936
Posted 02/11/2010 9:56:42 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 2 days ago @ 7:16:53 PM
Posts: 78, Visits: 587
Wow... nice stuff, Charles! That can be VERY useful in many scenarios... Will have to bring that into play next time.

.... so maybe I need to check the TV Listings for Buffy after all.....

________________
_____/ Regards,
____/ al
Post #25937
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Trent L. Taylor, Steve L. Taylor, Dustin Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 11:27am

Powered by InstantForum.NET v4.1.4 © 2010
Execution: 0.063. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.